Audit events: API examples

Contract-derived requests, potential responses and API links for audit events.

Generated from the public OpenAPI. Examples illustrate the contract and are not live results. Use your assigned gateway, credentials and identifiers. The snippets do not execute automatically.

Use Node.js 22 or later. Copy the setup below into an .mjs file, set QFP_BASE_URL and QFP_ACCESS_TOKEN, then append the operation snippet you need. No repository checkout or downloaded client is required. Keep secrets in your backend and persist each write key and body before sending.

Request setup

const required = name => {
  const value = process.env[name];
  if (!value) throw new Error(`Set ${name} before running this example`);
  return value;
};
const baseUrl = required('QFP_BASE_URL').replace(/\/$/, '');
if (!/^https:\/\//.test(baseUrl)) throw new Error('Use your assigned HTTPS gateway');
const token = required('QFP_ACCESS_TOKEN');
const segment = value => encodeURIComponent(value);
async function request(method, path, body, key) {
  const headers = { Authorization: `Bearer ${token}`, 'API-Version': '1.0.0', Accept: 'application/json' };
  if (key) headers['Idempotency-Key'] = key;
  const multipart = body instanceof FormData;
  if (body !== undefined && !multipart) headers['Content-Type'] = 'application/json';
  const response = await fetch(baseUrl + path, {
    method, headers, body: body === undefined ? undefined : multipart ? body : JSON.stringify(body),
    signal: AbortSignal.timeout(30_000), redirect: 'error',
  });
  const text = await response.text();
  const data = text && response.headers.get('content-type')?.includes('json') ? JSON.parse(text) : text || null;
  if (!response.ok) {
    const error = new Error(`HTTP ${response.status}`);
    Object.assign(error, { status: response.status, data, headers: response.headers });
    throw error;
  }
  return { status: response.status, data };
}

search

List audit events. API Reference · Integration guide

GET /api/audit/events

ParameterLocationRequired
API-VersionheaderYes
occurredFromqueryNo
occurredToqueryNo
actorIdsqueryNo
requestIdqueryNo
actionqueryNo
sourcequeryNo
resourceTypequeryNo
resourceIdqueryNo
queryqueryNo
pagequeryNo
sizequeryNo
sortqueryNo
const body = undefined;
const result = await request('GET', '/api/audit/events', body, undefined);
console.log(result.status, result.data);

Replace angle-bracket placeholders before calling. Persist any idempotency key with the business instruction.

Potential responses

Documented statuses: 200, 400, 401.

Example 200 (firstPage); see the reference for other outcomes.

{
  "data": [
    {
      "eventId": "6f1e9c73-2b84-4a1d-9e57-0c3d8b25f4a1",
      "action": "UPDATE",
      "category": "DATA_CHANGE",
      "occurredAt": "2026-08-25T09:15:42.000Z",
      "source": "billing-service",
      "actor": {
        "type": "USER",
        "id": "e47864d8-e0b1-70a7-59e9-50a309c66adb",
        "displayName": "Alice Whitfield"
      },
      "resource": {
        "type": "invoice",
        "id": "inv_01"
      },
      "requestId": "req-5f0c-0005",
      "outcome": null,
      "summary": "UPDATE invoice inv_01",
      "changedFields": [
        "dueDate",
        "iban"
      ]
    },
    {
      "eventId": "b83d2f10-6c49-4f2a-8d15-7ae90b6c3d22",
      "action": "LOGIN_FAILED",
      "category": "SECURITY",
      "occurredAt": "2026-08-25T08:02:11.000Z",
      "source": "identity-service",
      "actor": {
        "type": "USER",
        "id": null,
        "displayName": null
      },
      "resource": {
        "type": "session",
        "id": null
      },
      "requestId": "req-5f0c-0004",
      "outcome": "FAILURE",
      "summary": "LOGIN_FAILED session",
      "changedFields": []
    }
  ],
  "page": 0,
  "size": 20,
  "totalItems": 62,
  "totalPages": 4
}

For CSV/download endpoints, the response may be text rather than JSON. The request helper preserves that distinction.

export

Export the filtered audit events as CSV. API Reference · Integration guide

GET /api/audit/events/export

ParameterLocationRequired
API-VersionheaderYes
occurredFromqueryNo
occurredToqueryNo
actorIdsqueryNo
requestIdqueryNo
actionqueryNo
sourcequeryNo
resourceTypequeryNo
resourceIdqueryNo
queryqueryNo
const body = undefined;
const result = await request('GET', '/api/audit/events/export', body, undefined);
console.log(result.status, result.data);

Replace angle-bracket placeholders before calling. Persist any idempotency key with the business instruction.

Potential responses

Documented statuses: 200, 400, 401.

For CSV/download endpoints, the response may be text rather than JSON. The request helper preserves that distinction.

getById

Read one audit event in full. API Reference · Integration guide

GET /api/audit/events/{eventId}

ParameterLocationRequired
API-VersionheaderYes
eventIdpathYes
const body = undefined;
const result = await request('GET', '/api/audit/events/' + encodeURIComponent('<eventId>') + '', body, undefined);
console.log(result.status, result.data);

Replace angle-bracket placeholders before calling. Persist any idempotency key with the business instruction.

Potential responses

Documented statuses: 200, 400, 401, 404.

Example 200 (dataChangeWithMaskedField); see the reference for other outcomes.

{
  "eventId": "6f1e9c73-2b84-4a1d-9e57-0c3d8b25f4a1",
  "action": "UPDATE",
  "category": "DATA_CHANGE",
  "occurredAt": "2026-08-25T09:15:42.000Z",
  "createdAt": "2026-08-25T09:15:43.118Z",
  "recordedAt": null,
  "source": "billing-service",
  "actor": {
    "type": "USER",
    "id": "e47864d8-e0b1-70a7-59e9-50a309c66adb",
    "displayName": "Alice Whitfield"
  },
  "resource": {
    "type": "invoice",
    "id": "inv_01"
  },
  "requestId": "req-5f0c-0005",
  "outcome": null,
  "summary": "UPDATE invoice inv_01",
  "changes": [
    {
      "field": "dueDate",
      "before": "2026-09-01",
      "after": "2026-09-15",
      "masked": false
    },
    {
      "field": "iban",
      "before": "***",
      "after": "***",
      "masked": true
    }
  ],
  "data": {
    "reason": "customer requested a later due date"
  }
}

For CSV/download endpoints, the response may be text rather than JSON. The request helper preserves that distinction.


Did this page help you?