Skip to content

Admin API

The admin API sets up customers, plans, and test keys from code, for the integrations and AI agents that call POST /v1/decide with an agent key. It is in beta. It creates test keys only. Set up 10 customers with the admin API is the end-to-end walkthrough, including steps that need the Ordainer team. The Node SDK 1.3.0 (OrdainerAdmin) and the Python package 0.3.0 (OrdainerAdmin / AsyncOrdainerAdmin) call these routes; see the Node and Python quickstarts. You can also call them over plain HTTP, as on this page.

Every path below is under /v1/admin. Examples call this base URL:

https://api.ordainer.dev

Set the admin key in the environment and do not print it. The examples read $ORDAINER_ADMIN_KEY.

Terminal window
export ORDAINER_ADMIN_KEY="ord_admin_…"

On Windows? use the PowerShell tab.

The admin API is on for every account during the beta, so you don’t need to ask us to turn it on. If /v1/admin/ calls start returning 404, we’ve switched it off for a while on our side. Email support@ordainer.ai with the request_id and we’ll tell you when it’s back.

These routes are registered only when the service has the admin API turned on. The switch is the exact string true on the server. 1, TRUE, yes, and a value with a space are off. A vendor cannot flip that switch from the console or from this API.

With it off, none of the paths on this page are routes. Each one returns 404 not_found, the same answer as any unknown path, for example No route for POST /v1/admin/customers. The console Keys page has no Admin keys section. /v1/decide is unchanged.

Every admin response, including errors, sends Cache-Control: no-store, Content-Type: application/json; charset=utf-8, and X-Request-Id. The header matches error.request_id on an error. There is no CORS. OPTIONS is 405 method_not_allowed. Call it from your server.

Send an admin key:

Authorization: Bearer ord_admin_…

The word Bearer is not case-sensitive. The token is one string with no spaces.

An admin key is ord_admin_ followed by 43 letters, digits, - or _ (32 random bytes, base64url, no padding). It is not an agent key. An agent key is ord_test_ or ord_live_ followed by 32 of those characters.

  • We show the secret once, on the console page that created it, and store only a SHA-256 hash. It is not in the change log. A lost admin key cannot be recovered: create a new one.
  • It expires 90 days after creation. 401 expired_key after that. Create a new one in the console.
  • Revoke in the console takes effect on the next call: 401 revoked_key.
  • Rotate in the console issues a new secret with the same label and scopes, and a new 90-day expiry. Overlap is a whole number of hours from 0 to 24. The default is 0, and the old key stops immediately. From 1 to 24, the old key keeps working until that time, then returns 401 revoked_key (the message says the overlap has ended). A revoked, expired, or already-rotated admin key cannot be rotated. Rotating one that was already rotated is 409 conflict on the console form.
  • Only the account owner can create, revoke, or rotate an admin key. Today the account has one owner. See Signing in.
  • There is no /v1/admin route that creates, lists, rotates, or revokes admin keys.

Console → Keys, at the bottom, under Admin keys. The form is a label (1 to 100 characters) and one checkbox per scope. The boxes start checked. Create admin key shows the secret once. Copy it then. The same table has Revoke and Rotate. The rotate row has an overlap-hours field; leave it at 0 unless you want the old key to keep working for a few hours.

If that section is missing, we’ve switched the admin API off for a while on our side. Email support@ordainer.ai with the request_id and we’ll tell you when it’s back. See Ask us in the setup guide.

Scopes are exact. plans:write does not include plans:mode. keys:write does not include keys:revoke. A list route accepts any one of the scopes in its row.

Scope What it allows
customers:write Create a customer, update cap_alert_emails, and read customers. Delete a customer also needs keys:revoke.
plans:write Create a plan, update its name, tool, and cap, and read plans. It can set mode on create. It cannot switch mode later.
plans:mode Switch a plan between shadow and enforce, and read plans.
keys:write Create a test key, set its rate, concurrency and session limit, move it, and read test keys. Rotating a test key also needs keys:revoke.
keys:revoke Revoke a test key, and read test keys. Delete a customer also needs customers:write. Rotating a test key also needs keys:write.
usage:read Read customers, plans, test keys, test decisions, and the change log. It cannot write.

A missing scope is 403 missing_scope. The message names the scope, or the scopes joined with “or” when the route accepts more than one. Nothing is written.

An id is always checked against the caller’s organization. A missing id and another organization’s id are both 404 not_found. We do not say which.

An admin key on /v1/decide or /v1/config is 401 admin_key_not_for_decide, before any database work. Send the agent key those routes ask for. A well-formed agent key on an admin route is 403 agent_key_forbidden, before a database lookup.

GEThttps://api.ordainer.dev/v1/admin/me

Any valid admin key, with any scope. 200. It returns this admin key’s id, label, scopes, and expiry. It never returns the secret, its hash, or its prefix. Use it to check a key’s scopes before you send a write it would be refused for. Nothing is written to the change log.

Terminal window
curl -sS https://api.ordainer.dev/v1/admin/me \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY"

The ids and dates below are examples. The fields, and the 90-day expiry, are what a live call returns.

{"id":"1d5e6f80-5555-4555-8555-555555555555","label":"read-and-rotate","scopes":["keys:write","keys:revoke","usage:read"],"expires_at":"2027-02-21T14:00:00.000Z"}

A key made in the console lasts 90 days, so expires_at is 90 days after it was created.

Creates, patches, moves, rotates, and the mode switch require an Idempotency-Key header. Revoke and customer delete accept it and replay when you send it, and do not require it. GET ignores it.

Rule What happens
Length 1 to 255 characters. Empty, longer, or not a string is 400 invalid_idempotency_key.
Characters No control characters (U+0000–U+001F, U+007F) and no unpaired surrogates. The same rule applies to names, labels, and tools.
Missing on a required route 400 invalid_idempotency_key: This request needs an Idempotency-Key header (1-255 characters). A retry sends the same key.
Same key, same request The stored response comes back, with the original status, and idempotent-replayed: true. No second change-log row.
Same key, different request 409 idempotency_conflict. The original response is not returned. Send a new key.
A failed request (4xx or 5xx) Not stored. You can retry the same key after fixing the request.

The key is stored per organization, not per admin key and not per path. Two admin keys in the same organization share one set of keys. Reusing a key on a different path is a different request.

The request hash is the SHA-256 (hex) of the method, a space, the path, a newline, and a canonical form of the JSON body. Object keys are sorted. Extra whitespace and key order do not matter. The query string is not part of the hash. Arrays keep their order.

A replayed key create returns the same id and does not include secret. The secret is only in the first response. Lists never include it. Copy it from that first response.

We keep the stored success response for the life of the account. This is not the 24-hour window on POST /v1/decide. Decide idempotency and admin idempotency are different keys in different stores.

A refused live environment (below) writes a change-log row and returns 400. It does not store an idempotency response, so the same Idempotency-Key can be used again for a corrected body.

Counted on each server separately. Treat the threshold as approximate.

A burst of 60 admin writes per organization, refilling at about 1 per second. GET does not count. A write counts once the admin key has been accepted, including a body that then returns 400, and including an idempotent replay. Auth failures do not count toward this one.

Over it: 429 rate_limited, "limit_scope": "per_org", and Retry-After (whole seconds, at least 1). The message says the organization sent more than 60 admin writes in a minute, and names the wait. Nothing was written.

Failed admin keys: 10 a minute per address

Section titled “Failed admin keys: 10 a minute per address”

A burst of 10, then about one every 6 seconds. IPv4 is per address. IPv6 is per /64 block, the same grouping as the decide failed-key limit. Each missing, malformed, or unknown admin key uses one, and so does a well-formed agent key sent to an admin route.

Over it: 429 too_many_failed_auth, "limit_scope": "per_address", and Retry-After. The message is: We've had too many requests with a missing or unknown admin key from this IP address (per-address limit). Please fix the key. (too_many_failed_auth).

A valid admin key from an address that is already over this limit is also refused with that 429, before we look the key up. This is different from /v1/decide, where a valid agent key is not refused by the failed-key limit. An expired key, a revoked key, a key whose rotation overlap has ended, and a key that is simply missing a scope do not use up this allowance. We log one warning a minute while the limit is firing, with the request id and with no key and no address.

GET /v1/admin/customers, GET /v1/admin/plans, GET /v1/admin/keys, and GET /v1/admin/changes take limit and cursor.

Query Rule
limit Optional. Default 100. A whole number from 1 to 500. Anything else is 400 invalid_request: "limit" must be a whole number from 1 to 500.
cursor Optional. Opaque. Send back next_cursor from the previous page. Do not build it. A bad cursor is 400 invalid_request: That cursor is not valid. List again from the start.
next_cursor A string when another page exists. null on the last page.

Rows are ordered by id, ascending (oldest first), not by name. A hidden change-log row does not take a slot on the page.

GET /v1/admin/decisions pages differently: newest first, limit from 1 to 100 (default 50), and its own cursor. See that section.

A customer object:

Field Type Notes
id UUID
name string
external_id string or null Unique in your organization. null if you left it out.
cap_alert_emails boolean Default true on create.
created_at ISO 8601 timestamp

false stops the cap-alert job from emailing about that customer’s keys. It does not change decide().

POSThttps://api.ordainer.dev/v1/admin/customers

Scope customers:write. 201 and one customer.create row. Requires Idempotency-Key.

Field Required Rule
name Yes String, 1–200 characters after trimming.
external_id No String, 1–200 characters after trimming, or omit it.
cap_alert_emails No JSON boolean. Omitted means true.

Any other field is 400 invalid_request. A duplicate external_id in your organization is 409 conflict: You already have a customer with that ID.

Terminal window
curl -sS -X POST https://api.ordainer.dev/v1/admin/customers \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: cust-northwind-1" \
-d '{"name":"Northwind","external_id":"cust_42","cap_alert_emails":true}'
{"id":"6f1c2a40-1111-4111-8111-111111111111","name":"Northwind","external_id":"cust_42","cap_alert_emails":true,"created_at":"2026-11-05T14:00:00.000Z"}
GEThttps://api.ordainer.dev/v1/admin/customers

Scope customers:write or usage:read. 200. No idempotency key. The list includes customers created in the console.

Terminal window
curl -sS "https://api.ordainer.dev/v1/admin/customers?limit=100" \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY"
{"customers":[{"id":"6f1c2a40-1111-4111-8111-111111111111","name":"Northwind","external_id":"cust_42","cap_alert_emails":true,"created_at":"2026-11-05T14:00:00.000Z"}],"next_cursor":null}
GEThttps://api.ordainer.dev/v1/admin/customers/:id

Scope customers:write or usage:read. 200 and the customer object. An id that is not a UUID, or a customer in another organization, is 404 not_found: No such customer.

Terminal window
curl -sS https://api.ordainer.dev/v1/admin/customers/$CUSTOMER_ID \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY"
PATCHhttps://api.ordainer.dev/v1/admin/customers/:id

Scope customers:write. 200 and the customer object. Requires Idempotency-Key. The only accepted field is cap_alert_emails (a JSON boolean). Name and external_id cannot be changed here. Omitting the field is 400: Send cap_alert_emails to update.

A change writes customer.cap_alert_emails. Sending the value the customer already has does not write a second row. The response is still 200.

Terminal window
curl -sS -X PATCH https://api.ordainer.dev/v1/admin/customers/$CUSTOMER_ID \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: cust-cap-off-1" \
-d '{"cap_alert_emails":false}'
DELETEhttps://api.ordainer.dev/v1/admin/customers/:id

Scopes customers:write and keys:revoke. Both are required; keys:revoke is checked on its own. 200. Idempotency-Key is optional. When you send it, a retry returns the stored body and does not write a second row.

The customer row stays, with deleted_at set and external_id cleared, so that id can be used again. Every active test key is revoked in the same transaction, and its running session leases are released. A key that was already revoked is left as it is, gets no second change-log row, and is not in revoked_key_ids. A call already running finishes. The next call with one of those keys is 401 revoked_key. Decisions already recorded stay. The delete writes one key.revoke row for each key this call revoked, plus one customer.delete row.

The sandbox customer is 400, with the same sentence as the console: the sandbox customer stays, because the sandbox keys need it. An unknown id, another organization’s id, or a second delete of a customer that is already deleted is 404 not_found: No such customer. A customer that owns a live key is 404 with the live-key sentence, one key.live_refused row, and no revoke and no delete. A live key that is already revoked still blocks the delete. Name and external_id still cannot be changed here; use Console → Customers for those.

Terminal window
curl -sS -X DELETE https://api.ordainer.dev/v1/admin/customers/$CUSTOMER_ID \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Idempotency-Key: cust-delete-1"
{"id":"6f1c2a40-1111-4111-8111-111111111111","deleted":true,"revoked_key_ids":["8b3e4c60-3333-4333-8333-333333333333"]}

A plan object:

Field Type Notes
id UUID
name string
tool string One tool name, or * for every tool.
period "month", "day", or "minute" Set at create. Not changeable.
max_allows integer 0 to 1,000,000,000. Every allowed call counts as 1.
mode "shadow" or "enforce"
customer_id UUID or null null means the plan is shared by all of your customers.
changed boolean Only on the mode switch.

A month period resets at 00:00 UTC on the 1st. A day period resets at 00:00 UTC. A minute period resets at the start of the next UTC minute. resets_at on a decide answer is that boundary. A minute plan is an allowance for integrations and AI agents. It is not a new rate limit: the per-key limit of about 100 requests a second, each server counts separately, is unchanged. See Decide.

POSThttps://api.ordainer.dev/v1/admin/plans

Scope plans:write. 201 and one plan.create row. Requires Idempotency-Key.

Field Required Rule
name Yes String, 1–100 characters after trimming.
max_allows Yes A whole number from 0 to 1,000,000,000. A numeric string is accepted.
tool No String, 1–200 characters after trimming. Omitted or blank means *.
customer_id No A customer in this organization, or omit it for a shared plan. An unknown id is 404 not_found.
mode No "shadow" or "enforce". Omitted means shadow. plans:write may set the initial mode.
period No "month", "day", or "minute". Omitted means "month".
Terminal window
curl -sS -X POST https://api.ordainer.dev/v1/admin/plans \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: plan-pilot-1" \
-d '{"name":"pilot","max_allows":100,"tool":"research.run","customer_id":"'"$CUSTOMER_ID"'","mode":"shadow","period":"month"}'
{"id":"7a2d3b50-2222-4222-8222-222222222222","name":"pilot","tool":"research.run","period":"month","max_allows":100,"mode":"shadow","customer_id":"6f1c2a40-1111-4111-8111-111111111111"}
PATCHhttps://api.ordainer.dev/v1/admin/plans/:id

Scope plans:write. 200 and the plan object. Requires Idempotency-Key. Send one or more of name, tool, and max_allows, using the same rules as create.

Sending mode is 400: Switching shadow and enforce uses POST /v1/admin/plans/:id/mode and the plans:mode scope. plans:write does not include it. Sending period is 400: A plan's period is set when the plan is created. It can't be changed. Sending none of the three fields is 400: Send name, tool, or max_allows to update.

If the plan has an active live key (ord_live_, not revoked), the update is 409 live_key_on_plan, nothing changes, and one key.live_refused row is written. Change that plan in the console.

A real change writes plan.update and applies on the next decide for every key on that plan. The key’s count for the current period stays on the key. Sending the same name, tool, and cap does not write a second row.

Terminal window
curl -sS -X PATCH https://api.ordainer.dev/v1/admin/plans/$PLAN_ID \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: plan-cap-1" \
-d '{"max_allows":200}'
GEThttps://api.ordainer.dev/v1/admin/plans

Scope plans:write, plans:mode, or usage:read. 200. Includes plans created in the console. The list object does not add created_at or changed.

Terminal window
curl -sS "https://api.ordainer.dev/v1/admin/plans?limit=100" \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY"
{"plans":[{"id":"7a2d3b50-2222-4222-8222-222222222222","name":"pilot","tool":"research.run","period":"month","max_allows":100,"mode":"shadow","customer_id":"6f1c2a40-1111-4111-8111-111111111111"}],"next_cursor":null}
POSThttps://api.ordainer.dev/v1/admin/plans/:id/mode

Scope plans:mode. 200. Requires Idempotency-Key. The body is {"mode":"shadow"} or {"mode":"enforce"}. This is the same switch as Console → Plans. The next decide() reads the new mode. mode does not change the decision. It tells your code what to do with a deny. See Shadow mode, then enforce.

If the plan has an active live key (ord_live_, not revoked), the switch is 409 live_key_on_plan, the mode stays as it was, and one key.live_refused row is written. Change that plan in the console.

The response is the plan object plus changed. changed is false when the plan was already in that mode. A no-op still writes one plan.mode row. A replay of the same Idempotency-Key does not write another row.

Terminal window
curl -sS -X POST https://api.ordainer.dev/v1/admin/plans/$PLAN_ID/mode \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: plan-mode-1" \
-d '{"mode":"enforce"}'
{"id":"7a2d3b50-2222-4222-8222-222222222222","name":"pilot","tool":"research.run","period":"month","max_allows":100,"mode":"enforce","customer_id":"6f1c2a40-1111-4111-8111-111111111111","changed":true}

Test keys only. The secret is an agent key (ord_test_ and 32 characters). Give that secret to the integration or AI agent. Do not send the admin key to /v1/decide.

A key object:

Field Type Notes
id UUID
label string
environment "test" Lists and creates return test keys only.
key_prefix string The start of the secret, so you can recognize it. Not the secret.
customer_id UUID
plan_id UUID
rate_per_sec integer or null null means the service default.
max_in_flight integer or null null means the service default.
max_queued integer or null null means the service default.
created_at ISO 8601 timestamp
revoked_at ISO 8601 timestamp or null
usage object usage.key is this key’s allowance for the current period: period (the plan’s month, day, or minute), period_start, resets_at, used, cap, and remaining. Only allowed decisions count; denies don’t. cap and remaining are null on a plan with no allowance limit. Other blocks may be added beside key later, so read usage.key by name.
secret string Only on the first response of a create or a rotate.

max_in_flight and max_queued are the per-key concurrency settings. A change to them writes a change-log row whose action is key.vendor_concurrency. That action is visible on GET /v1/admin/changes and in Console → Change log. It is not a hidden staff row. The staff actions key.concurrency and org.key_concurrency are a different thing, and those rows are left out of both lists.

POSThttps://api.ordainer.dev/v1/admin/keys

Scope keys:write. 201, the key object including secret, and one key.create row. Requires Idempotency-Key. The environment we store is always test. The body cannot choose a live key.

Field Required Rule
label Yes String, 1–50 characters after trimming.
customer_id Yes A customer in this organization.
plan_id Yes A shared plan, or a plan of this customer.
rate_per_sec No A whole number from 1 to 1,000,000, or omit it for the service default.
environment No Omit it, or the exact string test.

max_in_flight and max_queued are not accepted on create. Set them with Update a key.

The plan must be shared (customer_id null) or belong to this customer. Otherwise 400 cross_customer_move: That plan belongs to another customer. Choose a shared plan or one of this customer's plans.

Keep secret from this response. A replay returns the same id and no secret.

Terminal window
curl -sS -X POST https://api.ordainer.dev/v1/admin/keys \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: key-pilot-1" \
-d '{"label":"pilot","customer_id":"'"$CUSTOMER_ID"'","plan_id":"'"$PLAN_ID"'"}'
{"id":"8b3e4c60-3333-4333-8333-333333333333","label":"pilot","environment":"test","key_prefix":"ord_test_ab12","customer_id":"6f1c2a40-1111-4111-8111-111111111111","plan_id":"7a2d3b50-2222-4222-8222-222222222222","rate_per_sec":null,"max_in_flight":null,"max_queued":null,"session_limit":null,"running":0,"usage":{"key":{"period":"month","period_start":"2026-11-01T00:00:00.000Z","resets_at":"2026-12-01T00:00:00.000Z","used":0,"cap":100,"remaining":100}},"created_at":"2026-11-05T14:05:00.000Z","revoked_at":null,"secret":"ord_test_…"}

Then call decide with that agent key, not the admin key. One allowed call counts as 1 against the key’s plan, and against the organization’s monthly test allowance. See Set up 10 customers.

PATCHhttps://api.ordainer.dev/v1/admin/keys/:id

Scope keys:write. 200 and the key object, without secret. Requires Idempotency-Key. Send one or more of rate_per_sec, max_in_flight, max_queued and session_limit. A field you omit stays as it was. null clears that field back to the service default (session_limit of null turns the session limit off).

Field Rule
rate_per_sec A whole number from 1 to 1,000,000, or null.
max_in_flight A whole number from 1 to 8, or null.
max_queued A whole number from 0 to 100, or null.
session_limit A whole number from 1 to 100, or null to turn it off. Limits only decide calls that send lease; see Session leases.

max_queued of 0 means no extra request waits. The 100 figure is the default ceiling. The error message names the ceiling if it is different. It is never above 200. A number past the range is 400, not a silent cap. A non-integer is 400: "max_in_flight" must be an integer or null. (the same sentence for max_queued). Sending none of the four fields is 400: Send rate_per_sec, max_in_flight, max_queued, or session_limit to update. A non-integer session_limit is 400: "session_limit" must be an integer or null. A session_limit outside 1 to 100 (and not null) is 400: Session limit must be a whole number from 1 to 100, or empty to turn it off. Sending 0 (live capture):

{"error":{"code":"invalid_request","message":"Session limit must be a whole number from 1 to 100, or empty to turn it off.","request_id":"req_50KEv91t2MH7L_qR"}}

A change writes key.session_limit. The same value again writes nothing. Lowering it doesn’t end running leases.

rate_per_sec is the most this key may send to /v1/decide. Each server counts separately, and there is no shared store. null keeps the service default of about 100 requests a second, each server counts separately. Decide uses the lower of the stored number and that service default, so a stored number above the default does not raise the key’s rate. The response shows the number you stored. A change writes key.rate_limit. The same number again does not write a second row.

max_in_flight and max_queued replace the hosted default (4 in flight and 20 waiting, each server counts separately) for this test key only. A call already in flight keeps the slot it took under the previous cap. The following call on that server is the one that reads the new numbers. A real change writes key.vendor_concurrency, and that row is returned by List changes. Clearing both back to null is a change too, when the stored values were not already null. No separate batch call.

A revoked key is 400: A revoked key cannot be changed. A live key this organization already has is 404 (see Live keys).

Terminal window
curl -sS -X PATCH https://api.ordainer.dev/v1/admin/keys/$KEY_ID \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: key-rate-1" \
-d '{"rate_per_sec":25,"max_in_flight":2,"max_queued":10}'

A successful PATCH with {"session_limit":1,"max_in_flight":1,"max_queued":0} returns the key object, without secret. GET /v1/admin/keys/:id returns the same fields:

{"id":"8b3e4c60-3333-4333-8333-333333333333","label":"pilot","environment":"test","key_prefix":"ord_test_ab12","customer_id":"6f1c2a40-1111-4111-8111-111111111111","plan_id":"7a2d3b50-2222-4222-8222-222222222222","rate_per_sec":null,"max_in_flight":1,"max_queued":0,"session_limit":1,"running":0,"usage":{"key":{"period":"month","period_start":"2026-11-01T00:00:00.000Z","resets_at":"2026-12-01T00:00:00.000Z","used":0,"cap":100,"remaining":100}},"created_at":"2026-11-05T14:05:00.000Z","revoked_at":null}
POSThttps://api.ordainer.dev/v1/admin/keys/:id/plan

Scope keys:write. 200. Requires Idempotency-Key. The body is {"plan_id":"<uuid>"}.

The new plan must be shared, or belong to the same customer, and it must use the same period. The key’s count for the current period stays on the key. A real move writes key.move_plan. Moving a key onto the plan it is already on returns changed: false and does not write a second row.

Situation Status Code
plan_id missing 400 invalid_request
plan_id is not a UUID 404 not_found (No such plan.)
Plan is another customer’s 400 cross_customer_move
Periods differ 400 invalid_request (the message names both periods)
Key is revoked 400 invalid_request: A revoked key cannot be moved.
Live key 404 not_found
Terminal window
curl -sS -X POST https://api.ordainer.dev/v1/admin/keys/$KEY_ID/plan \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: key-move-1" \
-d '{"plan_id":"'"$OTHER_PLAN_ID"'"}'
{"id":"8b3e4c60-3333-4333-8333-333333333333","plan_id":"9c4f5d70-4444-4444-8444-444444444444","changed":true}
POSThttps://api.ordainer.dev/v1/admin/keys/:id/revoke

Scope keys:revoke. 200. The body must be an empty JSON object. Idempotency-Key is optional. When you send it, a retry returns the stored body and does not write a second row.

The first revoke writes key.revoke. Revoking a key that is already revoked returns the same shape and does not write a second row. The next decide with that agent key is 401 revoked_key. A revoked key cannot be un-revoked.

A non-empty body is 400 invalid_request. That includes a reason field and any of the unit fields below. The key is not revoked.

Terminal window
curl -sS -X POST https://api.ordainer.dev/v1/admin/keys/$KEY_ID/revoke \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: key-revoke-1" \
-d '{}'
{"id":"8b3e4c60-3333-4333-8333-333333333333","revoked":true}
POSThttps://api.ordainer.dev/v1/admin/keys/:id/rotate

Scopes keys:write and keys:revoke. A key with only one of them is 403 missing_scope. 201, the new key object including secret, plus old_key_id. Requires Idempotency-Key. Send no body or {}. Any field is 400 invalid_request.

One step, all or nothing: a new test key is made with the same customer, plan, and label, and with every per-key setting of the old key (rate_per_sec, max_in_flight, max_queued, session_limit, and any per-key overrides and credit cap). A key on hold stays on hold. The old key is revoked at the same moment, so its next decide is 401 revoked_key. There is no overlap. One key.rotate row is written with this admin key’s id.

Rotating resets the per-key count: the new key’s plan count for the current period starts at 0, and the old key’s count stays on the old key. Your organization’s monthly test limit still applies and is not reset.

Keep secret from this response. A replay of the same Idempotency-Key returns the same new key id and no secret. An unknown id and another organization’s id are 404 not_found: No such key. A revoked key is 400 invalid_request: A revoked key can't be rotated. A live key is 404 not_found and writes key.live_refused. Nothing else changes in those cases.

Terminal window
curl -sS -X POST https://api.ordainer.dev/v1/admin/keys/$KEY_ID/rotate \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: rotate-$KEY_ID" \
-d '{}'
{"id":"9c4f5d70-4444-4444-8444-444444444444","label":"pilot","environment":"test","key_prefix":"ord_test_cd34","customer_id":"6f1c2a40-1111-4111-8111-111111111111","plan_id":"7a2d3b50-2222-4222-8222-222222222222","rate_per_sec":25,"max_in_flight":2,"max_queued":10,"session_limit":null,"running":0,"usage":{"key":{"period":"month","period_start":"2026-11-01T00:00:00.000Z","resets_at":"2026-12-01T00:00:00.000Z","used":0,"cap":100,"remaining":100}},"created_at":"2026-11-20T14:05:00.000Z","revoked_at":null,"secret":"ord_test_…","old_key_id":"8b3e4c60-3333-4333-8333-333333333333"}
GEThttps://api.ordainer.dev/v1/admin/keys

Scope keys:write, keys:revoke, or usage:read. 200. Test keys only, including revoked test keys (revoked_at set). Live keys are left out, including when the query string says environment=live. No secrets and no hashes. rate_per_sec, max_in_flight, max_queued, session_limit, and running are on each row. session_limit is null when off. running is the key’s running session leases (0 on a revoked key).

Terminal window
curl -sS "https://api.ordainer.dev/v1/admin/keys?limit=100" \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY"
{"keys":[{"id":"8b3e4c60-3333-4333-8333-333333333333","label":"pilot","environment":"test","key_prefix":"ord_test_ab12","customer_id":"6f1c2a40-1111-4111-8111-111111111111","plan_id":"7a2d3b50-2222-4222-8222-222222222222","rate_per_sec":25,"max_in_flight":2,"max_queued":10,"session_limit":null,"running":0,"usage":{"key":{"period":"month","period_start":"2026-11-01T00:00:00.000Z","resets_at":"2026-12-01T00:00:00.000Z","used":12,"cap":100,"remaining":88}},"created_at":"2026-11-05T14:05:00.000Z","revoked_at":null}],"next_cursor":null}
GEThttps://api.ordainer.dev/v1/admin/keys/:id

Scope keys:write, keys:revoke, or usage:read. 200 and the same object as one row from the list. No secret and no hash. Includes a revoked test key (revoked_at set). An unknown id, another organization’s id, and a live key are 404 not_found: No such key. Nothing is written to the change log.

Terminal window
curl -sS https://api.ordainer.dev/v1/admin/keys/$KEY_ID \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY"
{"id":"8b3e4c60-3333-4333-8333-333333333333","label":"pilot","environment":"test","key_prefix":"ord_test_ab12","customer_id":"6f1c2a40-1111-4111-8111-111111111111","plan_id":"7a2d3b50-2222-4222-8222-222222222222","rate_per_sec":25,"max_in_flight":2,"max_queued":10,"session_limit":null,"running":0,"usage":{"key":{"period":"month","period_start":"2026-11-01T00:00:00.000Z","resets_at":"2026-12-01T00:00:00.000Z","used":0,"cap":100,"remaining":100}},"created_at":"2026-11-05T14:05:00.000Z","revoked_at":null}

Live keys are not available yet. Live keys open when paid plans launch. Your test keys cover everything in your beta.

On every admin write, a body field or query parameter whose name is environment (any case, surrounding spaces ignored on the name) must be missing or the exact string test. Test, test, LIVE, live, and the same words with odd spaces or fullwidth letters are refused. The response is 400 invalid_request:

{"error":{"code":"invalid_request","message":"The admin API only creates test keys (ord_test_). Live keys (ord_live_) are refused, and the payment processor stays in test mode.","request_id":"req_exampleLiveRefused"}}

Nothing is created or changed. The payment processor is not called. One change-log row is written: action key.live_refused, which List changes does return. If no key existed, entity_id is 00000000-0000-0000-0000-000000000000.

Revoke, move, and rate or concurrency changes of a live key this organization already has are 404 not_found, the key is left as it was, and the message is: This is a live key (ord_live_). The admin API cannot create, enable, move, or change a live key. Live keys are refused, and the payment processor stays in test mode. That refusal also writes key.live_refused, with that key’s id. Another organization’s id stays a plain 404 and writes no row.

A field or query name that is not environment (for example environment[]) is not read as environment.

GEThttps://api.ordainer.dev/v1/admin/decisions

Scope usage:read. 200. Read only. It returns decision rows for this organization’s test keys only. A live decision is never returned, and no parameter changes that. Newest first. Rows older than your audit retention are not shown.

Query Rule
would_deny Optional. true (or 1) returns only would-denies: decision=deny and mode=shadow, the same as the console’s would-deny filter. Any other value is 400. It can’t be combined with a different decision or mode.
decision Optional. allow or deny.
mode Optional. shadow or enforce.
request_id Optional. The request_id of one decide call (req_ and 8 to 64 letters, digits, - or _).
key_id, customer_id, plan_id Optional. An id. One that isn’t this organization’s returns an empty list, not a 404. A value that isn’t a UUID is 400 invalid_request.
tool Optional. 1 to 200 characters.
reason Optional. 1 to 64 characters. reason is an open string: filter by any value you’ve seen returned, and don’t assume a fixed list.
since, until Optional. A timestamp such as 2026-11-18T14:00:00Z. until must be after since. since is inclusive, until is exclusive.
limit Optional. Default 50. A whole number from 1 to 100.
cursor Optional. Send back next_cursor from the previous page.

Any other query name, or a name sent twice, is 400 invalid_request, for example "nope" isn't accepted on this request. A would_deny that isn’t true or 1 is "would_deny" must be true. A limit of 101 is "limit" must be a whole number from 1 to 100.:

{"error":{"code":"invalid_request","message":"\"limit\" must be a whole number from 1 to 100.","request_id":"req_exampleLimit101"}}

Each row has request_id, created_at, decision, reason, mode, would_deny, tool, environment (always "test"), key_id, key_label, customer_id, plan_id, remaining, limit, resets_at, and plan_policy_version. remaining and limit are null on a plan with no allowance limit.

Reads have their own limits, separate from admin writes and from GET /v1/decisions. The numbers are the same, but the rate is per organization here: about 20 reads a second per organization (429 rate_limited, "limit_scope": "per_org"), 2 reads in flight per admin key (429 concurrency_limited, no queue, retry after 1 second), and 1 second per read (503 db_timeout). Each server counts separately. Reads don’t count toward the 60 writes a minute.

Terminal window
curl -sS "https://api.ordainer.dev/v1/admin/decisions?would_deny=true&limit=50" \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY"
Terminal window
curl -sS "https://api.ordainer.dev/v1/admin/decisions?request_id=$REQUEST_ID" \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY"

The row below has the same fields, in the same order, as a live response. The values are examples.

{"decisions":[{"request_id":"req_exampleWouldDeny","created_at":"2026-11-20T14:06:00.123456Z","decision":"deny","reason":"quota_exceeded","mode":"shadow","would_deny":true,"tool":"research.run","environment":"test","key_id":"8b3e4c60-3333-4333-8333-333333333333","key_label":"pilot","customer_id":"6f1c2a40-1111-4111-8111-111111111111","plan_id":"7a2d3b50-2222-4222-8222-222222222222","remaining":0,"limit":100,"resets_at":"2026-12-01T00:00:00.000Z","plan_policy_version":1}],"next_cursor":null}
GEThttps://api.ordainer.dev/v1/admin/changes

Scope usage:read only. A key that can write but does not have usage:read gets 403 missing_scope. 200. No idempotency key.

Optional request_id matches the X-Request-Id of a write. It must be 1 to 80 characters, without control characters. A request id you did not make, including another organization’s, returns an empty list, not a 404.

Each row:

Field Type Notes
id string Decimal. The page cursor is based on it.
action string See below.
entity_type string customer, plan, agent_key, or admin_key.
entity_id UUID The customer, plan, or key.
actor string The email stored on the change. For an admin-key call, that is the email of the organization member who created the admin key. For a console change, it is the signed-in member.
actor_admin_key_id UUID or null The admin key that made an API write. null on a console change.
actor_admin_key_label string or null That admin key’s label. null on a console change.
actor_admin_key_scopes array of strings or null That admin key’s scopes. null on a console change. Never the secret or its hash.
request_id string or null The write’s X-Request-Id.
changed_at ISO 8601 timestamp

The list has no before, no after, and no secrets. Console → Change log shows the before and after values for the same visible rows. Decide answers are not in this list. A decide request_id is an audit row under Console → Decisions, not a change-log row.

Terminal window
curl -sS "https://api.ordainer.dev/v1/admin/changes?limit=100" \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY"
Terminal window
curl -sS "https://api.ordainer.dev/v1/admin/changes?request_id=$REQUEST_ID" \
-H "Authorization: Bearer $ORDAINER_ADMIN_KEY"
{"changes":[{"id":"42","action":"key.vendor_concurrency","entity_type":"agent_key","entity_id":"8b3e4c60-3333-4333-8333-333333333333","actor":"owner@example.com","actor_admin_key_id":"1d5e6f80-5555-4555-8555-555555555555","actor_admin_key_label":"provisioning","actor_admin_key_scopes":["customers:write","plans:write","plans:mode","keys:write","keys:revoke","usage:read"],"request_id":"req_exampleVendorConc","changed_at":"2026-11-05T14:06:00.000Z"}],"next_cursor":null}

Rows you can see include customer.create, customer.update, customer.delete, customer.cap_alert_emails, plan.create, plan.update, plan.mode, key.create, key.revoke, key.rotate, key.move_plan, key.rate_limit, key.vendor_concurrency, key.live_refused, key.hold, key.release, admin_key.create, admin_key.rotate, and admin_key.revoke. Deleting a customer adds one key.revoke row for each of its keys that wasn’t already revoked, plus customer.delete. Changes made by our team show the actor as Ordainer support.

A no-op customer patch, plan patch, rate change, concurrency change, revoke of an already-revoked key, or move onto the same plan does not add a row. plan.mode does add a row even when the mode is already that value. A replay does not add a row.

These are left out, in the API list and in Console → Change log. They stay in our own records:

  • Any action whose name starts with org., including the monthly test-limit change (org.test_limit).
  • key.concurrency exactly (a staff edit of one key). key.vendor_concurrency is not that name, and it is returned.
  • Any action whose name starts with team., billing., or ordainer..

Branch on error.code. The message wording can change. A 429 also has limit_scope in the error object and a Retry-After header.

{"error":{"code":"missing_key","message":"We didn't get an admin key. Send it as \"Authorization: Bearer ord_admin_...\".","request_id":"req_exampleMissingKey"}}
Status Code When Retry?
400 invalid_request A field is missing or not accepted, including any environment other than exact test, and any unit, weight, or credit field. After fixing
400 invalid_json The body is not valid JSON. Empty is accepted as {}. After fixing
400 invalid_idempotency_key Idempotency-Key is missing on a create, patch, move, rotate, or mode switch, or it is empty, longer than 255, or has a control character. After fixing
400 cross_customer_move The plan belongs to another customer (create or move). No, pick another plan
401 missing_key No Authorization: Bearer header. After adding the key
401 unknown_key The admin key is not one we stored. No
401 expired_key The admin key is past 90 days. No, create a new admin key
401 revoked_key The admin key was revoked, or its rotation overlap has ended. No
401 admin_key_not_for_decide An admin key was sent to /v1/decide or /v1/config. No, send an agent key
403 agent_key_forbidden An agent key was sent to an admin route. No, send an admin key
403 missing_scope The admin key does not include that scope. Scopes are exact. No, use a key that has it
404 not_found Unknown route, unknown id, another organization’s id, or a live key on revoke, move, rate-limit, or rotate. No
405 method_not_allowed The path exists, but not for this method. No
409 conflict Duplicate customer external_id, or rotating an admin key that was already rotated. After changing the id, or rotating the new key
409 live_key_on_plan A plan update or mode switch on a plan that has an active live key. Nothing changes; one key.live_refused row is written. No, change that plan in the console
409 idempotency_conflict That Idempotency-Key was already used for a different body. No, use a new key
413 payload_too_large The body is over 16,384 bytes. After shrinking the body
429 rate_limited More than 60 admin writes in a minute for this organization, or about 20 decision reads a second (GET /v1/admin/decisions, limit_scope per_org). Yes, after Retry-After
429 concurrency_limited 2 decision reads already in flight on this admin key (GET /v1/admin/decisions). Yes, after 1 second, with fewer at once
429 too_many_failed_auth More than 10 failed admin authentications in a minute from this address. After fixing the key
500 internal_error A bug or database failure on our side. Yes, same Idempotency-Key
503 db_timeout A database statement ran too long and was cancelled. Retry-After: 1. Nothing was committed. Yes, after Retry-After, same Idempotency-Key if you sent one

The body must be a JSON object, not an array, string, number, or null. Otherwise 400 invalid_request: The request body needs to be a JSON object, like {"tool":"research.run"}. Invalid JSON is 400 invalid_json: We couldn't read the request body as JSON. Please check it and send it again.

These field names are rejected on every admin write, including revoke: credits_per_period, credits, weight, weights, units, unit, unit_multiplier, allowance. The message is: Every call counts as 1. Weighted units and the pooled per-customer allowance are not part of this API.

Text fields reject control characters and unpaired surrogates: control characters (U+0000-U+001F, U+007F) and unpaired surrogates are not allowed.

Decide errors (such as subscription_required) and deny reasons (such as quota_exceeded and test_limit_reached) are documented on Errors. They are answers from /v1/decide, not from /v1/admin.