Skip to content

Set up 10 customers with the admin API

This page is for one organization setting up ten customers on its own, during the beta, for the integrations and AI agents that will call POST /v1/decide. Ordainer is free during the beta: sign up for test keys with 1,000 decisions a month, no credit card needed.

The admin API is in beta. It creates test keys only. Field-by-field rules, every error code, idempotency, and rate limits are on the Admin API reference.

The organization’s monthly test limit is shared across all of its test keys. It is counted per organization, by UTC month, and only allowed decisions count. Denies do not count. A retry of a decide call with the same idempotency key is not counted again. One busy customer’s allowed calls use up this shared allowance for every other customer in the organization, so the script below gives each customer its own key on a plan with a cap. Plan caps count per key. Two keys on the same plan each get the full cap. The 1,000 is not a per-key cap.

  1. Sign in and make an admin key. Sign in to the console with the emailed link. Open Keys. At the bottom, Admin keys is the form. Leave the scope boxes checked (customers:write, plans:write, plans:mode, keys:write, keys:revoke, usage:read). plans:write does not include plans:mode, and keys:write does not include keys:revoke, so this walkthrough wants those boxes on. Type a label and press Create admin key. Copy the secret then. We show it once and keep only a hash. It starts with ord_admin_, it expires in 90 days, and it does not work on /v1/decide.

    If Admin keys is not on the page, or /v1/admin/ calls return 404, 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.

  2. Create 10 customers, 10 plans, and 10 test keys. Put the admin key in the environment. The loop uses a new Idempotency-Key for each create, so running it again returns the same rows instead of making duplicates. The agent-key secret is only in the first response of each key create. Copy that line. A second run prints that the secret is gone.

    Each plan belongs to that customer, allows 100 calls to research.run, and starts in shadow. Shadow means a deny is recorded and your code still runs the tool. See Shadow mode, then enforce.

    Terminal window
    export ORDAINER_ADMIN_KEY="ord_admin_…"
    export ORDAINER_BASE_URL="https://api.ordainer.dev"
    for i in 01 02 03 04 05 06 07 08 09 10; do
    cust=$(curl -sS -f -X POST "$ORDAINER_BASE_URL/v1/admin/customers" \
    -H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: cust-$i" \
    -d "{\"name\":\"Customer $i\",\"external_id\":\"cust_$i\"}")
    CUST_ID=$(printf '%s' "$cust" | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
    plan=$(curl -sS -f -X POST "$ORDAINER_BASE_URL/v1/admin/plans" \
    -H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: plan-$i" \
    -d "{\"name\":\"plan-$i\",\"tool\":\"research.run\",\"max_allows\":100,\"mode\":\"shadow\",\"period\":\"month\",\"customer_id\":\"$CUST_ID\"}")
    PLAN_ID=$(printf '%s' "$plan" | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
    key=$(curl -sS -f -X POST "$ORDAINER_BASE_URL/v1/admin/keys" \
    -H "Authorization: Bearer $ORDAINER_ADMIN_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: key-$i" \
    -d "{\"label\":\"agent-$i\",\"customer_id\":\"$CUST_ID\",\"plan_id\":\"$PLAN_ID\"}")
    printf '%s\n' "$key" | python3 -c 'import json,sys; body=json.load(sys.stdin); print(body["id"], body.get("secret") or "(replay: the secret was only on the first response)")'
    done

    On Windows? use the PowerShell tab.

    Thirty creates stay inside the admin write allowance (a burst of 60 per organization, then about 1 a second, on each server separately). If a call returns 429 rate_limited, wait for Retry-After and run the loop again with the same idempotency keys.

  3. Check one key with decide. Pick one secret from the loop and call decide with it. This is the agent key, not the admin key.

    Terminal window
    curl -sS -X POST https://api.ordainer.dev/v1/decide \
    -H "Authorization: Bearer $ORDAINER_AGENT_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: check-decide-1" \
    -d '{"tool":"research.run"}'

    A first call under the cap comes back 200 with "decision":"allow", "reason":"ok", and "mode":"shadow". limit is the plan cap (100). remaining is how many allows that key has left in this UTC month. Read decision, not the status code. An admin key on this path is 401 admin_key_not_for_decide.

  4. Read usage and the audit. The decide body is the usage for that key’s plan: remaining, limit, and resets_at. The admin API does not return a separate usage total. The organization’s 1,000 test decisions are not a field on these routes. Console → Overview shows how many of those test decisions the organization has used this UTC month. When they are used up, decide returns 200 with "decision":"deny" and "reason":"test_limit_reached". That deny is the shared allowance, not the plan cap. Details are on Decide.

    The audit of what the admin key did is the change log. Scope usage:read is what lets this call work. Match request_id to the X-Request-Id of a create if you want one write.

    Terminal window
    curl -sS "https://api.ordainer.dev/v1/admin/changes?limit=100" \
    -H "Authorization: Bearer $ORDAINER_ADMIN_KEY"

    You should see customer.create, plan.create, and key.create for each of the ten. actor is the email of the member who created the admin key. actor_admin_key_id is that admin key. The list has no secrets and no before/after values. Console → Change log shows the values. A decide request_id is not in this list. Find that row under Console → Decisions.

Switching a plan to enforce later is POST /v1/admin/plans/:id/mode with scope plans:mode. Revoking a test key is POST /v1/admin/keys/:id/revoke with scope keys:revoke. Both are on the reference.

What you can do, what to ask us, and what isn’t available

Section titled “What you can do, what to ask us, and what isn’t available”

The account owner can do all of this in the console or with the admin API. No request to us is needed.

  • Use the admin API. It is on for every account during the beta. Admin keys is at the bottom of Console → Keys for the account owner.
  • Create, rotate, and revoke admin keys in Console → Keys → Admin keys. The admin API itself cannot make or change admin keys.
  • Create customers, plans, and test keys, switch a plan between shadow and enforce, change a plan’s cap or tool, move a test key to another plan of the same customer, set a key’s rate and in-flight limits, and revoke a test key. Use the console or the admin API. The Node SDK 1.3.0 (OrdainerAdmin) and the Python package 0.3.0 (OrdainerAdmin / AsyncOrdainerAdmin) call that API; see the Node and Python quickstarts.
  • Rename a customer or change its external ID in Console → Customers. Delete a customer you added in the console, or with DELETE /v1/admin/customers/:id (needs customers:write and keys:revoke; the Node SDK 1.3.0 and Python package 0.3.0 wrap this as deleteCustomer / delete_customer). Deleting a customer revokes its keys in the same step. A call already running finishes, the next call with one of those keys gets 401 revoked_key, and the customer’s decision history stays. The sandbox customer can’t be deleted.
  • Set cap-alert emails for a customer (Console → Customers, or cap_alert_emails on PATCH /v1/admin/customers/:id).
  • Name your workspace on Console → Overview.
  • See how many test decisions the organization has used this UTC month, and its limit, on Console → Overview.
  • A different monthly test limit. The limit is for the whole organization, shared by every test key, counted by UTC month, and only allowed decisions count. Console → Overview shows your number. You can’t change it in the console or with the API. Email support@ordainer.ai if you need a different one. We don’t promise a higher number. If we change it, the new number shows on Console → Overview. The change is not listed in Console → Change log or by GET /v1/admin/changes.
  • The admin API stops working. If every /v1/admin/ call returns 404 and Admin keys is gone from Console → Keys, 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.
  • Live keys. Live keys are not available yet. Live keys open when paid plans launch. Your test keys cover everything in your beta. The admin API never creates, moves, or changes a live key (ord_live_). environment must be omitted or be exactly test. Anything else is 400 invalid_request, and the payment processor is not called. Revoke, move, and rate or in-flight changes on a live key the organization already has are 404 not_found, and the key is left as it was.
  • Webhooks to your own systems.
  • Weights, multipliers, credits, or a pooled allowance. Every allowed call counts as 1.
  • Admin calls from the Ruby gem or the Java example. Those still use plain HTTP, as on this page.
  • Changing a plan’s period after it is created. Make a new plan with the period you want.
  • Renaming a customer or changing its external_id with the admin API. Use Console → Customers for these. Deleting a customer you added is available as DELETE /v1/admin/customers/:id (and in the Node and Python admin clients).
  • Turning a revoked agent key back on. Make a new key instead.
  • Deleting a plan.