LammaDevelopers Open Lamma

API reference

Read who did what in a server, and why.

The audit log records who did what in a server, and why. Bots can read it with the View audit log permission on their role, the same rule people follow.

#Get server audit log

GET/v1/guilds/{guild_id}/audit-logs

Returns { "audit_log_entries": [...] }, newest first. Without View audit log it answers 403 missing_permissions.

QueryTypeNotes
limitinteger1 to 100
beforeentry idEntries before this one
afterentry idEntries after this one
user_iduser idOnly actions by this person
action_typeintegerOnly this kind of action

To hear about new entries as they happen, use the guild_moderation intent and GUILD_AUDIT_LOG_ENTRY_CREATE.

#Audit log entry

JSON
{
  "id": "…", "guild_id": "…", "action_type": 22, "action": "member_banned",
  "user_id": "…", "target_id": "…", "reason": "Spam links",
  "options": {}, "changes": [], "created_at": 1759312800000
}
FieldTypeNotes
idstring
guild_idstring
action_typeinteger or nullDiscord's audit log event number, so existing code can switch on it: 22 for a ban, 24 for a member update such as a timeout or nickname, 30 for a new role. null for actions Discord doesn't log, such as joins and leaves
actionstringLamma's own name for the action, such as member_banned or member_joined
user_idstring or nullWho did it. null for automatic actions such as AutoMod
target_idstring or nullWhat it was done to
reasonstring or null
optionsobjectExtra details recorded with the action
changesarray[{ key, old_value, new_value }] for edits that recorded before and after
created_atintegerUnix milliseconds