Audit Trail

The /audit-trail endpoint allows you to query audit events that track actions performed across your account. Every create, update, delete, publish, and other mutation is recorded with details about who performed the action, what resource was affected, and when it happened.

List Audit Events

/api/v1/audit-trail

Method: GET

Requirements: User must have project:admin or account:admin permission. Project admins can only view events within their own project.

Headers

HeaderValueDescription
AuthorizationBearer <YOUR_JWT_TOKEN>JWT token for authentication

Query Parameters

Filters

ParameterData TypeDescription
actionsstringComma-separated list of action types to filter by. Values: create, update, delete, bulk_update, bulk_delete, attach, detach, publish, unpublish.
resourceTypesstringComma-separated list of resource types to filter by (e.g. interaction, object, workflow).
resourceIdstringFilter by a specific resource ID.
principalIdstringFilter by principal ID (API keys, service accounts).
principalUserIdstringFilter by principal user ID (human users).
projectIdstringFilter by project ID. Only available to account admins; project admins are automatically scoped to their project.

Date Range

ParameterData TypeDescription
fromstringStart time as an ISO 8601 string (e.g. 2025-01-01T00:00:00Z).
tostringEnd time as an ISO 8601 string (e.g. 2025-01-31T23:59:59Z).

Pagination

ParameterData TypeDescription
limitnumberNumber of events to return. Default: 50, max: 200.
offsetnumberNumber of events to skip for pagination. Default: 0.

Example Response

{
  "events": [
    {
      "event_type": "audit",
      "action": "update",
      "resource_type": "interaction",
      "resource_id": "6789abcd0123ef4567890123",
      "timestamp": "2025-01-15T14:32:10.000Z",
      "request_id": "req_abc123def456",
      "status": 200,
      "success": true,
      "principal_id": "key_abc123",
      "principal_type": "apikey",
      "principal_user_id": "user_xyz789",
      "roles": ["project_admin"],
      "account_id": "acct_001",
      "project_id": "proj_001",
      "tenant_id": "tenant_001",
      "account_name": "My Account",
      "project_name": "My Project"
    }
  ],
  "hasNext": true,
  "limit": 50,
  "offset": 0
}

AuditTrailEvent Fields

FieldData TypeDescription
event_typestringAlways "audit".
actionAuditActionThe action that was performed. One of: create, update, delete, bulk_update, bulk_delete, attach, detach, publish, unpublish.
resource_typestringThe type of resource that was affected (e.g. interaction, object, workflow).
resource_idstringThe ID of the affected resource.
timestampstringISO 8601 timestamp of when the event occurred.
request_idstringUnique identifier for the HTTP request that triggered the event.
statusnumberHTTP status code of the response.
successbooleanWhether the action completed successfully.
principal_idstring | nullID of the principal that performed the action (API key or service account).
principal_typestring | nullType of principal (e.g. apikey, user).
principal_user_idstring | nullID of the human user, if applicable.
rolesstring[]Roles assigned to the principal at the time of the event.
account_idstring | nullAccount ID.
project_idstring | nullProject ID.
tenant_idstring | nullTenant ID.
account_namestring | nullHuman-readable account name.
project_namestring | nullHuman-readable project name.

Code Examples

List Audit Events

curl --location --request GET 'https://api.vertesia.io/api/v1/audit-trail?actions=create,update&from=2025-01-01T00:00:00Z&to=2025-01-31T23:59:59Z&limit=20' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Paginating Through Results

Use offset and the hasNext field to paginate through large result sets.

Pagination

import { VertesiaClient } from '@vertesia/client';

const client = new VertesiaClient({
  site: 'api.vertesia.io',
  apikey: '<YOUR_API_KEY>',
});

let offset = 0;
const limit = 50;
let hasMore = true;

while (hasMore) {
  const response = await client.auditTrail.list({
    actions: ['delete'],
    limit,
    offset,
  });

  for (const event of response.events) {
    console.log(`${event.timestamp} - ${event.action} ${event.resource_type}/${event.resource_id}`);
  }

  hasMore = response.hasNext;
  offset += limit;
}

Was this page helpful?