Audit Logs Resource

Audit Logs

Whenever an admin action is performed on the API, an entry is added to the respective guild's audit log. You can specify the reason by attaching the X-Audit-Log-Reason request header. This header supports url encoded utf8 characters.

Audit Log Object

Audit Log Structure
FieldTypeDescription
webhooksarray of webhook objectslist of webhooks found in the audit log
usersarray of user objectslist of users found in the audit log
audit_log_entriesarray of audit log entry objectslist of audit log entires

Audit Log Entry Object

Audit Log Entry Structure
FieldTypeDescription
target_idstringid of the affected entity (webhook, user, role, etc.)
changesarray of audit log change objectschanges made to the target_id
user_idsnowflakethe user who made the changes
idsnowflakeid of the entry
action_typeaudit log eventtype of action that occured
optionsarray of optional audit entry info objectsadditional info for certain action types
reasonstringthe reason for the change
Audit Log Events
EventValue
GUILD_UPDATE1
CHANNEL_CREATE10
CHANNEL_UPDATE11
CHANNEL_DELETE12
CHANNEL_OVERWRITE_CREATE13
CHANNEL_OVERWRITE_UPDATE14
CHANNEL_OVERWRITE_DELETE15
MEMBER_KICK20
MEMBER_PRUNE21
MEMBER_BAN_ADD22
MEMBER_BAN_REMOVE23
MEMBER_UPDATE24
MEMBER_ROLE_UPDATE25
ROLE_CREATE30
ROLE_UPDATE31
ROLE_DELETE32
INVITE_CREATE40
INVITE_UPDATE41
INVITE_DELETE42
WEBHOOK_CREATE50
WEBHOOK_UPDATE51
WEBHOOK_DELETE52
EMOJI_CREATE60
EMOJI_UPDATE61
EMOJI_DELETE62
MESSAGE_DELETE72
Optional Audit Entry Info
FieldTypeDescriptionAction Type
delete_member_daysstringnumber of days after which inactive members were kickedMEMBER_PRUNE
members_removedstringnumber of members removed by the pruneMEMBER_PRUNE
channel_idsnowflakechannel in which the messages were deletedMESSAGE_DELETE
countstringnumber of deleted messagesMESSAGE_DELETE
idsnowflakeid of the overwritten entityCHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE
typestringtype of overwritten entity ("member" or "role")CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE
role_namestringname of the role if type is "role"CHANNEL_OVERWRITE_CREATE & CHANNEL_OVERWRITE_UPDATE & CHANNEL_OVERWRITE_DELETE

Audit Log Change Object

Audit Log Change Structure
FieldTypeDescription
new_valuemixednew value of the key
old_valuemixedold value of the key
keystringtype of audit log change key
Audit Log Change Key
NameObject ChangedTypeDescription
nameguildstringname changed
icon_hashguildstringicon changed
splash_hashguildstringinvite splash page artwork changed
owner_idguildsnowflakeowner changed
regionguildstringregion changed
afk_channel_idguildsnowflakeafk channel changed
afk_timeoutguildintegerafk timeout duration changed
mfa_levelguildintegertwo-factor auth requirement changed
verification_levelguildintegerrequired verification level changed
explicit_content_filterguildintegerchange in whose messages are scanned and deleted for explicit content in the server
default_message_notificationsguildintegerdefault message notification level changed
vanity_url_codeguildstringguild invite vanity url changed
$addguildarray of role objectsnew role added
$removeguildarray of role objectsrole removed
prune_delete_daysguildintegerchange in number of days after which inactive and role-unassigned members are kicked
widget_enabledguildboolserver widget enabled/disable
widget_channel_idguildsnowflakechannel id of the server widget changed
positionchannelintegertext or voice channel position changed
topicchannelstringtext channel topic changed
bitratechannelintegervoice channel bitrate changed
permission_overwriteschannelarray of channel overwrite objectspermissions on a channel changed
nsfwchannelboolchannel nsfw restriction changed
application_idchannelsnowflakeapplication id of the added or removed webhook or bot
permissionsroleintegerpermissions for a role changed
colorroleintegerrole color changed
hoistroleboolrole is now displayed/no longer displayed separate from online users
mentionableroleboolrole is now mentionable/unmentionable
allowroleintegera permission on a text or voice channel was allowed for a role
denyroleintegera permission on a text or voice channel was denied for a role
codeinvitestringinvite code changed
channel_idinvitesnowflakechannel for invite code changed
inviter_idinvitesnowflakeperson who created invite code changed
max_usesinviteintegerchange to max number of times invite code can be used
usesinviteintegernumber of times invite code used changed
max_ageinviteintegerhow long invite code lasts changed
temporaryinviteboolinvite code is temporary/never expires
deafuserbooluser server deafened/undeafened
muteuserbooluser server muted/unmuteds
nickuserstringuser nickname changed
avatar_hashuserstringuser avatar changed
idanysnowflakethe id of the changed entity - sometimes used in conjunction with other keys
typeanyinteger (channel type) or stringtype of entity created

Get Guild Audit Log

GET/guilds/{guild.id}/audit-logs
Returns an audit log object for the guild. Requires the 'VIEW_AUDIT_LOG' permission.
Query String Parameters
FieldTypeDescription
user_idsnowflakefilter the log for a user id
action_typeintthe type of audit log event
beforesnowflakefilter the log before a certain entry id
limitintegerhow many entries are returned (default 50, minimum 1, maximum 100)