Roll out with shadow mode, then enforce
Try a plan on real traffic without blocking anyone. When the “would denies” look right, switch to enforce from the console, with no deploy.
Two modes, one decision
Section titled “Two modes, one decision”Every plan has a mode. The mode never changes the decision. It only tells your code what to do with a deny.
| enforce | shadow | |
|---|---|---|
| On allow | Run the tool. | Run the tool. |
| On deny | Don’t run the tool. | Run the tool anyway. The deny is recorded as a “would deny”. |
| Use it for | Real limits | Trying a plan on real traffic without blocking anyone |
decision is allow or mode is shadow.Roll it out
Section titled “Roll it out”-
Start the plan in shadow
Section titled “Start the plan in shadow”New plans you create in the console start in shadow: the mode menu on Add plan says “shadow (start here)”. The two sandbox plans you get at sign-up,
pilotandprod, are in enforce, so the “6th call is a deny” demo works. -
Follow the mode in your code
Section titled “Follow the mode in your code”A deny is always HTTP 200, in both modes. Check the
modefield in the answer and apply the rule:Fragment: a shorter form of the end of
main()indecide.pyfrom First deny (Python tab), which setsstatus,body,leftandrequest_id.python if status != 200:e = body["error"] # branch on e["code"], never on the message...if body["decision"] == "allow":print(f"allow: run the tool ({left}, request_id {request_id})")return 0if body["mode"] == "shadow":print(f"would deny (shadow): {body['reason']}, run the tool anyway ({left}, request_id {request_id})")return 0print(f"deny: {body['reason']}, don't run the tool ({left}, resets {body['resets_at']}, request_id {request_id})")return 2Leave
modeout of your requests so the plan’s setting applies. If you send"mode": "shadow"or"mode": "enforce", that pins it for the call and the console switch has no effect. -
Watch the would-denies
Section titled “Watch the would-denies”Allowed calls count toward the plan limit the same way in both modes and denies never do, so the count is already right when you switch. Denies are always free.
- Overview: “N calls in the last 7 days would have been denied. These calls ran because they were in shadow mode.”, with a link to the Plans page. The Would deny, last 7 days card number opens those rows on Decisions, with counts by plan and by key.
- Decisions: filter to would-deny, or by decision, mode, key, tool, reason, plan, customer and date. The table is 50 rows at a time, newest first, with Older and Newer. Counts by key and by plan sit above the rows. A row reads would deny (call ran), and the mode column says
shadow. - Plans: every plan shows how many would-denies it had in the last 7 days and in its current period, and how many keys those were on. The number opens those rows. The mode button still says Enforce or Shadow.
- Export (CSV or JSON): a shadow deny has
decision=deny,mode=shadow, andwould_deny=true. An allow or an enforce deny haswould_deny=false. The same file includesplan_id,plan_name, andplan_policy_version(empty when the row has no stored version). The download on a filtered Decisions page is those rows. To get only the would-denies from a full export, see Pull the would-denies from an export. The default range is still the last 90 days, or the history you keep if that is shorter.
-
Switch to enforce
Section titled “Switch to enforce”- Open the Plans page.
- On the plan’s row, click Enforce in the Mode column.
Your running server picks up the new mode on its next call, with no deploy, as long as your code doesn’t pin a mode. The switch is recorded in Console → Change log. To roll back, click Shadow in the same place.
A retry that reuses an idempotency key first seen in shadow, within 24 hours, gets the stored shadow answer back, even after the switch to enforce. Only new idempotency keys are decided in enforce.
Pull the would-denies from an export
Section titled “Pull the would-denies from an export”The Decisions page can filter to would-denies and shows 50 rows at a time, with Older and Newer. To review every would-deny in a spreadsheet, download the export and filter it. From code, GET /v1/decisions lists them: send decision=deny and keep the rows with mode: shadow.
- In the console, open Decisions. Under Date range, pick From and To (UTC) and click Set range. The default is the last 90 days, or less if your retention is shorter.
- Click CSV or JSON under the range. The file has every decision in the range, newest first, up to 100,000 rows. If the range has more, the page says the export is paged and gives you a Next page (older) link. Download each page.
- Keep the rows where
decisionisdenyandmodeisshadow. Those are the calls that would have been denied in enforce and ran anyway. Rows withdecision=denyandmode=enforcewere real denies.
mode is the mode that applied to that call. A call that sent "mode": "shadow" on an enforce plan is a would-deny too.
In a spreadsheet, filter the decision column to deny and the mode column to shadow. From a terminal:
# PowerShell, CSV exportImport-Csv .\ordainer-decisions-2026-11-09.csv | Where-Object { $_.decision -eq 'deny' -and $_.mode -eq 'shadow' } | Export-Csv .\would-denies.csv -NoTypeInformation# jq, JSON exportjq '[.decisions[] | select(.decision == "deny" and .mode == "shadow")]' ordainer-decisions-2026-11-09.json > would-denies.jsonUse your own file name; the export names files ordainer-decisions- plus the download date.
To see what would break when you switch, group the would-denies by reason (for example quota_exceeded or tool_not_in_plan), then by customer / customer_external_id and key_label. remaining and limit show where that key stood at the time.
With the Node SDK
Section titled “With the Node SDK”Prefer our Node SDK? Install it with npm install ordainer; the Node / Express quickstart walks through it.
With mode unset (the default), the SDK follows the plan’s mode from each answer. Your server log shows a line like this for a shadow deny:
[ordainer] shadow: would deny tool=research.run reason=quota_exceeded remaining=0/5 request_id=req_… (call allowed)To pin a mode instead (fragment: Ordainer comes from const { Ordainer } = require('ordainer');):
const ordainer = new Ordainer({ mode: 'shadow' });A pinned mode overrides the console. Remove the pin to follow the console again. To send would-denies to your own metrics, pass onDecision: (d) => …; d.wouldDeny is true for shadow denies.
Your caller never sees a would-deny: in shadow the tool runs and returns its normal answer. Before you copy anything from req.ordainer into a response, read What your caller sees in shadow.
Shadow mode at the test limit
Section titled “Shadow mode at the test limit”Shadow mode never blocks a call because of a plan or test limit. After your test keys reach their monthly limit, each shadow call still counts and is logged as a would-deny with the reason test_limit_reached, and the answer still tells your tool to run. To protect the service, shadow calls have a safety ceiling of 10 times your test limit. Past it, they return HTTP 429 with safety_limit_reached until your test usage resets at the start of the next month (UTC), and those calls aren’t counted or recorded. That’s a safety limit, not a deny. Our SDK (version 1.2.0 and later) lets the tool run automatically. If you call our API directly, we recommend letting the tool run and logging the error. If you reach it, email support@ordainer.ai.
The monthly test limit is per organization, shared by all its test keys, and only allowed decisions use it up. One busy customer’s allowed calls use up this shared allowance for every other customer in your organization, so give each customer its own key on a plan with a cap (plan caps count per key).
Not the same thing as fail open
Section titled “Not the same thing as fail open”Shadow is about what to do with a real decision. Fail open / fail closed is about what to do when we can’t answer (timeout, network error, server error). They are separate settings. See Fail open vs fail closed.