Skip to content

Audit Logs

Every CRUD mutation on an org-scoped resource writes an audit-log entry recording who changed what and when. These endpoints are read-only — entries are created automatically by the handlers, never through the API. All results are scoped to the caller's organization.

Return audit-log entries for the organization, newest first.

Terminal window
GET /api/audit-logs
ParameterTypeDescription
resource_typestringFilter by resource type (e.g. contacts, settings.general, settings.calling, roles).
resource_iduuidFilter by the affected record's ID.
user_iduuidFilter by the actor who made the change.
actionstringFilter by action: created, updated, or deleted.
fromstringOnly entries at/after this time. Accepts YYYY-MM-DD or RFC 3339.
tostringOnly entries at/before this time. A YYYY-MM-DD value is treated as end-of-day.
pageintegerPage number (default 1).
limitintegerPage size.

The list is wrapped under the audit_logs key, with total, page, and limit:

{
"status": "success",
"data": {
"audit_logs": [
{
"id": "uuid",
"resource_type": "contacts",
"resource_id": "uuid",
"user_id": "uuid",
"user_name": "Jane Admin",
"action": "updated",
"changes": [
{
"field": "profile_name",
"old_value": "John",
"new_value": "John Doe"
}
],
"created_at": "2024-01-01T12:00:00Z"
}
],
"total": 128,
"page": 1,
"limit": 20
}
}

Return a single audit-log entry by ID.

Terminal window
GET /api/audit-logs/{id}
{
"status": "success",
"data": {
"id": "uuid",
"resource_type": "settings.calling",
"resource_id": "uuid",
"user_id": "uuid",
"user_name": "Jane Admin",
"action": "updated",
"changes": [
{
"field": "hold_music_file",
"old_value": "",
"new_value": "org_<id>_hold_music.ogg"
}
],
"created_at": "2024-01-01T12:00:00Z"
}
}

Requesting an ID that isn't in the caller's organization returns 404.

FieldTypeDescription
iduuidAudit-log entry ID.
resource_typestringThe kind of resource that changed.
resource_iduuidID of the affected record.
user_iduuidActor who performed the action.
user_namestringActor's display name, captured at write time.
actionstringcreated, updated, or deleted.
changesarrayField-level diff (see below).
created_atstringWhen the change occurred (RFC 3339).

changes is an array of { field, old_value, new_value } objects:

  • created — one entry per field, with old_value null.
  • deleted — one entry per field, with new_value null.
  • updated — only the fields that actually changed.

Metadata fields (id, timestamps, organization_id, and similar) are never diffed. Certain JSONB columns are flattened to a single readable sub-field — for example a chatbot response's response_content is diffed on its body text rather than the whole object.