Skip to main content
When an administrative action is performed in a guild, an entry is added to its audit log. Viewing audit logs requires the VIEW_AUDIT_LOG permission and can be fetched by apps using the GET /guilds/{guild.id}/audit-logs endpoint, or seen by users in the guild’s Server Settings. All audit log entries are stored for 45 days. When an app is performing an eligible action using the APIs, it can pass an X-Audit-Log-Reason header to indicate why the action was taken. More information is in the audit log entry section.

Audit Log Object

Audit Log Structure
FieldTypeDescription
application_commandsarray of application commands objectsList of application commands referenced in the audit log
audit_log_entriesarray of audit log entry objectsList of audit log entries, sorted from most to least recent
auto_moderation_rulesarray of auto moderation rule objectsList of auto moderation rules referenced in the audit log
guild_scheduled_eventsarray of guild scheduled event objectsList of guild scheduled events referenced in the audit log
integrationsarray of partial integration objectsList of partial integration objects
threadsarray of thread-specific channel objectsList of threads referenced in the audit log*
usersarray of user objectsList of users referenced in the audit log
webhooksarray of webhook objectsList of webhooks referenced in the audit log
* Threads referenced in THREAD_CREATE and THREAD_UPDATE events are included in the threads map since archived threads might not be kept in memory by clients.
Example Partial Integration Object
{
  "id": "33590653072239123",
  "name": "A Name",
  "type": "twitch",
  "account": {
    "name": "twitchusername",
    "id": "1234567"
  },
  "application_id": "94651234501213162"
}

Audit Log Entry Object

Each audit log entry represents a single administrative action (or event), indicated by action_type. Most entries contain one to many changes in the changes array that affected an entity in Discord—whether that’s a user, channel, guild, emoji, or something else. The information (and structure) of an entry’s changes will be different depending on its type. For example, in MEMBER_ROLE_UPDATE events there is only one change: a member is either added or removed from a specific role. However, in CHANNEL_CREATE events there are many changes, including (but not limited to) the channel’s name, type, and permission overwrites added. More details are in the change object section. Apps can specify why an administrative action is being taken by passing an X-Audit-Log-Reason request header, which will be stored as the audit log entry’s reason field. The X-Audit-Log-Reason header supports 1-512 URL-encoded UTF-8 characters. Reasons are visible to users in the client and to apps when fetching audit log entries with the API.
Audit Log Entry Structure
FieldTypeDescription
target_id?stringID of the affected entity (webhook, user, role, etc.)
changes?array of audit log change objectsChanges made to the target_id
user_id?snowflakeUser or app that made the changes
idsnowflakeID of the entry
action_typeaudit log eventType of action that occurred
options?optional audit entry infoAdditional info for certain event types
reason?stringReason for the change (1-512 characters)
For APPLICATION_COMMAND_PERMISSION_UPDATE events, the target_id is the command ID or the app ID since the changes array represents the entire permissions property on the guild permissions object.
Audit Log Events
The table below lists audit log events and values (the action_type field) that your app may receive. The Object Changed column notes which object’s values may be included in the entry. Though there are exceptions, possible keys in the changes array typically correspond to the object’s fields. The descriptions and types for those fields can be found in the linked documentation for the object. If no object is noted, there won’t be a changes array in the entry, though other fields like the target_id still exist and many have fields in the options object.
You should assume that your app may run into any field for the changed object, though none are guaranteed to be present. In most cases only a subset of the object’s fields will be in the changes array.
EventValueDescriptionObject Changed
GUILD_UPDATE1Server settings were updatedGuild
CHANNEL_CREATE10Channel was createdChannel
CHANNEL_UPDATE11Channel settings were updatedChannel
CHANNEL_DELETE12Channel was deletedChannel
CHANNEL_OVERWRITE_CREATE13Permission overwrite was added to a channelChannel Overwrite
CHANNEL_OVERWRITE_UPDATE14Permission overwrite was updated for a channelChannel Overwrite
CHANNEL_OVERWRITE_DELETE15Permission overwrite was deleted from a channelChannel Overwrite
MEMBER_KICK20Member was removed from server
MEMBER_PRUNE21Members were pruned from server
MEMBER_BAN_ADD22Member was banned from server
MEMBER_BAN_REMOVE23Server ban was lifted for a member
MEMBER_UPDATE24Member was updated in serverMember
MEMBER_ROLE_UPDATE25Member was added or removed from a rolePartial Role*
MEMBER_MOVE26Member was moved to a different voice channel
MEMBER_DISCONNECT27Member was disconnected from a voice channel
BOT_ADD28Bot user was added to server
ROLE_CREATE30Role was createdRole
ROLE_UPDATE31Role was editedRole
ROLE_DELETE32Role was deletedRole
INVITE_CREATE40Server invite was createdInvite and Invite Metadata*
INVITE_UPDATE41Server invite was updatedInvite and Invite Metadata*
INVITE_DELETE42Server invite was deletedInvite and Invite Metadata*
WEBHOOK_CREATE50Webhook was createdWebhook*
WEBHOOK_UPDATE51Webhook properties or channel were updatedWebhook*
WEBHOOK_DELETE52Webhook was deletedWebhook*
EMOJI_CREATE60Emoji was createdEmoji
EMOJI_UPDATE61Emoji name was updatedEmoji
EMOJI_DELETE62Emoji was deletedEmoji
MESSAGE_DELETE72Single message was deleted
MESSAGE_BULK_DELETE73Multiple messages were deleted
MESSAGE_PIN74Message was pinned to a channel
MESSAGE_UNPIN75Message was unpinned from a channel
INTEGRATION_CREATE80App was added to serverIntegration
INTEGRATION_UPDATE81App was updated (as an example, its scopes were updated)Integration
INTEGRATION_DELETE82App was removed from serverIntegration
STAGE_INSTANCE_CREATE83Stage instance was created (stage channel becomes live)Stage Instance
STAGE_INSTANCE_UPDATE84Stage instance details were updatedStage Instance
STAGE_INSTANCE_DELETE85Stage instance was deleted (stage channel no longer live)Stage Instance
STICKER_CREATE90Sticker was createdSticker
STICKER_UPDATE91Sticker details were updatedSticker
STICKER_DELETE92Sticker was deletedSticker
GUILD_SCHEDULED_EVENT_CREATE100Event was createdGuild Scheduled Event
GUILD_SCHEDULED_EVENT_UPDATE101Event was updatedGuild Scheduled Event
GUILD_SCHEDULED_EVENT_DELETE102Event was cancelledGuild Scheduled Event
THREAD_CREATE110Thread was created in a channelThread
THREAD_UPDATE111Thread was updatedThread
THREAD_DELETE112Thread was deletedThread
APPLICATION_COMMAND_PERMISSION_UPDATE121Permissions were updated for a commandCommand Permission*
SOUNDBOARD_SOUND_CREATE130Soundboard sound was createdSoundboard Sound
SOUNDBOARD_SOUND_UPDATE131Soundboard sound was updatedSoundboard Sound
SOUNDBOARD_SOUND_DELETE132Soundboard sound was deletedSoundboard Sound
AUTO_MODERATION_RULE_CREATE140Auto Moderation rule was createdAuto Moderation Rule
AUTO_MODERATION_RULE_UPDATE141Auto Moderation rule was updatedAuto Moderation Rule
AUTO_MODERATION_RULE_DELETE142Auto Moderation rule was deletedAuto Moderation Rule
AUTO_MODERATION_BLOCK_MESSAGE143Message was blocked by Auto Moderation
AUTO_MODERATION_FLAG_TO_CHANNEL144Message was flagged by Auto Moderation
AUTO_MODERATION_USER_COMMUNICATION_DISABLED145Member was timed out by Auto Moderation
AUTO_MODERATION_QUARANTINE_USER146Member was quarantined by Auto Moderation
CREATOR_MONETIZATION_REQUEST_CREATED150Creator monetization request was created
CREATOR_MONETIZATION_TERMS_ACCEPTED151Creator monetization terms were accepted
ONBOARDING_PROMPT_CREATE163Guild Onboarding Question was createdOnboarding Prompt Structure
ONBOARDING_PROMPT_UPDATE164Guild Onboarding Question was updatedOnboarding Prompt Structure
ONBOARDING_PROMPT_DELETE165Guild Onboarding Question was deletedOnboarding Prompt Structure
ONBOARDING_CREATE166Guild Onboarding was createdGuild Onboarding
ONBOARDING_UPDATE167Guild Onboarding was updatedGuild Onboarding
HOME_SETTINGS_CREATE190Guild Server Guide was created
HOME_SETTINGS_UPDATE191Guild Server Guide was updated
* Object has exception(s) to available keys. See the exceptions section below for details.
Optional Audit Entry Info
FieldTypeDescriptionEvent Types
application_idsnowflakeID of the app whose permissions were targetedAPPLICATION_COMMAND_PERMISSION_UPDATE
auto_moderation_rule_namestringName of the Auto Moderation rule that was triggeredAUTO_MODERATION_BLOCK_MESSAGE & AUTO_MODERATION_FLAG_TO_CHANNEL & AUTO_MODERATION_USER_COMMUNICATION_DISABLED & AUTO_MODERATION_QUARANTINE_USER
auto_moderation_rule_trigger_typestringTrigger type of the Auto Moderation rule that was triggeredAUTO_MODERATION_BLOCK_MESSAGE & AUTO_MODERATION_FLAG_TO_CHANNEL & AUTO_MODERATION_USER_COMMUNICATION_DISABLED & AUTO_MODERATION_QUARANTINE_USER
channel_idsnowflakeChannel in which the entities were targetedMEMBER_MOVE & MESSAGE_PIN & MESSAGE_UNPIN & MESSAGE_DELETE & STAGE_INSTANCE_CREATE & STAGE_INSTANCE_UPDATE & STAGE_INSTANCE_DELETE & AUTO_MODERATION_BLOCK_MESSAGE & AUTO_MODERATION_FLAG_TO_CHANNEL & AUTO_MODERATION_USER_COMMUNICATION_DISABLED & AUTO_MODERATION_QUARANTINE_USER
countstringNumber of entities that were targetedMESSAGE_DELETE & MESSAGE_BULK_DELETE & MEMBER_DISCONNECT & MEMBER_MOVE
delete_member_daysstringNumber of days after which inactive members were kickedMEMBER_PRUNE
idsnowflakeID of the overwritten entityCHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE
members_removedstringNumber of members removed by the pruneMEMBER_PRUNE
message_idsnowflakeID of the message that was targetedMESSAGE_PIN & MESSAGE_UNPIN
role_namestringName of the role if type is "0" (not present if type is "1")CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE
typestringType of overwritten entity - role ("0") or member ("1")CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE
integration_typestringThe type of integration which performed the actionMEMBER_KICK & MEMBER_ROLE_UPDATE

Audit Log Change Object

Many audit log events include a changes array in their entry object. The structure for the individual changes varies based on the event type and its changed objects, so apps shouldn’t depend on a single pattern of handling audit log events.
Audit Log Change Structure
Some events don’t follow the same pattern as other audit log events. Details about these exceptions are explained in the next section.
If new_value is not present in the change object while old_value is, it indicates that the property has been reset or set to null. If old_value isn’t included, it indicated that the property was previously null.
FieldTypeDescription
new_value?mixed (matches object field’s type)New value of the key
old_value?mixed (matches object field’s type)Old value of the key
keystringName of the changed entity, with a few exceptions
Audit Log Change Exceptions
For most objects, the change keys may be any field on the changed object. The following table details the exceptions to this pattern.
Object ChangedChange Key ExceptionsChange Object Exceptions
Command Permissionsnowflake as keyThe changes array contains objects with a key field representing the entity whose command was affected (role, channel, or user ID), a previous permissions object (with an old_value key), and an updated permissions object (with a new_value key)
Invite and Invite MetadataAdditional channel_id key (instead of object’s channel.id)
Partial Role$add and $remove as keysnew_value is an array of objects that contain the role id and name
Webhookavatar_hash key (instead of avatar)

Get Guild Audit Log

GET/guilds/{guild.id}/audit-logs
Returns an audit log object for the guild. Requires the VIEW_AUDIT_LOG permission. The returned list of audit log entries is ordered based on whether you use before or after. When using before, the list is ordered by the audit log entry ID descending (newer entries first). If after is used, the list is reversed and appears in ascending order (older entries first). Omitting both before and after defaults to before the current timestamp and will show the most recent entries in descending order by ID, the opposite can be achieved using after=0 (showing oldest entries).
Query String Params
The following parameters can be used to filter which and how many audit log entries are returned.
FieldTypeDescription
user_id?snowflakeEntries from a specific user ID
action_type?integerEntries for a specific audit log event
before?snowflakeEntries with ID less than a specific audit log entry ID
after?snowflakeEntries with ID greater than a specific audit log entry ID
limit?integerMaximum number of entries (between 1-100) to return, defaults to 50