Skip to content
Fluxer API

Guild audit logs

An audit log entry records one change to a guild and who made it. You get entries with List guild audit logs or its Admin API counterpart. Entries are kept for 45 days.

Each new entry is also sent as Guild Audit Log Entry Create to sessions with VIEW_AUDIT_LOG.

A route marked Audit reason accepts the X-Audit-Log-Reason header, listed with the standard request headers. The value is trimmed and used as sent, with no percent-decoding. A blank value or one over 512 characters is dropped and the request still succeeds.

When the header is absent, Create or replace guild ban uses the body reason, and Modify guild member uses timeout_reason if the body sets communication_disabled_until. Bot additions, message deletions made by Delete message attachment and entries made by message deletion consolidation never have a reason.

One page of entries with the users, webhooks and threads they reference.

FieldTypeDescription
audit_log_entriesarray[guild audit log entry object]The page of entries
usersarray[partial user object]The users the entries reference
webhooksarray[audit log webhook object]The webhooks that webhook entries target and that still exist
threads?1array[thread object]The threads that thread entries target and that still exist

1 Present only for a bot and for a user session that declares the channel_threads client capability

users has every user an entry was made by or refers to. A deleted user is returned as DeletedUser.

One change to the guild.

FieldTypeDescription
idsnowflakeThe ID of the entry
action_typeintegerThe audit action
user_id1snowflakeThe ID of the user that did the action
target_id2?stringThe ID of the affected entity
reason?stringThe audit log reason
options?audit log options objectThe options the action records
changes?array[audit log change object]The fields the action changed

1 0, the system user, when Fluxer made the change itself. That covers a member removal, ban or unban by an instance admin through the Admin API, an automatic invite pause and a managed role update

2 The invite code for INVITE_CREATE and INVITE_DELETE, and null for MESSAGE_BULK_DELETE

{
"id": "1501314428688998184",
"action_type": 24,
"user_id": "1489002177550843905",
"target_id": "1489002177550843906",
"reason": "Nickname violated the rules",
"changes": [{"key": "nick", "old_value": "spam bot", "new_value": null}]
}

Each value is an action_type, and the action_type query filter takes the same values. An update or a member move records an entry only when something changed. For GUILD_UPDATE, a change to only guild_id, member_count or an image width or height records nothing.

ValueNameDescription
1GUILD_UPDATEGuild settings, custom invite URL or ownership changed. target_id is the guild
10CHANNEL_CREATEChannel created. target_id is the channel and the option is type
11CHANNEL_UPDATEChannel changed. target_id is the channel and the option is type
12CHANNEL_DELETEChannel deleted. target_id is the channel and the option is type
13CHANNEL_OVERWRITE_CREATE1Permission overwrite created. target_id is the role or member
14CHANNEL_OVERWRITE_UPDATE1Permission overwrite changed. target_id is the role or member
15CHANNEL_OVERWRITE_DELETE1Permission overwrite deleted. target_id is the role or member
20MEMBER_KICKMember removed by a moderator. target_id is the user
21MEMBER_PRUNE2Inactive members pruned
22MEMBER_BAN_ADDBan created or replaced. target_id is the user and the option is delete_message_seconds
23MEMBER_BAN_REMOVEBan removed. target_id is the user
24MEMBER_UPDATEMember changed. target_id is the user
25MEMBER_ROLE_UPDATEOne role added to or removed from a member. target_id is the user and the option is role_name
26MEMBER_MOVE3Member moved to another voice channel. target_id is the user
27MEMBER_DISCONNECT3Member disconnected from voice. target_id is the user
28BOT_ADDBot added. target_id is the user and the option is temporary
30ROLE_CREATERole created. target_id is the role
31ROLE_UPDATERole changed. target_id is the role and the option is role_name
32ROLE_DELETERole deleted. target_id is the role
40INVITE_CREATE4Invite created. target_id is the invite code
41INVITE_UPDATE2Invite changed. target_id is the invite code
42INVITE_DELETE4Invite deleted. target_id is the invite code
50WEBHOOK_CREATE5Webhook created. target_id is the webhook and the options are channel_id and type
51WEBHOOK_UPDATEWebhook changed. target_id is the webhook and the options are channel_id and type
52WEBHOOK_DELETE5Webhook deleted. target_id is the webhook and the options are channel_id and type
60EMOJI_CREATEEmoji created. target_id is the emoji
61EMOJI_UPDATEEmoji changed. target_id is the emoji
62EMOJI_DELETEEmoji deleted. target_id is the emoji
72MESSAGE_DELETEMessage deleted. target_id is the message and the option is channel_id
73MESSAGE_BULK_DELETEMessages deleted together. target_id is null and the options are channel_id and count
74MESSAGE_PINMessage pinned. target_id is the message and the options are channel_id and message_id
75MESSAGE_UNPINMessage unpinned. target_id is the message and the options are channel_id and message_id
90STICKER_CREATESticker created. target_id is the sticker
91STICKER_UPDATESticker changed. target_id is the sticker
92STICKER_DELETESticker deleted. target_id is the sticker
110THREAD_CREATEThread created. target_id is the thread
111THREAD_UPDATEThread changed. target_id is the thread and the option is type
112THREAD_DELETEThread deleted. target_id is the thread and the option is type

1 The options are id, type, channel_id and role_name, and role_name is recorded only for a role other than @everyone

2 Never recorded. The filter still accepts it

3 The options are channel_id and count, and count is always 1. channel_id is the new channel for a move and the channel the member left for a disconnect

4 The options are max_age, max_uses, temporary, channel_id and inviter_id, and the last two are recorded only when the invite has them

5 Follow announcement channel records these in the guild that follows the channel, with type 2

Deleting a channel deletes its threads and records only CHANNEL_DELETE.

An action records only the options listed for it in audit actions, and options is omitted when it has none.

FieldTypeDescription
channel_idstringThe ID of the channel the action concerns
countnumberThe number of entities the action affected
delete_member_days1stringThe whole days of messages a ban deleted
delete_message_secondsnumberThe seconds of messages a ban deleted, present when positive
idstringThe ID of the role or member an overwrite applies to
integration_type2numberThe type of the integration
inviter_idstringThe ID of the user that created the invite
max_agenumberThe invite lifetime in seconds
max_usesnumberThe maximum use count of the invite
members_removed2numberThe number of memberships the action removed
message_idstringThe ID of the message the action concerns
role_namestringThe name of the role when the entry was written
temporarybooleanWhether the invite or bot membership is temporary
typenumberThe channel type, permission overwrite type or webhook type
uses2numberThe use count of the invite

1 Present only on older ban entries, which have no delete_message_seconds

2 Never recorded

One field an action changed. A creation has only new_value, a deletion has only old_value, and a modification has both.

FieldTypeDescription
keystringThe name of the field that changed, from the change fields of the target
old_value?audit log change valueThe value before the change
new_value?audit log change valueThe value after the change

A change value is a string, number, boolean, null, an array of strings or numbers, or an object with added and removed string arrays. Permission masks and snowflakes are decimal strings. An update lists only the fields that differ.

Recorded by GUILD_UPDATE.

FieldTypeDescription
guild_idstringThe ID of the guild
namestringThe name of the guild (1-100 characters)
owner_idstringThe ID of the guild owner
vanity_url_code?stringThe custom invite code
icon_hash?stringThe guild icon hash
banner_hash?stringThe guild banner hash
banner_width?numberThe guild banner width in pixels
banner_height?numberThe guild banner height in pixels
splash_hash?stringThe guild splash hash
splash_width?numberThe guild splash width in pixels
splash_height?numberThe guild splash height in pixels
splash_card_alignmentnumberThe splash card alignment
embed_splash_hash?stringThe guild embed splash hash
embed_splash_width?numberThe guild embed splash width in pixels
embed_splash_height?numberThe guild embed splash height in pixels
featuresarray[string]The guild features sorted
verification_levelnumberThe verification level
mfa_levelnumberThe MFA level
nsfw_levelnumberThe NSFW level
nsfwbooleanWhether the guild is marked age restricted
content_warning_levelnumberThe guild content warning level
content_warning_text?stringThe content warning text
explicit_content_filternumberThe guild explicit content filter level
default_message_notificationsnumberThe default message notification level
system_channel_id?stringThe ID of the system channel
system_channel_flagsnumberThe system channel flags mask
rules_channel_id1?stringThe ID of the rules channel
afk_channel_id?stringThe ID of the AFK voice channel
afk_timeoutnumberThe AFK timeout in seconds
disabled_operations1numberThe disabled guild operations mask
member_count1numberThe member count
message_history_cutoff?ISO8601 timestampThe message history cutoff

1 Never recorded

Recorded by CHANNEL_CREATE, CHANNEL_UPDATE and CHANNEL_DELETE.

FieldTypeDescription
channel_idstringThe ID of the channel
typenumberThe channel type
name?stringThe name of the channel
topic?stringThe topic of the channel
url1?stringThe destination URL of the channel
parent_id?stringThe ID of the parent category, or null for a top-level channel
positionnumberThe position of the channel among its siblings
nsfw?booleanWhether the channel is marked age restricted, or null when it has no override
content_warning_levelnumberThe content warning level
content_warning_text?stringThe content warning text
rate_limit_per_usernumberThe slowmode interval in seconds
user_limit?numberThe voice occupancy limit
voice_connection_limit?numberThe per-user voice connection limit
bitrate?numberThe voice bitrate in bits per second
rtc_region?stringThe pinned voice region, or null when the channel is routed automatically
rtc_p2pbooleanWhether the channel is pinned to peer-to-peer voice
permission_overwrite_count2numberThe number of permission overwrites the channel has
flags3numberThe channel flags of the channel
default_auto_archive_duration3numberThe stored default auto archive duration
default_thread_rate_limit_per_user3numberThe slowmode interval in seconds new threads inherit
available_tags3array[forum tag object]The tags a post can apply
default_reaction_emoji3default reaction objectThe reaction clients show on each post
default_sort_order3numberThe default sort order of posts
default_forum_layout3numberThe default layout of posts
default_tag_setting3stringThe default tag matching of a post search

1 Recorded only for a GUILD_LINK channel type

2 Never recorded. Each overwrite change gets its own permission overwrite entry

3 Recorded only by CHANNEL_CREATE and CHANNEL_UPDATE, for channels with thread or forum settings

Recorded by THREAD_CREATE, THREAD_UPDATE and THREAD_DELETE.

FieldTypeDescription
namestringThe name of the thread
typenumberThe thread type
archivedbooleanWhether the thread is archived
lockedbooleanWhether the thread is locked
auto_archive_durationnumberThe auto archive duration in minutes
rate_limit_per_usernumberThe slowmode interval in seconds
flagsnumberThe channel flags of the thread
invitable1booleanWhether members who are not thread moderators can add people to the thread
applied_tags2array[string]The IDs of the applied forum tags

1 Recorded only for a private thread

2 Recorded only for a thread whose parent is a forum or media channel

Recorded by CHANNEL_OVERWRITE_CREATE, CHANNEL_OVERWRITE_UPDATE and CHANNEL_OVERWRITE_DELETE, and every value is a string.

FieldTypeDescription
idstringThe ID of the role or member the overwrite applies to
typestringThe permission overwrite type
allowstringThe permission mask the overwrite grants
denystringThe permission mask the overwrite denies

Recorded by MEMBER_UPDATE and MEMBER_ROLE_UPDATE.

FieldTypeDescription
user_idstringThe ID of the member
nick?stringThe member's nickname in this guild
rolesarray[string]The role IDs of the member, sorted
avatar_hash?stringThe guild avatar hash
banner_hash?stringThe guild banner hash
bio?stringThe guild profile bio
pronouns?stringThe guild profile pronouns
accent_color?numberThe guild profile accent color
deafbooleanWhether a moderator has deafened the member
mutebooleanWhether a moderator has muted the member
communication_disabled_until?ISO8601 timestampThe time the communication restriction expires, or null when the member is not restricted
temporarybooleanWhether the membership is temporary

Recorded by MEMBER_MOVE and MEMBER_DISCONNECT.

FieldTypeDescription
channel_id1stringThe ID of the voice channel

1 A move has the previous channel as old_value and the destination as new_value, and a disconnect has only old_value

Recorded by MEMBER_BAN_ADD and MEMBER_BAN_REMOVE.

FieldTypeDescription
user_idstringThe ID of the banned user
moderator_idstringThe ID of the user that issued the ban
banned_atISO8601 timestampThe time the ban was issued
expires_at?ISO8601 timestampThe expiry of a temporary ban, or null for a permanent ban
reason1?stringThe stored ban reason

1 The reason stored on the ban, which is the body reason or, without one, the X-Audit-Log-Reason value

Recorded by ROLE_CREATE, ROLE_UPDATE and ROLE_DELETE.

FieldTypeDescription
role_idstringThe ID of the role
namestringThe name of the role (1-100 characters)
permissionsstringThe permission mask the role grants
positionnumberThe position of the role in the guild hierarchy
hoist_position?numberThe member list position of the role, or null when it uses position
colornumberThe role color as an integer
icon_hash?stringThe role icon hash
unicode_emoji?stringThe role Unicode emoji
hoistbooleanWhether the role is displayed separately
mentionablebooleanWhether the role is mentionable
permissions_diff1objectThe permission names this change added and removed

1 Recorded only by Modify guild role when the mask changed, as new_value with no old_value

Recorded by INVITE_CREATE and INVITE_DELETE.

FieldTypeDescription
codestringThe code that identifies the invite
channel_id?stringThe ID of the channel the invite points at
guild_id?stringThe ID of the guild the invite belongs to
inviter_id?stringThe ID of the user that created the invite
usesnumberThe use count
max_usesnumberThe maximum use count
max_agenumberThe invite lifetime in seconds
temporarybooleanWhether accepting the invite grants a temporary membership
created_atISO8601 timestampThe time the invite was created

Recorded by WEBHOOK_CREATE, WEBHOOK_UPDATE and WEBHOOK_DELETE.

FieldTypeDescription
idstringThe ID of the webhook
guild_id?stringThe ID of the guild the webhook belongs to
channel_id?stringThe ID of the channel the webhook posts to
namestringThe name the webhook posts under (1-80 characters)
creator_id?stringThe ID of the user that created the webhook
avatar_hash?stringThe webhook avatar hash
typenumberThe webhook type

Recorded by EMOJI_CREATE, EMOJI_UPDATE and EMOJI_DELETE.

FieldTypeDescription
emoji_idstringThe ID of the emoji
namestringThe name of the emoji (2-32 characters)
animatedbooleanWhether the emoji is animated
creator_idstringThe ID of the user that created the emoji

Recorded by STICKER_CREATE, STICKER_UPDATE and STICKER_DELETE.

FieldTypeDescription
sticker_idstringThe ID of the sticker
namestringThe name of the sticker (2-30 characters)
description?stringThe sticker description
animatedbooleanWhether the sticker is animated
creator_idstringThe ID of the user that created the sticker

A reduced webhook object without the token, application ID and creator, and with avatar_hash in place of avatar.

FieldTypeDescription
idsnowflakeThe ID of the webhook
typeintegerThe webhook type
guild_id?snowflakeThe ID of the guild containing the webhook
channel_id?snowflakeThe ID of the channel the webhook sends messages to
namestringThe name the webhook posts under
avatar_hash?stringThe avatar hash of the webhook
GET/v1/guilds/{guild_id}/audit-logsBot

Returns one page of audit history as a guild audit log response object, newest first. You need VIEW_AUDIT_LOG.

FieldTypeDescription
limit?integerThe maximum number of entries to return (0-100, default 50)
before?snowflakeReturns entries older than this entry ID
after?snowflakeReturns entries newer than this entry ID
user_id?snowflakeReturns only entries made by this user
action_type?integerReturns only entries with this audit action

Two or more MESSAGE_DELETE entries in a row by the same user in the same channel are replaced by one MESSAGE_BULK_DELETE entry with a new ID and a count. This happens within about a minute of the deletions, and again on any read without user_id or action_type.

A user session without the channel_threads capability gets no entries about threads, forum channels or media channels, and filtering by actions 110 to 112 returns 400.

StatusBodyCondition
200guild audit log response objectThe page was returned
400error responseCANNOT_SPECIFY_BOTH_BEFORE_AND_AFTER when both cursors are sent, or a filter value is invalid
403error responseYou lack VIEW_AUDIT_LOG
404error responseThe guild does not exist

The rate limit is 20 requests per 10 seconds, on the guild:audit_logs::guild_id bucket.