operator-audit API
The operator audit event, its read API, and the gateway’s writes. Concept: audit.
{ "id": "01ja2z6q3y8d5v2k9n4r7t1w0x", "occurred_at": "2026-10-09T18:30:00.123Z", "request_id": "9f2c4e1a7b3d4c8e9a0b1c2d3e4f5a6b", "actor": { "issuer": "https://example.okta.com/oauth2/default", "operator_id": "00u1abc", "client_id": "operator-console" }, "acting_as": { "member_id": "01j9zx6n…", "type": "user" }, "reason": "ZD-4821", "root_id": "01j9zx4k7m2p5q8r1s3t6v9w0y", "nodes": [ { "kind": "organization", "id": "01j9zx4k…" }, { "kind": "project", "id": "01j9zx5a…" } ], "service": "e10s", "method": "POST", "route": "/projects/{project_id}/plans/{plan_id}/versions", "params": { "project_id": "01j9zx5a…", "plan_id": "pro" }, "path": null, "ip": "10.0.4.17", "user_agent": "Mozilla/5.0 …", "outcome": "responded", "status": 201, "response_bytes": 312, "details": { "version": 7 }, "created_id": "ver_01ja2z6r…"}| Field | |
|---|---|
id |
Lowercase ULID, assigned by operator-audit when the intent is written |
occurred_at |
When the gateway received the request. UTC, milliseconds |
request_id |
X-Request-ID, generated by the gateway. Joins to every service log line |
actor |
The operator (reference/idp.md) |
acting_as |
{ member_id, type } on an X-Plat5-As-Member request whose member passed the check (type is user or service_account). null otherwise |
reason |
From X-Plat5-Operator-Reason (up to 256 characters), or null when absent |
root_id |
nodes[0].id, or null when nodes is [] |
nodes |
The route node’s chain, root first, as { kind, id }. [] when the route has no node, no template matched, or the chain wasn’t found |
service |
The target service’s name. null when the request didn’t address a known service |
method |
HTTP method |
route |
The matched route template. null when no route template matched |
params |
Path params by name, as matched. {} when there are none, or no template matched. Bytes Postgres can’t store (invalid UTF-8, NUL) are recorded as U+FFFD |
path |
The raw path (the upstream path for an unlisted path on a known service, or the raw request path otherwise), escaped as received, cut to 2048 characters. Set only when route is null; otherwise null |
ip |
Client IP (reference/gateway.md) |
user_agent |
User-Agent, cut to 512 characters. null when absent |
outcome |
pending, rejected, responded, no_response (below) |
status |
The status the gateway answered with. null while pending, or when the client was gone before an answer |
response_bytes |
Response body bytes written to the client. null while pending |
details |
From X-Plat5-Audit-Details (on responded), { "policy_reason": "…" } (on AuthZEN rejected), or null |
created_id |
From X-Plat5-Audit-Created (on responded), or null |
outcome |
Means | The change |
|---|---|---|
pending |
Intent recorded, no outcome | Unknown |
rejected |
The gateway answered without calling the service (including 403 AuthZEN denials) | Didn’t happen |
responded |
The service answered. status is its status |
Per status |
no_response |
The gateway called the service and got no answer (502) | Unknown |
Not in an event: request or response bodies, the query string, headers other than User-Agent and X-Plat5-Operator-Reason, the token, claims other than the actor fields, or any customer credential.
Reading
Section titled “Reading”GET /operator-audit-eventsOn operator-audit’s public port, reached through the gateway at GET /services/operator-audit/operator-audit-events, so each read is itself an event.
| Query | |
|---|---|
limit, starting_after |
As Plat5’s lists (Plat5 docs/reference/lists.md): default 50, max 100, over-max clamped; starting_after is the last id of the previous page, a lowercase ULID |
operator_id |
The acting operator |
acting_as_member_id |
The member acted as |
reason |
Exact match on reason |
node_id |
Events on this node or below it: any event whose nodes contains it |
service, method, outcome, request_id, created_id |
Exact match |
status |
HTTP status code (integer 100–599) |
route |
Exact template, e.g. /nodes/{node_id}/bindings |
params[<name>] |
A path param’s value, e.g. params[member_id]=01j9zx6n…. One per name; several names AND |
occurred_after, occurred_before |
RFC 3339. After is inclusive, before is exclusive |
Filters AND. An unknown query param, a repeated one, or a malformed value → 422 VALIDATION_ERROR.
{ "audit_events": [ ... ], "has_more": false }Ordered by id, newest first, as Plat5’s audit reads are. starting_after continues the walk to older events.
Internal API
Section titled “Internal API”On operator-audit’s INTERNAL_PORT, not routed through the gateway. It takes no token: the internal port is reachable only inside the deployment’s network, never exposed outside it, as Plat5’s internal ports are. The gateway is its only caller.
Intent
Section titled “Intent”PUT /internal/events/{request_id}
{ "occurred_at": "…", "actor": { "issuer": "…", "operator_id": "…", "email": "…", "client_id": "…" }, "acting_as": null, "reason": "ZD-4821", "root_id": "…", "nodes": [ { "kind": "…", "id": "…" } ], "service": "…", "method": "…", "route": "…", "params": { … }, "path": null, "ip": "…", "user_agent": "…"}| Result | Response |
|---|---|
| Written | 201 |
An event for this request_id exists |
200, unchanged |
| Malformed | 422. See below |
| Postgres unavailable | 503. The gateway retries |
Malformed includes: occurred_at more than 24 hours from operator-audit’s clock; route and path both set or both null; route set without service; root_id other than nodes[0].id, or set with nodes empty; nodes or acting_as without a route; acting_as with nodes empty; more than 32 nodes; reason empty or over 256 characters. A retry sends the same body. Unknown fields are ignored, so a newer gateway can send more.
Single-write finalized events. For requests that end immediately before forwarding (for example, pre-forward rejections), PUT /internal/events/{request_id} may also carry a final outcome (rejected, responded, or no_response) together with status, response_bytes (defaults to 0 if omitted), details, and created_id. operator-audit writes the finalized event atomically in one transaction and assigns its export seq; no follow-up PATCH is needed. When outcome is omitted or "pending", status, response_bytes, details, and created_id must be omitted or null (otherwise 422). Final outcome field rules match Outcome below.
Outcome
Section titled “Outcome”PATCH /internal/events/{request_id}
{ "occurred_at": "…", "outcome": "responded", "status": 201, "response_bytes": 312, "details": { … }, "created_id": "…" }| Result | Response |
|---|---|
| Applied, or the event is already final | 204. A final event is left unchanged |
No event for this request_id |
404. The gateway stops retrying |
Malformed, or outcome: pending |
422 |
| Postgres unavailable | 503. The gateway retries |
occurred_at is optional; when sent (echoing the intent’s timestamp), operator-audit prunes the update to that partition. status may be null only when the client was gone before an answer, so never with responded. details may be set on responded or rejected; created_id may be set only with responded. response_bytes is a non-negative integer.
Export
Section titled “Export”Deployment-wide long-polled cursor feed of finalized operator audit events in strictly monotonic commit order, for external SIEM shipping and WORM archival (GET /internal/events). Follows the same long-poll contract as Plat5’s audit export feed (non-5xx polls stay off request logs).
GET /internal/events?after=6&limit=100→ 200{ "audit_events": [ { "seq": "7", "id": "01ja2z6q…", "occurred_at": "…", "request_id": "…", "outcome": "responded", ... } ], "has_more": false}| Param | |
|---|---|
after |
Optional. Last seq cursor read (positive decimal integer, no leading zero); omitted starts from the beginning. Malformed → 422 |
limit |
Optional. Default 100, max 1000 (over-max clamped). Below 1 or non-integer → 422 |
- Only finalized events (
responded,rejected,no_response) are exported, ordered by finalizationseq. - Each item carries all fields of the event plus
"seq"(decimal string). A 200 always has at least one event; use the last item’sseqas the nextafter. - When nothing newer has finalized past
after, the server waits up to 25 seconds for a new event and answers 204 No Content if none arrives; poll again with the sameafter. - An
afterpast the sequence head (e.g., database reset/recreate) answers 409CURSOR_AHEAD(details: null). Partition pruning does not reset the sequence head. - Unknown or repeated query params → 422. Postgres unavailable → 503.