Skip to main content

Sync Qoder enterprise audit logs to a SIEM or internal security platform

Qoder enterprise audit logs record key operations within an organization, providing traceable data for security investigations, compliance audits, and external log integration. This document describes the audit event data model and the current method for continuously retrieving new events through OpenAPI. Retrieved events can be synchronized to a SIEM, data lake, or other internal security platform.

1. Log retrieval

Audit logs use a pull model: a customer-side synchronization program periodically calls Qoder OpenAPI to retrieve a batch of events and save the cursor. The next pull continues from that cursor.
Qoder 审计事件 → Qoder OpenAPI → 客户同步程序 → 外部日志系统
This approach does not require Qoder to store the addresses or credentials of customers' external systems. Customers control the polling cadence, storage location, and retention policy.

2. Prerequisites

Using the audit log OpenAPI requires the following:
  1. The organization's plan includes the enterprise.audit capability;
  2. A valid API Key associated with the target organization is used;
  3. The API Key is passed in the request as a Bearer Token:
Authorization: Bearer <API_KEY>
Store API Keys as sensitive credentials. Do not write them to code repositories, logs, or client applications. Use a separate API Key for log synchronization and rotate it regularly according to your organization's credential management policy.

3. Audit event model

Each event has a stable event_id and records the event type, occurrence time, actor, resource, and execution result.
{
  "event_id": "01a11917-2bc6-72b3-8ab2-ce88bcaddd25",
  "event_type": "MemberLogin",
  "event_category": "Member",
  "severity": "info",
  "created_at": "2026-10-08T01:18:31.118Z",
  "actor": {
    "actor_id": "user_xxx",
    "actor_type": "User",
    "ip_address": "192.0.2.10",
    "user_agent": "Mozilla/5.0 ..."
  },
  "resource": {
    "resource_type": "member",
    "resource_id": "user_xxx"
  },
  "action": {
    "type": "login",
    "status": "success"
  },
  "context": {
    "request_id": "req_xxx"
  },
  "metadata": {}
}

3.1 Top-level fields

FieldTypeDescription
event_idstringStable unique identifier for the event. Use this field for idempotent deduplication when synchronizing downstream
event_typestringSpecific event type, such as MemberLogin
event_categorystringEvent category, such as Member
severitystringEvent severity, such as info, warning, or critical
created_atstringEvent occurrence time, in RFC3339 format and UTC
actorobjectUser or system principal initiating the operation
resourceobjectResource being operated on; may be absent in some events
actionobjectOperation type, execution status, and optional duration
contextobjectRequest, client, and other context; fields vary by event type
changesobjectInformation before and after a change; present only in some change events
metadataobjectExtended information specific to the event type

3.2 Actor fields

FieldTypeDescription
actor_idstringActor identifier
actor_typestringActor type
display_namestringDisplay name; may be empty
emailstringEmail address; may be empty
ip_addressstringSource IP address; may be empty
user_agentstringClient User-Agent; may be empty
session_idstringSession identifier; may be empty
Audit events may contain email addresses, IP addresses, and client information. Integrators should configure access controls, retention periods, and data masking policies according to applicable regulations and organizational policies.

4. Continuously pulling audit events

The continuous pull endpoint is intended for external systems that need incremental audit log synchronization, including SIEMs, data lakes, and security operations platforms.
GET /v1/organizations/{organization_id}/audit/compliance/events

4.1 Query parameters

ParameterRequiredDescription
startTimeRequired for the initial pullSynchronization start time in RFC3339 format. Ignored when nextToken is provided
nextTokenRequired for subsequent pullsOpaque cursor returned by the previous response; must be passed back unchanged
maxResultsNoNumber of events per page; defaults to 100, maximum 1000
eventTypeNoEvent type filter; supports comma-separated exact values or a trailing wildcard such as ai.*
eventCategoryNoEvent category filter; supports multiple comma-separated values
startTime provides only a lower time bound. The endpoint continuously pulls from that time through the latest events, without a fixed end time. The accessible historical range is subject to the organization's actual data retention policy.

4.2 Initial pull

curl -sS \
  -H "Authorization: Bearer ${QODER_API_KEY}" \
  -H "Accept: application/json" \
  "${QODER_OPENAPI_ENDPOINT}/v1/organizations/${ORGANIZATION_ID}/audit/compliance/events?startTime=2026-10-01T00:00:00Z&maxResults=1000"
Example response:
{
  "events": [
    {
      "event_id": "01a11917-2bc6-72b3-8ab2-ce88bcaddd25",
      "event_type": "MemberLogin",
      "event_category": "Member",
      "severity": "info",
      "created_at": "2026-10-08T01:18:31.118Z",
      "actor": {
        "actor_id": "user_xxx",
        "actor_type": "User"
      },
      "resource": {
        "resource_type": "member",
        "resource_id": "user_xxx"
      },
      "action": {
        "type": "login",
        "status": "success"
      }
    }
  ],
  "nextToken": "djE6MjUwMDoxNzc0OTIyNDAwMDAw",
  "hasMore": true,
  "returnedCount": 1
}
Response fieldDescription
eventsEvents in this batch, returned in ingestion order
nextTokenCursor for the next pull; returned even when there are no new events
hasMoretrue indicates a remaining backlog and requires an immediate next pull; false indicates that the consumer is currently caught up
returnedCountActual number of events returned in this batch

4.3 Subsequent pulls

Pass back the nextToken from the previous response unchanged:
curl -sS \
  -H "Authorization: Bearer ${QODER_API_KEY}" \
  -H "Accept: application/json" \
  "${QODER_OPENAPI_ENDPOINT}/v1/organizations/${ORGANIZATION_ID}/audit/compliance/events?nextToken=${NEXT_TOKEN}&maxResults=1000"
Do not parse, modify, or construct nextToken yourself. The cursor format is a server-side implementation detail and may evolve between versions.

5. Continuous synchronization workflow

Use a single worker to pull the event stream for the same organization sequentially:
token = load_checkpoint()

loop:
    if token is empty:
        response = pull(startTime=sync_start, maxResults=1000)
    else:
        response = pull(nextToken=token, maxResults=1000)

    write_idempotently(response.events, key=event_id)
    persist_checkpoint(response.nextToken)

    if response.hasMore:
        continue
    sleep_with_backoff()
The synchronization program should follow this order:
  1. Successfully write the entire batch of events downstream;
  2. Persist the nextToken returned with this batch;
  3. If writing or cursor persistence fails, retry with the old cursor;
  4. Always deduplicate downstream idempotently by event_id.
This prevents event loss caused by advancing the cursor before a failed write. Retries may cause duplicate delivery, so integrators must implement deduplication.

5.1 Ordering semantics

Events are returned in ingestion order, with no guarantee of strict ordering by created_at. Late-arriving or backfilled events may appear later in the event stream. Integrators should:
  • Deduplicate by event_id;
  • Use created_at for business-time analysis;
  • Avoid using time gaps between adjacent events to determine whether events are missing;
  • Allow for some late-arriving events in alerting and statistics tasks.

5.2 Filters

If the initial pull uses eventType or eventCategory, subsequent requests must retain the same filters. The server does not save filter sessions or check whether filters have changed. Changing filters midstream may skip events that the cursor has already passed. Use separate synchronization tasks and separate nextToken values for different filters.

5.3 Polling and backoff

  • hasMore=true: request the next batch immediately;
  • hasMore=false: wait before polling again with the returned nextToken;
  • Consecutive empty batches: gradually increase the interval, preferably to no more than 10 minutes;
  • New events retrieved: return to a shorter polling interval;
  • HTTP 429: wait according to the Retry-After response header and retry with the same cursor;
  • Network errors or 5xx: retry with exponential backoff without advancing the cursor.

6. Error handling

HTTP status codeMeaningRecommended handling
400Invalid parameters, missing startTime on the initial pull, or an invalid cursorCorrect the parameters; if the cursor is invalid, restart with an explicit startTime and deduplicate by event_id
401Missing or invalid API KeyCheck the Authorization header and credential status
403The API Key cannot access the organization, or the organization's plan does not include auditingCheck the organization associated with the key and the enterprise.audit capability
404Organization, route, or resource does not existCheck the organization ID, request path, and environment configuration
429The request triggered rate limiting or concurrency protectionWait according to Retry-After, then retry the same request
503The audit query service is temporarily unavailableRetry with exponential backoff; contact Qoder support if failures persist
Rate limits may vary by environment and organization configuration. Clients should not rely on fixed quotas and should always implement backoff for 429 responses.