Decision history
GET /v1/decisions lists decision rows. GET /v1/decisions/{request_id} reads one. Both use the same agent key as POST /v1/decide. The key only sees rows for its own customer and its own environment: a test key sees only test rows. A row for another customer, another organization, or the other environment is the same answer as a missing id: 404 not_found.
A 429 concurrency_limited on POST /v1/decide can appear here as one row with reason concurrency_limited, decision deny, an empty tool, and remaining and limit of 0. That row is an audit record, not usage: it doesn’t move the plan counter or the monthly test counter, and usage charts and deny totals leave it out. Each server keeps at most one such row per key per second. The 429 concurrency_limited on this history route doesn’t write a row.
A successful answer is HTTP 200. It does not change a counter and it does not write a decision. Errors use the error envelope.
Authentication
Section titled “Authentication”Send the agent key as a Bearer token:
Authorization: Bearer ord_test_…A missing key is 401 missing_key. A key we don’t recognize is 401 unknown_key. A key that starts with sk_test_ or sk_live_ is 401 old_key_format. Only the exact old shape (sk_test_ or sk_live_ followed by exactly 32 letters, digits, - or _) does not count toward the failed-auth limit below. Any other key that merely starts with sk_test_ or sk_live_ still returns 401 old_key_format and does count toward that per-address limit. GET /v1/decisions uses its own per-address budget, the same rule Errors describes. An admin key (ord_admin_…) is 401 admin_key_not_for_decide, before any database lookup, and it does not count toward that limit either. A revoked key is 401 revoked_key. A key on hold is 403 key_on_hold, the same body as decide. Every other key check answers with the same code and message as decide. A key that authenticates is not refused by the failed-auth limit.
{ "decisions": [ { "request_id": "req_TZWx7iYiHQ4l6vZX", "created_at": "2026-10-29T20:15:01.123456Z", "decision": "deny", "reason": "quota_exceeded", "tool": "research.run", "environment": "test", "remaining": 0, "limit": 5, "resets_at": "2026-11-01T00:00:00.000Z", "mode": "enforce", "plan_policy_version": 1 } ], "next_cursor": null}created_at is UTC, with microseconds. resets_at is the allowance period end. plan_policy_version is the plan’s policy version when the row was written, or null for a row written before that version was stored. environment is test or live, and it is the environment of the row, which is also the environment of the key that can read it.
next_cursor is null when this page is the last one. Otherwise it is an opaque string. Send it back as cursor. Do not build or edit a cursor yourself.
Filters
Section titled “Filters”All optional. Send each one at most once.
| Query | Meaning |
|---|---|
decision |
allow or deny |
reason |
A reason code, such as quota_exceeded or ok |
tool |
The tool name on the row, 1 to 200 characters |
limit |
How many rows in this page: a whole number from 1 to 100. Default 50. 1e2, 01, and any other form are rejected |
cursor |
The next_cursor from the previous page |
Rows are newest first: (created_at, id). Two rows with the same created_at are ordered by an internal id, so a page doesn’t skip or repeat a row. Pages stay inside the organization’s current audit retention: older rows are not listed.
A would-deny is a row with decision: deny and mode: shadow. There is no mode filter: send decision=deny and check each row’s mode. Unknown query parameters are ignored, so ?mode=shadow returns every row.
A filter with a NUL, any other control character, or bytes that are not UTF-8 is 400 invalid_request. The same code is used for a bad decision, a bad limit, a cursor you did not get from us, or a parameter sent twice (?limit=1&limit=2). A missing or bad key is still 401 (or 429 once the failed-auth limit is reached), even when the query string would have been a 400.
Get one
Section titled “Get one”The body is one decision object, the same fields as a list item, with no decisions array. 404 not_found when that id is missing, belongs to another customer or organization, or was written in the other environment. Those three answers match a missing id: same status, same error.code, same error.message.
Limits
Section titled “Limits”Each limit is counted in memory on the server that received the request, and each is separate from the limits on POST /v1/decide. A valid key is not refused by the failed-auth limit.
| Code | HTTP | When |
|---|---|---|
rate_limited |
429 | This key is over about 20 history reads a second (limit_scope per_key). Wait Retry-After |
concurrency_limited |
429 | This key already has 2 history reads in flight (limit_scope per_key_concurrency). There is no queue. Retry after 1 second, with fewer at once |
too_many_failed_auth |
429 | This address sent more than 30 requests a minute with a missing, bad, or revoked key (limit_scope per_address) |
db_timeout |
503 | The read did not finish within 1 second, so it was cancelled. Retry |
These are the limits on our hosted service: about 20 reads a second and 2 reads in flight per key, 30 failed-key requests a minute per address, and 1 second per read.
curl -sS "https://api.ordainer.dev/v1/decisions?decision=deny&reason=quota_exceeded&tool=research.run&limit=50" \ -H "Authorization: Bearer $ORDAINER_KEY"The next page, using the cursor from the previous body unchanged:
curl -sS "https://api.ordainer.dev/v1/decisions?cursor=PASTE_NEXT_CURSOR" \ -H "Authorization: Bearer $ORDAINER_KEY"One row:
curl -sS "https://api.ordainer.dev/v1/decisions/req_TZWx7iYiHQ4l6vZX" \ -H "Authorization: Bearer $ORDAINER_KEY"const url = new URL('https://api.ordainer.dev/v1/decisions');url.searchParams.set('decision', 'deny');url.searchParams.set('limit', '50');const res = await fetch(url, { headers: { Authorization: 'Bearer ' + process.env.ORDAINER_KEY } });const body = await res.json();if (!res.ok) throw new Error(body.error.code);for (const row of body.decisions) console.log(row.request_id, row.decision, row.reason, row.tool, row.environment);if (body.next_cursor) { url.searchParams.set('cursor', body.next_cursor); // fetch the next page the same way}