Early Access Beta: free, no credit card needed. Sign up →

Blog

What your caller sees when the plan says no

· The Ordainer team

Last week, in Shadow first: try a plan before anyone feels it, we covered watching would-denies before you switch a plan to enforce. This post is about the moment after the switch: a call comes in, the plan says no, and something has to answer the caller.

That caller is often not a person. It is an integration or an AI agent, and it will act on whatever you send back. A vague error can turn into a retry loop. A clear one can stop it.

Two different "no"s

In enforce, Ordainer Cap denies a call for one of a few reasons. Two matter most for your customers' callers:

  • The plan is used up (quota_exceeded). The agent key has used its allowance for this period. Waiting until the reset will fix it.
  • The tool is not in the plan (tool_not_in_plan). The key's plan does not cover this tool. Waiting will not fix it.

Those need different answers, because a well-behaved caller should do different things: wait in one case, stop and ask in the other.

With the Node SDK middleware

If you put ordainer.middleware() in front of a route, the SDK answers the caller for you on a deny in enforce. Your handler does not run.

A used-up plan gets 429 Too Many Requests with the code plan_limit_reached. This is the body from one of our own test runs:

HTTP/1.1 429 Too Many Requests
X-Request-Id: req_z3jEUlszu1BEAP0V
Retry-After: 3600

{"error":{"code":"plan_limit_reached",
 "message":"This call wasn't run because the usage limit was reached (0 of 5 left). It resets at 2026-12-01T00:00:00.000Z. Retrying before then won't work.",
 "request_id":"req_z3jEUlszu1BEAP0V","reason":"quota_exceeded",
 "remaining":0,"limit":5,"resets_at":"2026-12-01T00:00:00.000Z", ...}}

A few things are on purpose here:

  • The message is written to be read as-is, by an AI agent or the person behind it. It says the call did not run, how much is left, when it resets, and that retrying sooner will not help.
  • Retry-After is capped at one hour (3600 seconds). For a monthly plan the real reset can be weeks away, so the exact time is in resets_at in the body.
  • remaining, limit and resets_at are there for callers that read fields instead of text.

Some clients treat any 429 as "try again in a moment." If yours do, you can answer 402 Payment Required instead with denyStatus: 402, on the client or on one route:

app.post('/tools/research',
  ordainer.middleware({ tool: 'research.run', denyStatus: 402 }),
  handler);

Only 429 and 402 are accepted. The body stays the same.

A tool the plan does not cover gets 403 Forbidden with the code plan_denied, and no Retry-After, because waiting will not help:

{"error":{"code":"plan_denied",
 "message":"This call wasn't run because \"delete_records\" isn't included in your current access. If you need it, contact the provider of this service. (tool_not_in_plan)",
 "request_id":"req_pSN6FCDZWvSC2Cgq","reason":"tool_not_in_plan"}}

That message points the caller to you, the provider, which is where a plan change has to happen anyway.

If you would rather not use middleware, ordainer.wrap() throws an error that carries the same status, headers and body that middleware would send the caller, so any framework can send it. For wrap(), set denyStatus on the client, not on the wrap() call.

With plain HTTP

If you call POST /v1/decide yourself, a deny is not an error. Cap answers HTTP 200 with "decision": "deny" and a reason, plus remaining, limit, resets_at and request_id. Your handler picks what the caller sees.

A simple rule that matches the SDK:

  • quota_exceeded: answer 429 (or 402), with Retry-After and the reset time.
  • tool_not_in_plan: answer 403, and say the tool is not in their plan.
  • Any reason you do not recognize on a deny: treat it as a deny. More reasons can be added.

Branch on reason, not on message text. Message wording can change.

The request ID ties it together

Every answer above carries a request ID, in the X-Request-Id header and in the body. It is the same ID as the decision's audit row in Console → Decisions and in the CSV or JSON export. When a customer writes in about a blocked call, ask for that ID and you can find the exact decision: which agent key, which tool, which reason, and when.

A note for the beta

During the beta everyone is on test keys. Your organization's test keys share a monthly test limit of 1,000 allowed decisions, and only allows count. That is our sandbox limit, not your customer's plan. Live keys are not available yet.

Next Thursday: keeping a record you can show the customer.

Try it

Ordainer is free during the beta: sign up for test keys with 1,000 decisions a month, no credit card needed. The docs list every answer your caller can get under SDK blocked responses, and the Node / Express quickstart walks you to your first 429.

If an integration or AI agent ever kept retrying against your API after you said no, or if you have settled on 429 or 402 for "plan used up", tell us how that went through the form on ordainer.ai.

The Ordainer team

← All posts

Follow the blog by RSS