Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kaireonai.com/llms.txt

Use this file to discover all available pages before exploring further.

GET /api/v1/audit-logs

Query audit log entries. Admin only. Logs are immutable — no DELETE, PUT, or PATCH operations are permitted.

Query Parameters

ParameterTypeDefaultDescription
entityTypestringFilter by entity type (e.g., "connector", "offer", "decision_flow", "category", "sub_category", "channel", "creative", "outcome_type")
pageinteger1Page number
limitinteger50Results per page (max 100)

Response

{
  "logs": [
    {
      "id": "log_001",
      "action": "create",
      "entityType": "offer",
      "entityId": "offer_001",
      "entityName": "Platinum Card",
      "changes": {},
      "before": null,
      "after": {
        "id": "offer_001",
        "name": "Platinum Card",
        "status": "draft",
        "priority": 75,
        "version": 1
      },
      "entityVersion": 1,
      "userId": "user_001",
      "userName": "John Doe",
      "tenantId": "tenant_001",
      "requestId": "req_abc123",
      "integrityHash": "a1b2c3d4e5f6...",
      "prevHash": "x9y8z7w6v5u4...",
      "timestamp": "2026-03-16T14:30:00.000Z"
    }
  ],
  "total": 5420,
  "page": 1,
  "limit": 50
}

Audit log fields

FieldTypeDescription
actionstringOne of create, update, soft_delete, restore, delete, mandatory_override.
entityTypestringThe entity type (e.g., offer, category, channel, creative, sub_category, outcome_type, decision_flow, qualification_rule, contact_policy, placement, trigger_rule, guardrail_rule, arbitration_profile, summary_definition, flow_route).
entityIdstringThe ID of the affected entity.
entityNamestringThe name of the entity at the time of the action.
beforeobject | nullFull entity snapshot before the change. null for create actions.
afterobject | nullFull entity snapshot after the change.
entityVersioninteger | nullThe entity’s version at the time of the action.
changesobjectAdditional metadata (e.g., cascade reason for soft-delete).
integrityHashstringSHA-256 hash of the log entry for tamper detection.
prevHashstring | nullThe integrityHash of the previous log entry, forming the integrity chain.
Audit logs are append-only. DELETE, PUT, and PATCH requests return 405 Method Not Allowed with a clear message that audit logs are immutable.

Cascade audit entries

When a parent entity is soft-deleted with cascade (e.g., deleting a category cascades to sub-categories and offers), a separate audit log entry is created for each cascaded child. These entries include a changes.reason field indicating the cascade source:
{
  "action": "soft_delete",
  "entityType": "sub_category",
  "entityId": "sub_01",
  "changes": { "reason": "Cascade from category cat_01" },
  "entityVersion": 2
}

GET /api/v1/audit-logs/verify

Verify the integrity of the audit log chain using SHA-256 hash verification. Admin only.

Query Parameters

ParameterTypeDescription
limitintegerOnly verify the last N entries (quick check mode). Omit to verify entire chain

Response

{
  "intact": true,
  "verified": 5420,
  "total": 5420,
  "scanned": 5420
}

Broken Chain Response

{
  "intact": false,
  "verified": 3210,
  "total": 5420,
  "scanned": 5420,
  "brokenAtId": "log_3211",
  "brokenReason": "hash_mismatch"
}

Broken Reasons

ReasonDescription
hash_mismatchRecomputed SHA-256 hash does not match the stored hash
chain_link_mismatchEntry’s prevHash does not match the previous entry’s integrityHash

GET /api/v1/audit-export

Export audit logs for SOC 2 compliance. Supports JSON, CSV, and SOC 2 formatted output. Rate limited to 10 requests per 60 seconds. Admin only.

Query Parameters

ParameterTypeDefaultDescription
formatstring"json"Output format: "json", "csv", "soc2"
startDatestringISO date string for range start
endDatestringISO date string for range end
entityTypestringFilter by entity type
actionstringFilter by action ("create", "update", "delete")
limitinteger10000Max records (max 10000)
offsetinteger0Pagination offset

Example

curl "https://playground.kaireonai.com/api/v1/audit-export?format=csv&startDate=2026-03-01&endDate=2026-03-16" \
  -H "X-Tenant-Id: my-tenant" \
  -H "Authorization: Bearer sk_live_abc123" \
  -o audit-export.csv
CSV exports are returned as downloadable files with Content-Disposition: attachment.

POST /api/v1/audit-export

Verify audit integrity chain via the export endpoint.

Request Body

FieldTypeRequiredDescription
actionstringYesMust be "verify_integrity"
startDatestringNoISO start date for range verification
endDatestringNoISO end date for range verification

Roles

EndpointAllowed Roles
GET /audit-logsadmin
GET /audit-logs/verifyadmin
GET /audit-exportadmin
POST /audit-exportadmin
See also: Compliance | Operations Dashboard