Overview
Ordainer puts your plan in front of each tool call. Before your handler does any work, it asks one question, POST /v1/decide: may this caller make this call? We check the caller’s agent key against the plan it’s bound to, answer allow or deny, and count it in the same step. Every answer writes one audit row.
Start with your first deny
Section titled “Start with your first deny”Sign up with your work email, copy the pilot test key, and run one paste: six calls, and the sixth answers deny. It uses a free test key, needs no install, and shows the deny in a few minutes. The docs have examples in curl, PowerShell, Node.js, Python, Ruby and Java.
Put it in front of your own tool
Section titled “Put it in front of your own tool”The Node SDK’s middleware asks before your handler runs. On a deny, your handler doesn’t run: a used-up plan answers your caller 429 (or 402, if you choose), and a tool the plan doesn’t cover answers 403. Install it with npm install ordainer; the Node / Express quickstart below walks through it.
On Rails, the Ruby gem’s guard does the same. In Python, check with client.decide() before your tool runs (package 0.4.0, from PyPI).
Roll out safely with shadow mode
Section titled “Roll out safely with shadow mode”New plans start in shadow: we make the real decision and record it, but your code runs the tool anyway. When the would-denies look right, switch the plan to enforce in the console, with no deploy unless your code pins mode. The one rule for your code: run the tool if decision is allow or mode is shadow.
Reference: the Decide API and errors
Section titled “Reference: the Decide API and errors”A deny is an answer, not an error: allow and every deny come back as HTTP 200, so check decision, not the status code. Send an idempotency key, so a retry gets the original answer and isn’t counted twice. Errors are non-200 responses with one shape; branch on error.code, and quote the X-Request-Id when you write to us.