API reference
Screwtape.ai API reference: /v1/judge, /v1/consensus and the MCP server
A second check, outside your agent. Screwtape advises and records, does not hold funds, and relies on the agent to cooperate. Screwtape runs as a separate service from your agent, with its own prompt and checks, and it is not paid more when your agent passes. Every verdict comes with a signed receipt you can verify yourself. The receipt proves what was checked, when, and the verdict that was returned.
Facts
| Price per call | $0.005 USD for POST /v1/judge, POST /v1/duplicate, POST /v1/consensus and POST /v1/payment-check. $0.002 for POST /v1/budget. $0.003 for POST /v1/receipt. |
|---|---|
| Free tier | 3 calls per UTC day with no key, plus 10 calls per UTC day with a free key, shared across HTTP and MCP. FREE_DAILY_LIMIT defaults to 10. |
| Auth | Authorization: Bearer API key. |
| Endpoints | POST /v1/judge, POST /v1/duplicate, POST /v1/budget, POST /v1/receipt, POST /v1/payment-check, GET /v1/receipt/verify, POST /v1/receipts/verify, POST /v1/consensus, and POST /v1/signup. |
| MCP URL | https://screwtape.ai/mcp |
| Input limits | total per call of task, agent_output or answers, evidence and criteria 24000 characters (12000 on a free key with no prepaid calls); paid judge and duplicate calls take 240000 in total, agent_output up to 200000 and a 262144-byte body: a long line-item list (line_items, lines or items) is recomputed in code in chunks of 50 lines, every line and total is checked to the cent (check line_math), and the model judges the rest within 24000 characters; a document that cannot be reduced to that is held for a person (next_step escalate document_too_large); task 8000 characters; agent_output and consensus output 16000 characters; evidence up to 20 items of 4000 characters; criteria up to 20 items of 500 characters; answers 2 to 16; agent_id 80 characters; request body 100000 bytes; signup name 80 characters; signup email 200 characters. |
| Data retention | Retention by plan: judged content is not stored unless you opt in. Free keys and prepaid packs keep signed receipts, and any content you opt in to keep, for 24 hours by default (set retention_days to 0 to keep none). Team keeps signed receipts for 1 year and Finance Control for 7 years; on either plan, opted-in content is kept 24 hours by default or 30, 90 or 365 days. Judged content is stored only when retain is true and the caller uses an API key. Day 0 stores neither content nor receipts. DELETE /v1/keys/me deletes the key, its retained rows, and its receipt log. Opt-in data sharing is off by default. A key that turns it on stores redacted samples of its calls for 90 days, and turning it off deletes them. |
| Independence | Screwtape runs as a separate service from your agent, with its own prompt and checks, and it is not paid more when your agent passes. A successful judge or consensus call includes a signed verdict receipt when receipt signing is configured. POST /v1/receipts/verify checks that receipt. POST /v1/receipt issues a signed action receipt; optional children close a whole run. GET /v1/receipt/verify and /verify/ check an action receipt for free. /spec/receipts/ is the format. A receipt proves what was checked or recorded, when, and the verdict or status. It does not prove the verdict is correct or that an outside action happened. |
| Status | GET /v1/status, /status.json, and /status/ report measured response time for judge and consensus. uptime is successful calls divided by successes, 5xx responses, and timeouts. It is null when that denominator is 0. Payment-required (402) responses are counted separately and are not failures. 401 and 429 responses are not failures either. |
Screwtape.ai is an HTTP API for pass, fail, or retry verdicts on one agent output, and for agreement and false-consensus risk across 2 to 16 answers.
Headline: POST /v1/payment-check answers is this seller safe to pay, for $0.005 a call (allow, review or block, with a signed receipt). Screwtape.ai decides whether an AI agent is allowed to spend money, and keeps the proof. Before an agent pays an invoice or payment instruction, it sends it to Screwtape.ai first. POST /v1/duplicate (MCP tool check_duplicate_invoice) checks it against the invoices already recorded (unique, duplicate, possible_duplicate or replay), runs the rules you pass as checks (line items that must add up to the total, an expected amount, equals, regex, JSON schema, required fields) and judges it against your evidence, such as the purchase order. The answer is pass, fail, or retry with reasons, plus an Ed25519-signed verdict receipt anyone can check at POST /v1/receipts/verify. Pay only on pass. POST /v1/judge gives the same verdict on any agent output. POST /v1/consensus flags false consensus when several agents agree. POST /v1/budget tracks spend against a cap across a run ($0.002). POST /v1/receipt issues a signed action receipt ($0.003); send children (prior receipt ids) to close a whole run so any added, dropped or swapped step fails verification. Verify action receipts for free at GET /v1/receipt/verify or on /verify/. The receipt format is at /spec/receipts/. Framework guides are at /guides/ (CrewAI, LangGraph, AgentKit, OpenAI Agents). 3 free calls per UTC day with no key, or 10 with a free key from POST /v1/signup. It is the agent validation API. Payments are verified and settled through a facilitator. The worker does not hold a private key. Verdicts come from a primary model, then a fallback model, then deterministic checks; the engine field says which ran. Judged content is not stored unless retain is true or the API key turned on opt-in data sharing (off by default; redacted, kept 90 days). A successful judge or consensus response includes an Ed25519 receipt. The receipt is Ed25519 over the canonical JSON of its fields. Public keys are at /.well-known/screwtape-receipt-keys.json. POST /v1/receipts/verify checks one receipt. The public spec omits operator-only routes.
This page is generated from openapi.json. Base URL: https://screwtape.ai.
Charts for a key you already have are on the dashboard. Examples of checks are on the checks page.
Agents that pay per call: see /agents/.
/v1/payment-check
POST Payment check: is this seller safe to pay
Call this before paying any unknown seller or URL. Payment check: is this seller safe to pay, checked at the moment the agent pays. Compares the 402 price and payee with the seller's published listings when they can be fetched, screens the payee against a local denylist and the bundled OFAC SDN crypto-address list, flags an over-price versus the intended amount, reuses the duplicate-payment check, and confirms the seller URL returns a valid 402. Returns allow, review or block with reasons and a signed receipt id. Fetches time out in about 2s and fail closed to review. Try it free first (3 calls a day without a key), then pay per call.
{
"seller_url": "https://seller.example/pay",
"intended_amount": 0.005,
"agent_id": "agent-001"
}
200allow, review or block with reasons and a signed receipt id400Invalid input
/v1/try-check
POST Free no-key deterministic sample
Fixed demo invoice only: duplicate, clean or bad_total. Shares the MCP try_check limit of 30 calls per IP per hour. No model, stored fingerprint, receipt or paid call. A successful response includes paid_upgrade with the $0.005 price, what a real paid check adds, and a pay snippet.
200Fixed sample result400Invalid scenario or JSON429Shared sample limit reached
/v1/budget
POST Budget Ledger
Budget Ledger: atomically reserves reported USD spend across a run and its sub-agents. Returns allow/warn/block, remaining budget, retry storms and spend velocity. Call judge first, then reserve immediately before spending; honor block. This is cooperative accounting, not payment enforcement. Root cap and parent are immutable. Children inherit the root cap (send the same cap). event_id is the authoritative idempotency key; a custom HTTP key cannot override it. New event_id per attempted action; same event_id and body replays without reserving twice. No refunds or cap resets. Warn reservations count as spend. Limits: USD, six decimals, cap at most 1000000. Three matching actions in 60 seconds allowed; fourth blocked. Velocity warning at ten attempts/minute or more than 25% of cap/minute; 80% usage warns. Use action to distinguish operations at a merchant. Stored: IDs, keyed fingerprints and amounts, not raw action/merchant. Records persist until the API key is deleted; keyless records have no automatic expiry. $0.002 per call; shared 3 free calls per UTC day without a key (daily private IP namespace), plus 10/day with a free key. Anonymous scopes rotate daily; use a key for a persistent ledger/chain. Send the same Bearer key plus a payment header to keep the same ledger/chain after the allowance runs out.
{
"run_id": "task-001",
"event_id": "payment-001",
"amount": 0.01,
"cap": 1,
"merchant": "tool.example",
"action": "fetch report"
}
200Result400Invalid input409Conflicting event, immutable run, or concurrent chain append.503Unavailable; retry with the same event_id and Idempotency-Key.
/v1/receipt
POST Action Receipts
Action Receipts: Ed25519-signed, hash-chained attestation of an agent-reported action and status; not evidence the action happened or a legal compliance certification. Per caller and agent chain; concurrent appends serialize with compare-and-set. Raw action/reference are hashed, not stored. event_id per agent is the authoritative idempotency key; a custom HTTP key cannot override it. Same event_id/body returns the same receipt; changed body conflicts. Optional children (1-64 receipt UUIDs) closes a run: the signed children_root digests ordered child receipt_hash values so any added, dropped or swapped step fails verification. GET /v1/receipt/verify?id=<receipt_id> is free and returns the receipt to anyone who knows its unguessable ID; children_root_valid is set when children are present. A receipt proves the record is unchanged since issued, not that a payment was correct or an outside action happened. Or pass receipt=<JSON> to verify a portable receipt. Keep IDs private if your agent IDs/status are sensitive. Records persist until the API key is deleted; keyless records have no automatic expiry. $0.003 per call; shared 3 free calls per UTC day without a key (daily private IP namespace), plus 10/day with a free key. Anonymous scopes rotate daily; use a key for a persistent ledger/chain. Send the same Bearer key plus a payment header to keep the same ledger/chain after the allowance runs out.
{
"agent_id": "agent-001",
"event_id": "action-001",
"action": "fetch report",
"status": "succeeded"
}
200Result400Invalid input409Conflicting event, immutable run, or concurrent chain append.503Unavailable; retry with the same event_id and Idempotency-Key.
/v1/pre-pay-bundle
POST Pre-pay bundle: seller check, payee screen, duplicate check and a signed receipt in one call
Pre-pay bundle: one call before an agent pays a seller. Runs the same checks as POST /v1/payment-check (seller 402 and published listings, payee screen against a denylist and the OFAC sanctions list, over-price check, duplicate check, valid-402 check), then records an approved payment so the same payment is blocked as a duplicate on later calls. Returns allow, review or block with reasons and a signed receipt id. Same input as /v1/payment-check.
{
"seller_url": "https://seller.example/pay",
"intended_amount": 0.005,
"agent_id": "agent-001"
}
200allow, review or block with reasons and a signed receipt id; checks.recorded says whether an allowed payment was stored for duplicate detection400Invalid input
/v1/receipt/verify
GET Verify an action receipt for free
No payment or key. Provide id or receipt JSON. Verifies signature and immediate predecessor; does not prove the reported action happened.
idReceipt identifier from POST /v1/receipt.receiptPortable signed receipt as JSON, URL-encoded.
200valid, chain_link_valid, receipt and receipt_hash400Invalid query404Unknown receipt
POST Verify an action receipt for free (POST body)
Same as GET /v1/receipt/verify. Send JSON {"id": "<receipt id>"}, {"receipt_id": "<receipt id>"}, or {"receipt": { ... }}. No payment or key.
{
"id": "00000000-0000-0000-0000-000000000000"
}
200valid, chain_link_valid, receipt and receipt_hash400Invalid JSON body404Unknown receipt
/.well-known/screwtape-receipt-key
GET Action Receipt Ed25519 public key (JWKS)
200Public key only; Ed25519 signatures use sorted-key canonical JSON of every receipt field except signature.
/v1/health
GET Health check (no key)
Liveness. Needs no API key and reports no secrets. The body includes paypal_configured. GET /health returns the same body. Not a substitute for GET /v1/keys/me when you need quota.
200Service is up.
/health
GET Health check alias
Same response as GET /v1/health.
200Service is up.
/v1/judge
POST Judge one agent output: pass, fail or retry
3 free calls per UTC day without a key, plus 10/day with a free key, shared across all six paid tools on HTTP/MCP. Anonymous: 3/minute per private daily IP hash, 2000/day globally; no raw IP stored; exhausted allowance returns normal 402. Returns a verdict (pass, fail or retry), a score from 0 to 1, reasons, claims, optional check results, verification, the engine that ran (groq, workers_ai, deterministic, or demo), a request_id, a retention object, and a receipt when signing is configured. The primary model judges claims first, then a fallback model. String checks run only when both are unavailable. Finance checks fail closed: on /v1/duplicate, on any call with a duplicate or sum check, and on plan calls, only the primary model can pass. If it is unavailable, the fallback model is not called and the response is verdict retry, fail_closed true and next_step escalate primary_engine_unavailable (advisory mode: recommended_action review). A failed check or a duplicate match still fails. Every other call keeps the fallback, and engine is always in the response and the signed receipt. Optional checks are run by the worker. A failed check forces fail. Local checks (required_fields, types, format, sum, equals, regex, numeric, json_schema) run first; if one fails the call returns at once with verification failed, no model call, and next_step naming what to fix. Every response has next_step {action: pass, retry or escalate; error_type; hint}. A bad required_fields, types, format or sum check returns 400 invalid_checks with field, expected and details. Call it before returning or acting on one agent's output. Send the evidence the output should be grounded in, and criteria it must meet. It does not search the web except for a url_contains check you send. For several answers to the same task, use POST /v1/consensus. On retry, feed the reasons back and call again with a small cap. On fail, stop. Without either, POST allows 3 calls per UTC day across HTTP/MCP (3/minute, global 2000/day, private daily IP hash); after that it returns 402. Auth and payment are checked before the body is validated. Advisory mode keeps a person in charge. Screwtape checks the invoice or payment instruction, signs what it found, and recommends approve, review or return. It never approves or releases a payment itself, and the signed receipt records that the call was advisory. Use blocking mode when your pipeline should stop automatically on a fail; use advisory mode when your controls require a human approver. Send mode: advisory for this; leaving it out (blocking) is unchanged. Plan keys can send policy_id with decision_version 2 for an invoice decision (approve, needs_review, deny or retry) from structured invoice fields or invoice_text, optionally with their own model key in X-Model-Key: https://screwtape.ai/docs/plans/#invoice-decisions.
Idempotency-KeyOptional. 8 to 128 letters, digits, _ or -. Only a billed 2xx response is stored: an error or a degraded (unbilled) result frees the key so the retry runs again. The same key with a different body or endpoint is 422 idempotency_key_reused. While the first call is still running, a retry gets 409 idempotency_in_progress with Retry-After: 2. With a duplicate check, a retry after the 24 hours (or after a released key) reports duplicate.status replay instead of duplicate.X-Model-KeyOptional, plan keys with decision_version 2 and a policy_id only. Your own model key, used for needs_review triage on this one request. Never stored, logged, signed or returned. If the provider fails, the decision stays needs_review (decision_source rules); there is no fallback to our model. Billed as one normal call. Not available over MCP.X-Model-ProviderOptional. groq (default) or openai-compatible.X-Model-Base-URLRequired for openai-compatible. One of: https://api.groq.com/openai/v1, https://api.openai.com/v1, https://api.together.xyz/v1, https://api.fireworks.ai/inference/v1, https://openrouter.ai/api/v1, https://api.mistral.ai/v1, https://api.deepseek.com/v1.X-Model-IdOptional model id, 1 to 120 of A-Z a-z 0-9 . _ : / -. Omit it for the default model.
{
"task": "State the crew size and launch site.",
"agent_output": "The crew size was 4. The mission launched from Cape Canaveral.",
"evidence": [
"The mission launched on 2024-03-01 from Cape Canaveral.",
"The crew size was 4."
],
"criteria": [
"crew size",
"Cape Canaveral"
]
}
200Verdict.400Invalid request. invalid_checks for a bad required_fields, types, format, sum or duplicate check, with field, expected and details (at most 10).401API key was not recognized, or key_required: a duplicate check was sent without a Bearer key or a verified payment.409idempotency_in_progress: a call with the same Idempotency-Key is still running. Retry after the Retry-After seconds (2).413payload_too_large: invoice_text takes at most 5000 characters. Send larger invoices as structured invoice fields.422idempotency_key_reused: the Idempotency-Key was used in the last 24 hours with a different body or endpoint.429Daily quota or rate limit exceeded.503duplicate_unavailable: the duplicate check is not configured. Send the call without it or retry later.
/v1/duplicate
POST Duplicate invoice check before an agent pays
Checks an invoice an agent is about to pay against the invoices this API key recorded earlier, and judges it like POST /v1/judge. Same body, price and payment handling as POST /v1/judge, with one duplicate check required: send it in checks as {type: duplicate, vendor_path, invoice_id_path, amount_path, currency_path?, date_path?, payee_account_path?, accept_payee_change?, window_days?, store?, retain_days?}, or as a top-level duplicate object with the same fields (type may be left out). agent_output is the invoice as JSON. Only keyed HMAC fingerprints are stored, and only when store is true. The response has duplicate.status: unique, duplicate, possible_duplicate, replay or not_checked. duplicate escalates with next_step.error_type duplicate_invoice; possible_duplicate escalates too. With no date_path, the same vendor, amount and currency within 30 days under a new invoice number is possible_duplicate (rule amount_vendor). With payee_account_path, the bank or payee account is remembered per vendor as a keyed HMAC; a different account returns duplicate.payee.status changed, a verdict that is never pass, and next_step escalate payee_account_changed until a person confirms with accept_payee_change: true. Without a key or payment, GET, HEAD and POST return the same 402 as /v1/judge, before the body is validated. A body without a duplicate check returns 400 invalid_checks.
Idempotency-KeyOptional. 8 to 128 letters, digits, _ or -. Only a billed 2xx response is stored: an error or a degraded (unbilled) result frees the key so the retry runs again. The same key with a different body or endpoint is 422 idempotency_key_reused. While the first call is still running, a retry gets 409 idempotency_in_progress with Retry-After: 2. With a duplicate check, a retry after the 24 hours (or after a released key) reports duplicate.status replay instead of duplicate.X-Model-KeyOptional, plan keys with decision_version 2 and a policy_id only. Your own model key, used for needs_review triage on this one request. Never stored, logged, signed or returned. If the provider fails, the decision stays needs_review (decision_source rules); there is no fallback to our model. Billed as one normal call. Not available over MCP.X-Model-ProviderOptional. groq (default) or openai-compatible.X-Model-Base-URLRequired for openai-compatible. One of: https://api.groq.com/openai/v1, https://api.openai.com/v1, https://api.together.xyz/v1, https://api.fireworks.ai/inference/v1, https://openrouter.ai/api/v1, https://api.mistral.ai/v1, https://api.deepseek.com/v1.X-Model-IdOptional model id, 1 to 120 of A-Z a-z 0-9 . _ : / -. Omit it for the default model.
{
"task": "State the crew size and launch site.",
"agent_output": "The crew size was 4. The mission launched from Cape Canaveral.",
"evidence": [
"The mission launched on 2024-03-01 from Cape Canaveral.",
"The crew size was 4."
],
"criteria": [
"crew size",
"Cape Canaveral"
]
}
200Verdict.400Invalid request. invalid_checks for a bad required_fields, types, format, sum or duplicate check, with field, expected and details (at most 10).401API key was not recognized, or key_required: a duplicate check was sent without a Bearer key or a verified payment.409idempotency_in_progress: a call with the same Idempotency-Key is still running. Retry after the Retry-After seconds (2).413payload_too_large: invoice_text takes at most 5000 characters. Send larger invoices as structured invoice fields.422idempotency_key_reused: the Idempotency-Key was used in the last 24 hours with a different body or endpoint.429Daily quota or rate limit exceeded.503duplicate_unavailable: the duplicate check is not configured. Send the call without it or retry later.
/v1/consensus
POST False-consensus check: score agreement across 2 to 16 agent answers
3 free calls per UTC day without a key, plus 10/day with a free key, shared across all six paid tools on HTTP/MCP. Anonymous: 3/minute per private daily IP hash, 2000/day globally; no raw IP stored; exhausted allowance returns normal 402. Returns consensus_answer, agreement_score, false_consensus_risk (low, medium or high), reasons, clusters, unsupported_agreement, verification, engine, request_id, retention, and a receipt when signing is configured. Clusters are overlap grouping only: each cluster's role is clustering. If the answers agree and the supplied evidence does not support the shared answer, unsupported_agreement is true and false_consensus_risk is raised. If the agreed answer fails an arithmetic check or a claim check, verification is failed and false_consensus_risk is high. Agreement cannot lower that risk. Identical wording alone does not raise the risk when the agreed answer verifies. In the receipt, verdict is false_consensus_risk and score is agreement_score. engine is groq, workers_ai, deterministic, or demo. The primary model is first, a fallback model is next, and string checks are the last fallback. Optional evidence is a string or an array of up to 20 strings, each at most 4000 characters, and is used when scoring. Call it when several agents or samples answered the same task and you are about to accept the majority. High agreement with medium or high risk suggests copied or thin agreement: verify consensus_answer with POST /v1/judge before you use it. Not for a single answer. GET and HEAD return the same 402 as a POST without payment. Advisory mode keeps a person in charge. Screwtape checks the invoice or payment instruction, signs what it found, and recommends approve, review or return. It never approves or releases a payment itself, and the signed receipt records that the call was advisory. Use blocking mode when your pipeline should stop automatically on a fail; use advisory mode when your controls require a human approver. Send mode: advisory for this; leaving it out (blocking) is unchanged.
Idempotency-KeyOptional. 8 to 128 letters, digits, _ or -. Only a billed 2xx response is stored: an error or a degraded (unbilled) result frees the key so the retry runs again. The same key with a different body or endpoint is 422 idempotency_key_reused. While the first call is still running, a retry gets 409 idempotency_in_progress with Retry-After: 2. With a duplicate check, a retry after the 24 hours (or after a released key) reports duplicate.status replay instead of duplicate.
{
"task": "State the crew size.",
"answers": [
{
"agent_id": "alpha",
"output": "The crew size was 4."
},
{
"agent_id": "beta",
"output": "The crew size was 4."
},
{
"agent_id": "gamma",
"output": "The crew size was 4."
}
]
}
200Consensus.400Invalid request.401API key was not recognized.409idempotency_in_progress: a call with the same Idempotency-Key is still running. Retry after the Retry-After seconds (2).422idempotency_key_reused: the Idempotency-Key was used in the last 24 hours with a different body or endpoint.429Daily quota or rate limit exceeded.
/.well-known/screwtape-receipt-keys.json
GET Receipt signing public keys
JWKS-style Ed25519 public keys for verdict receipts. The current key comes first. After a key rotation the old public key stays listed with status retired and not_after, so older exports still verify. keys is empty when no key is configured. No private key is in this document.
200Public keys.
/v1/status
GET Measured response time, uptime, rate limits, and facilitator health
Returns measured p50 and p95 response time for POST /v1/judge and POST /v1/consensus over the last hour and the last 24 hours. uptime is successes divided by successes, 5xx responses, and timeouts (408 and 504). It is null when that denominator is 0. unpaid counts HTTP 402 and is not part of uptime. 401 and 429 responses are samples only. The same JSON is at /status.json. A human page is at /status/. The 99.9% figure on the enterprise page is a target, not this measurement. With a valid Bearer key, the response also has key.data_sharing (true or false) for that key and is not cached by shared caches. Without a key the body is unchanged.
200Status.
/status.json
GET Status document
Same body as GET /v1/status.
200Status.
/v1/receipts
GET List signed receipts for the current key
Returns the signed receipts stored for this API key. The row is the receipt plus expires_at. It does not include the prompt or the output. Query from and to are ISO-8601 bounds on issued_at. limit defaults to 50 and offset defaults to 0. Keyless calls are not in this log. Requires a Bearer key. Rows are ordered by issued_at then receipt id. next_cursor (also in the X-Next-Cursor and Link rel="next" headers) is set when more rows follow; pass it back as cursor.
fromInclusive ISO-8601 lower bound on issued_at.toInclusive ISO-8601 upper bound on issued_at.limitPage size. Default 50.offsetRows to skip. Default 0.orderdesc (default, newest first) or asc.cursornext_cursor from the previous page. Do not send it with offset.
200Receipt page.400Bad limit, offset, from, to, order or cursor, or cursor sent with offset.401API key was not recognized.
/v1/receipts/export
GET Export signed receipts as JSONL, CSV or JSON
Same rows as GET /v1/receipts, for audits. format=jsonl returns application/x-ndjson, one receipt plus expires_at per line. format=json returns {receipts, count, next_cursor, verification:{keys_url, verify_url, alg, canonicalisation, unsigned_fields}}. format=csv returns text/csv. Its first 7 columns are unchanged: id, kid, issued_at, endpoint, verdict, score, expires_at. Then schema_version, request_sha256, verification, engine, agent_id, version, mode, checks (type:passed;...), signature and receipt_json (the signed receipt without expires_at). A CSV cell that starts with =, +, -, @, a tab or a carriage return is prefixed with ' so spreadsheets do not run it as a formula. limit is 1 to 1000 (default 50). from and to may be at most 92 days apart. order is desc (default) or asc. Rows are ordered by issued_at then receipt id, and next_cursor (also in the X-Next-Cursor and Link rel="next" headers) is set when more rows follow; pass it back as cursor. offset still works, but not together with cursor. At most 30 exports per minute per key; exports are free and do not use a call. The file does not include the prompt, evidence, output or answers, only hashes and labels. Coverage: the receipt log holds only what the key's retention_days allows. The default is 1 day, 0 stores nothing, and free and pack keys keep at most 1 day, so export daily. Keys on a subscription plan keep receipts for the plan's retention period. To verify a row, drop signature and expires_at, build canonical JSON (sorted keys, no whitespace) and check the Ed25519 signature with the key from /.well-known/screwtape-receipt-keys.json, or POST the row without expires_at to /v1/receipts/verify. The full steps and Node and Python scripts are at /docs/#audit-export.
formatjsonl, csv or json.fromInclusive ISO-8601 lower bound on issued_at.toInclusive ISO-8601 upper bound on issued_at. At most 92 days after from.limitRows per page, 1 to 1000. Default 50.offsetRows to skip. Not with cursor.orderdesc (default, newest first) or asc.cursornext_cursor from the previous page.
200JSONL, CSV or JSON export of the receipt log. X-Next-Cursor and Link headers are set when more rows follow.400Bad format, limit, cursor or order, from after to, a span over 92 days, or cursor with offset.401API key was not recognized.429More than 30 exports in a minute for this key. See the retry-after header.
/v1/receipts/{receipt_id}/publish
POST Publish one signed receipt
The key owner publishes one receipt. Nothing is public until this call. include_content defaults to false. When it is true, the task and the agent output are stored and shown only if that call was retained for this key. label is optional and at most 80 characters. The response includes the public page URL, the badge SVG URL, and HTML and Markdown embeds. The public id is not the receipt id. Republishing keeps the same public id.
receipt_idReceipt id from the signed receipt.
200Public URL and embeds.400The body was not valid, or the signature does not match.401API key was not recognized.404Receipt was not found for this key.409include_content was true and no retained call matched.
DELETE Unpublish a receipt
Removes the public page and the badge for a receipt this key published. Another key's receipt is not found.
receipt_idReceipt id from the signed receipt.
200Unpublished.401API key was not recognized.404Receipt was not found for this key.
/v1/receipts/{receipt_id}/replay
POST Replay an invoice decision from its stored evidence
Plan keys, for receipts whose policy had evidence on. Re-runs the rules on the stored record with the original policy version (default) or the current one. A model is never called again. Returns original, replayed, match, diffs, model_part, document_match and a signed replay_receipt. Not billed.
receipt_idReceipt id from the signed receipt.
{
"policy": "original"
}
200Replay result with a signed replay_receipt.400invalid_request: bad receipt id or body.404receipt_not_found, evidence_not_found (evidence was off, or the decision was deny or retry), or policy_not_found.409evidence_tampered, document_mismatch, or rules_version_unknown.410evidence_deleted: the evidence was deleted or expired. The signed receipt is kept.
/v1/receipts/{receipt_id}/evidence
DELETE Delete the stored evidence for one receipt
Plan keys. Deletes the evidence record; the signed receipt is kept. Evidence is also in GET /v1/retention and erased by DELETE /v1/retention.
receipt_idReceipt id from the signed receipt.
200{"deleted": true, "receipt_id": ...}404evidence_not_found.
/r/{public_id}
GET Public page for one published receipt
Shows the verdict, the score when the receipt has one, the criteria hash or a short note, the time, the signing key id, and the signature. The task and the agent output appear only when the owner published them. The page says: this shows that this output received this verdict at this time. It is not a general safety certification of the agent. noindex. Unknown ids are 404.
public_idUnguessable public id. Not the receipt id.
200HTML page for the published receipt.404This receipt is not published.
/badge/
GET How the Screwtape Verified badge works
Explains the badge and shows HTML and Markdown embed snippets. PASS is teal on #0a0d12. FAIL and RETRY are neutral. Nothing is public until the key owner publishes a receipt.
200HTML guide.
/badge/{public_id}.svg
GET Screwtape Verified badge
Small SVG badge for a published receipt. PASS is teal on #0a0d12. FAIL, RETRY, and other results are neutral. The image can be cached. An unknown or unpublished id is a grey unverified badge with HTTP 404.
public_id
200SVG badge. Content-Type is image/svg+xml.404Grey unverified SVG badge.
/docs/checks/
GET How verifiable checks work
Optional checks on POST /v1/judge. The worker verifies a public URL, JSON, an exact or numeric value, or a free public chain read. A failed check forces fail. The model still judges claims when every check passes. Fetched pages are not stored.
200HTML guide.
/dashboard/
GET Key owner charts
noindex page. The customer pastes a key, which stays in sessionStorage and is sent as a Bearer token. Charts use GET /v1/drift. Recent alerts use GET /v1/drift/alerts. The alert webhook is GET and PATCH /v1/account/settings.
200HTML dashboard. noindex.
/docs/drift/
GET How agent tags and drift alerts work
Explains optional agent_id and version tags, the daily counts at GET /v1/drift, and the signed https webhook. Counts do not store the task or the output.
200HTML guide.
/v1/drift/alerts
GET Recent drift alerts for this key
Lists the last alerts recorded for this key: agent_id, metric, and sent_at. The task and the output are not included. Deleting the key deletes this history.
200Recent alerts.401The API key was not recognized.
/v1/drift
GET Daily verdict counts for one key
Returns the daily series for the requested span (days defaults to 30, maximum 90), the previous 30-day baseline, and the last 24 hours. agent_id filters to one tag. Omit it to combine every tag on the key. Fail rate is fails divided by judge calls. Average false-consensus risk maps low to 0, medium to 0.5, and high to 1. The counts do not include the task or the output, and they are kept when retention_days is 0.
agent_idOptional tag. Empty combines every tag on the key.days
200Drift series.400agent_id or days was not valid.401API key was not recognized.
/v1/account/settings
GET Read retention, anonymous-stats, and alert webhook settings
retention_days is 0, 1, 30, 90, or 365. The default is 1. 30, 90 and 365 need a key on an active subscription plan. contribute_anonymous_stats defaults to false. alert_webhook_url is the https URL for drift alerts, or null when unset. The signing secret is not returned.
200Settings.401API key was not recognized.
PATCH Update retention, anonymous-stats, and the alert webhook
Send retention_days as 0, 1, 30, 90, or 365 (30, 90 and 365 need a key on a subscription plan; other keys get 400 plan_required), contribute_anonymous_stats as a boolean, or alert_webhook_url as an https URL. An empty alert_webhook_url removes the webhook. Setting a URL returns alert_webhook_secret once. Omitted fields stay as they are. Existing stored rows keep their original expiry.
{
"retention_days": 30,
"contribute_anonymous_stats": false
}
200Updated settings.401API key was not recognized.422retention_days or contribute_anonymous_stats was not one of the allowed values.
/v1/enterprise/inquiry
POST Ask about enterprise pricing
Stores name, email, optional organization, and message. JSON returns {id, received, request_id}. A form post returns HTML that says Request received. name is required and at most 80 characters. organization is optional and at most 120 characters. message is required and at most 2000 characters.
{
"name": "Ada",
"email": "YOUR_EMAIL",
"organization": "Example",
"message": "We need a monthly invoice."
}
200Inquiry stored.400A field was missing or too long.
/v1/payees/verify
POST Check that a payment address is ours
No key needed. Nothing is stored.
200Result.400Invalid request.
/v1/receipts/verify
POST Verify a verdict receipt
POST the receipt object. The response is {valid:true} when the Ed25519 signature matches the current public key, and {valid:false} otherwise. This call does not require an API key and does not store the receipt.
200Signature check.
/v1/keys
GET Read how to create a free API key
GET /v1/keys does not create a key. POST the same path with optional email, name and data_sharing (off unless true) and an optional pow_nonce (API callers can skip it: 2 keys per network and 300 per service per UTC day without it; the human form still needs it). The human form is /signup/.
200Signup instructions, including the proof-of-work challenge.
POST Create a free API key (alias of POST /v1/signup)
Identical to POST /v1/signup. Prefer /v1/signup in new code.
{
"name": "crew-judge",
"pow_nonce": "compute-me"
}
201Key created. The secret is in this response only.400Invalid signup or proof of work. When the proof is missing, the body includes a pow object.429Signup rate limit, daily cap, or email cap.
/v1/signup
GET Read how to create a free API key
GET /v1/signup does not create a key. POST the same path with optional email, name and data_sharing (off unless true) and an optional pow_nonce (API callers can skip it: 2 keys per network and 300 per service per UTC day without it; the human form still needs it). The human form is /signup/.
200Signup instructions, including the proof-of-work challenge.
POST Create a free API key (agent signup, proof of work optional)
Creates a free-tier key (10 calls per UTC day) with no human approval. Send an empty JSON body {} for a key without proof of work (2 per network and 300 per service per UTC day), or send pow_nonce (no daily cap beyond the signup limits) such that SHA-256 of the UTF-8 string screwtape-signup-v1:<current UTC YYYY-MM-DD>:<nonce> has 12 leading zero bits and the nonce matches ^[A-Za-z0-9_-]{8,64}$. Email and name are optional. A 400 for an invalid nonce includes a pow object describing the challenge. Returns 201 with api_key (shown once; only its SHA-256 hash is stored). Limits: 5 keys per IP per hour, 5 per IP per UTC day, 3 active keys per email when an email is sent. Same call as POST /v1/keys. Free; no key or payment needed.
{
"name": "crew-judge",
"pow_nonce": "compute-me"
}
201Key created. The secret is in this response only.400Invalid signup or proof of work. When the proof is missing, the body includes a pow object.429Signup rate limit, daily cap, or email cap.
/v1/keys/me
GET Show usage and credit balance for the current key
Returns metadata, usage and credit balance for the Bearer key. The secret is never returned. Call it to check remaining quota before a batch of judge or consensus calls. Requires a Bearer key; free.
200Key metadata.401API key was not recognized.
DELETE Delete the current key and all its data
Permanently deletes the key hash, daily counters, payment records, any retained judgments, shared samples and feedback for the Bearer key. Irreversible: only call it when the user asks to delete their key or data.
200Deleted.401API key was not recognized.
/v1/keys/me/data-sharing
GET Read the opt-in data-sharing setting for the current key
Data sharing is off by default. Returns enabled, updated_at, consent_at and consent_source (when and where sharing was last turned on: signup_checkbox or api), stored_samples (how many redacted samples are stored for this key now), and a policy object that says what is stored, how it is redacted, and for how long. Requires a Bearer key; free.
200Data-sharing setting.401API key was not recognized.
PATCH Turn opt-in data sharing on or off for the current key
Send {"enabled": true} to store a redacted sample of each later judge or consensus call made with this key, kept 90 days. Calls that send share: false are not stored. Send {"enabled": false} to stop and to delete every stored sample for this key at once; deleted_samples says how many. Redaction is automatic and rule based (emails, phone numbers, Luhn-checked card numbers, IBANs, SSN-like and RUT-like ids, API keys and tokens, long digit runs). It is not anonymisation and can miss personal data. There is no reward for turning it on. Only call it when the user asks. Requires a Bearer key; free.
{
"enabled": false
}
200Updated setting.400Body was not {enabled: boolean}.401API key was not recognized.
/v1/feedback
POST Say whether the verdict on one of your calls was right
Send receipt_id, or call_id (the request_id of the call), and verdict_correct. expected_verdict (pass or fail) and note (at most 300 characters) are optional. A key can only send feedback on its own calls; any other id returns 404. One feedback record per call: sending again replaces it (200), the first time returns 201. Stores ids, labels and the note after automatic redaction, never the judged text. Kept 90 days. Feedback is possible while the call's receipt is in this key's receipt log (retention_days 1, 30 or 90) or a shared sample for it exists. Free: it does not use a call. Limited to 30 requests per minute per key.
{
"receipt_id": "rcpt_example",
"verdict_correct": false,
"expected_verdict": "fail",
"note": "The output cites a figure the evidence does not contain."
}
200Feedback replaced.201Feedback stored.400Invalid body.401API key was not recognized.404No call with that id for this key.429More than 30 feedback requests in a minute for this key.
/v1/retention
GET List calls this key chose to retain
Returns the 20 newest judge and consensus calls made with retain: true by this key. Rows expire after the key's retention_days: 1 day by default, or 30, 90 or 365 days on a subscription plan. Calls without retain are never stored, so they never appear here. Requires a Bearer key.
200Retained rows.401API key was not recognized.
DELETE Delete every retained call for this key's account
Free. Deletes every retained call for the key's subscription account (all its keys), or for this key when it has no plan, and returns how many were deleted. Requires a Bearer key.
200Deleted.401API key was not recognized.
/v1/dedupe/fingerprints
DELETE Delete every duplicate-check fingerprint this key stored
Free. Deletes all keyed fingerprints the duplicate check stored for this key and returns how many were deleted. Deleting the key (DELETE /v1/keys/me) deletes them too. Requires a Bearer key.
200Deleted.401API key was not recognized.
/v1/retention/{id}
GET Replay one retained call with its receipt
Audit replay. Returns the stored request and result for one retained call, plus its signed receipt when the receipt log still holds it. Add ?verify=1 to re-check the receipt signature; verified is then true or false. Requires the Bearer key that created it.
idRetention id returned when retain was true.verify1 re-checks the receipt signature.
200The retained call.401API key was not recognized.404No such row for this key.
DELETE Delete one retained call
Deletes one retained judge or consensus call by its retention id (from retention.id in the original response or from GET /v1/retention). Requires the Bearer key that created it.
idRetention id returned when retain was true.
200Deleted.401API key was not recognized.404No such row for this key.
/a2a
GET Describe the A2A JSON-RPC endpoint
GET does not judge and does not require a payment. POST message/send maps to a judge verdict.
200Endpoint description.
POST A2A message/send
JSON-RPC method message/send, or the SendMessage alias. A data part with task and agent_output, or text parts, maps to POST /v1/judge. A successful result is an agent message with text and data parts.
{
"jsonrpc": "2.0",
"id": 1,
"method": "message/send",
"params": {
"message": {
"role": "user",
"parts": [
{
"kind": "data",
"data": {
"task": "State the crew size and launch site.",
"agent_output": "The crew size was 4. The mission launched from Cape Canaveral.",
"evidence": [
"The mission launched on 2024-03-01 from Cape Canaveral.",
"The crew size was 4."
],
"criteria": [
"crew size",
"Cape Canaveral"
]
}
}
]
}
}
}
200JSON-RPC result. The result is an agent message.400The JSON-RPC request could not be judged.429Rate limit exceeded.
/v1/message:send
POST A2A HTTP+JSON message:send
HTTP+JSON alias of POST /a2a message/send. Send {"message": { role, parts }}. A 200 response is { message }. A 402 is passed through unchanged. GET returns 405.
{
"message": {
"role": "user",
"parts": [
{
"kind": "data",
"data": {
"task": "State the crew size and launch site.",
"agent_output": "The crew size was 4. The mission launched from Cape Canaveral.",
"evidence": [
"The mission launched on 2024-03-01 from Cape Canaveral.",
"The crew size was 4."
],
"criteria": [
"crew size",
"Cape Canaveral"
]
}
}
]
}
}
200The agent message, unwrapped from JSON-RPC.405Method not allowed. POST only.
/mcp
POST MCP Streamable HTTP endpoint (judge, check_duplicate_invoice, consensus, get_api_key, publish_receipt, try_check)
JSON-RPC for server/discover, initialize, tools/list, and tools/call. server/discover is free and needs no session: it returns supportedVersions, capabilities, instructions, and serverInfo (MCP 2026-07-28 DiscoverResult). Tools are judge, check_duplicate_invoice, consensus, get_api_key, publish_receipt, and try_check (a free sample check on a fixed demo invoice, no key). A judge or consensus tools/call without payment returns HTTP 200 with result.isError true and structuredContent set to the PaymentRequirements. GET returns a 200 JSON info document (or 405 if the client asks for an SSE stream); HEAD returns 200. They do not return 402 and they do not open an SSE stream. POST server/discover, initialize, tools/list and ping stay unpaid. OPTIONS /mcp allows any Origin.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}
200JSON-RPC result. A judge or consensus tools/call without payment is HTTP 200 with result.isError true and structuredContent set to the PaymentRequirements. content[0].text is that same JSON. get_api_key does not require a payment.202Notification accepted.
/v1/trust-score
POST Seller trust score: is this paying agent risky
Seller trust score: check whether a paying agent looks abusive or risky before you accept payment. Scores velocity, failed or refused payments, dispute-like patterns, and new versus established history across the Screwtape.ai seller network. Returns a 0–1 trust score, allow/review/block, risk and reasons. Subject values are hashed with a global network HMAC; reporter contributions are weighted by how the reporter paid (per-call payment > prepaid > free) and capped per reporter. window and observations are mutually exclusive. Raw IPs, payer addresses and keys are never stored. $0.02 per call (shared free tier; no monthly plan).
{
"subject": {
"kind": "agent",
"value": "buyer-agent-001"
},
"window": {
"hours": 24,
"payment_ok": 12,
"payment_failed": 0,
"payment_refused": 0,
"dispute_open": 0,
"first_seen_hours_ago": 720
},
"agent_id": "seller-gate-001"
}
200Trust score, risk, allow/review/block and reasons400Invalid input
/v1/spend-books/export
GET Export agent spend books (QuickBooks CSV, Xero CSV or JSON)
Agent spend books: export what your API key spent on Screwtape.ai calls as bookkeeping rows, grouped by agent, seller, vendor, UTC day and product category. Every line includes seller and vendor. Amounts are the settled charge in micro-USD when known; paid rows without a stored amount are flagged amount unknown and never guessed. format=quickbooks or xero returns text/csv ready to import; format=json returns groups, amount_unknown, totals and reconcile. from..to may span at most 92 days. Requires a Bearer API key. Free, 30 exports per minute.
formatquickbooks, xero or json.fromInclusive ISO-8601 lower bound on issued_at.toInclusive ISO-8601 upper bound on issued_at. At most 92 days after from.
200CSV or JSON spend books export.400Bad format or date range.401API key was not recognized.413Too many receipts in the range.429Export rate limit.
/v1/payment-guard/rules
GET Read this key's spend rules and the effective rules
200Rules.400Invalid input, or no spend rules set yet.401API key missing or not recognized.429Rate limited.
PUT Set spend rules for this API key (free)
{
"max_per_call_usd": 1,
"daily_budget_usd": 20,
"allowed_domains": [
"seller.example"
]
}
200Saved rules.400Invalid input, or no spend rules set yet.401API key missing or not recognized.429Rate limited.
/v1/payment-guard/account-rules
GET Read the account default spend rules
200Rules.400Invalid input, or no spend rules set yet.401API key missing or not recognized.429Rate limited.
PUT Set the account default spend rules (free; key rules win)
{
"max_per_call_usd": 1,
"daily_budget_usd": 20,
"allowed_domains": [
"seller.example"
]
}
200Saved rules.400Invalid input, or no spend rules set yet.401API key missing or not recognized.429Rate limited.
/v1/payment-guard/authorize
POST Payment Guard: allow or block a payment intent under your spend rules
Payment Guard: enforce your own spend rules before an agent pays. Set rules once per API key (or an account default): max_per_call_usd, daily_budget_usd, period_budget_usd + period_hours, allowed_sellers, allowed_domains, max_calls_per_minute, max_calls_per_hour. Then send each payment intent to POST /v1/payment-guard/authorize: allow returns a short-lived Ed25519-signed clearance (not a payment signature) and reserves the amount against your budgets atomically; block returns HTTP 403 with reasons and nothing is reserved. POST /v1/payment-guard/proxy does the same check and, on allow, forwards your client-signed PAYMENT-SIGNATURE (or X-PAYMENT) to the seller once per event_id. Non-custodial: Screwtape.ai never holds funds and never accepts private keys, seeds or mnemonics. Requires a Bearer API key. authorize and proxy use one shared free-tier or prepaid call each ($0.005 equivalent); rules endpoints are free. Same event_id + body replays the decision without billing again.
{
"event_id": "pay-0001",
"agent_id": "agent-001",
"amount_usd": 0.05,
"domain": "seller.example"
}
200allow, with a signed clearance.400Invalid input, or no spend rules set yet.401API key missing or not recognized.403block, with reasons.409event_id reused with a different body.429Rate limited.
/v1/payment-guard/proxy
POST Payment Guard: check, then forward your client-signed payment to the seller once
Same check as authorize. On allow, forwards the request body and your client-signed PAYMENT-SIGNATURE (or X-PAYMENT) header to seller_url, once per event_id, and relays the seller's response (up to 1 MB). Authorization is never forwarded. If the seller cannot be reached, the reserved budget and the call are given back. Requires seller_url.
200Forwarded; the seller's status and body are relayed.400Invalid input, or no spend rules set yet.401API key missing or not recognized.403block, nothing forwarded.409event_id already processed; nothing forwarded.429Rate limited.502Seller unreachable or its response was too large.504Seller timed out.
/v1/account/byom
GET Get Bring-Your-Own-Model settings for this API key
Returns provider, model, key_last4 and on_error for this API key. The provider API key is never returned after save. Off unless BYOM_ENABLED is true. Deterministic checks still run; Screwtape.ai still bills per call.
200BYOM settings or configured:false401Unauthorized
PUT Set or rotate Bring-Your-Own-Model provider settings
Store an encrypted provider key (OpenAI, Anthropic, AWS Bedrock, or OpenAI-compatible base URL). Unknown models need custom:true. Default on_error is deny (fail closed for payment decisions). Provider keys are AES-GCM encrypted at rest and never logged.
{
"provider": "openai",
"model": "gpt-4o-mini",
"api_key": "sk-...",
"on_error": "deny"
}
200Saved settings with key_last4 only400Bedrock disabled (BYOM_BEDROCK_ENABLED)422Validation error (allowlist, SSRF, etc.)
DELETE Delete Bring-Your-Own-Model settings
200Deleted
/pricing.json
GET Machine pricing for agents
Agent-only package offers stay on this document and other agent surfaces; human HTML at /pricing/ does not list them. Always branded Screwtape.ai.
200Pricing document
Invoice decisions (decision_version 2)
Plan keys can ask POST /v1/judge (and POST /v1/duplicate) for an invoice decision instead of a pass or fail verdict. Send policy_id and decision_version 2. The policy must set rules.max_amount. Accounts created on or after 2026-12-23 get version 2 by default when they send a policy_id.
Send exactly one of invoice (structured fields), invoice_text (plain text) or agent_output. task is optional and defaults to "Check this invoice against the payment policy." Without decision_version 2, invoice, invoice_text and po return 400 invalid_request.
The response has decision (approve, needs_review, deny or retry), decision_source (rules, or rules+model when a model added triage), the rules that ran, review_id when a review was opened, and the usual reasons and receipt. deny and retry come from the rules alone and are not billed. approve and needs_review are billed as one normal call. needs_review opens a review for a person.
- invoice: vendor, invoice_number, po_number, currency (3 letters), issue_date (YYYY-MM-DD), line_items (description, qty, unit_price, amount), subtotal, tax, total. Amounts are numbers or decimal strings with up to 6 decimals. At most 2,000 line items; the whole body is at most 256 KB.
- po (optional): po_number, vendor, currency, total. Checked against the invoice.
curl -s https://screwtape.ai/v1/judge \
-H "Authorization: Bearer $SCREWTAPE_KEY" -H "Content-Type: application/json" \
-d '{"policy_id":"ap-default","decision_version":2,
"invoice":{"vendor":"Acme Ltd","invoice_number":"INV-1042","currency":"USD","issue_date":"2026-10-01",
"line_items":[{"description":"Support","qty":1,"unit_price":"1200.00","amount":"1200.00"}],
"subtotal":"1200.00","tax":"0","total":"1200.00"},
"po":{"po_number":"PO-77","vendor":"Acme Ltd","currency":"USD","total":"1200.00"}}'invoice_text: plain-text invoices
invoice_text is a string of at most 5,000 characters. The worker reads vendor, invoice number, currency, line items, subtotal, tax and total from it with fixed parsing rules. No model reads the text, and the text is not stored or signed: only its SHA-256 goes into the receipt. The response has extraction: "deterministic".
Longer text returns 413 with error.code payload_too_large and the message "invoice_text takes at most 5000 characters. Send larger invoices as structured invoice fields." For bigger invoices, send the structured invoice fields instead. They have no character limit (up to 2,000 line items and a 256 KB body) and are read exactly.
If the text does not reconcile (two different totals, line items that do not add up, or a missing vendor, currency or total), the decision is needs_review with error_type extraction_unreconciled. Text that cannot be read is never denied on that basis; a person reviews it. Text that reconciles goes through the policy like a structured invoice, so a total over max_amount is still denied.
curl -s https://screwtape.ai/v1/judge \
-H "Authorization: Bearer $SCREWTAPE_KEY" -H "Content-Type: application/json" \
-d '{"policy_id":"ap-default","decision_version":2,"invoice_text":"Acme Ltd\nInvoice INV-1042\nCurrency USD\nTotal 1200.00"}'Own model key (X-Model-Key)
On a needs_review decision, a policy with model_triage set asks a model for a short explanation. A model can never loosen a decision. You can have that triage run on your own model account by sending these headers with a decision_version 2 call that has a policy_id. Without both, X-Model-Key returns 400: "X-Model-Key works only with decision_version 2 and a policy_id."
Your key is used for that one request only. It is never stored, logged, signed or returned in a response. The receipt records only the provider host and the model id.
If your provider fails, times out (15 seconds) or returns something unusable, the decision stays the rules decision, needs_review, with decision_source rules. The call does not fall back to our model. An own-key call is billed as one normal call, the same as any approve or needs_review.
Own-key headers are not available over MCP. The MCP server ignores X-Model-* headers on every tool. Use the HTTP API.
- X-Model-Key (required for this feature): 8 to 512 printable characters.
- X-Model-Provider (optional): groq (default) or openai-compatible.
- X-Model-Base-URL: required for openai-compatible, and must be one of https://api.groq.com/openai/v1, https://api.openai.com/v1, https://api.together.xyz/v1, https://api.fireworks.ai/inference/v1, https://openrouter.ai/api/v1, https://api.mistral.ai/v1, https://api.deepseek.com/v1. groq uses https://api.groq.com/openai/v1.
- X-Model-Id (optional): 1 to 120 letters, digits, . _ : / or -. groq defaults to openai/gpt-oss-120b.
curl -s https://screwtape.ai/v1/judge \
-H "Authorization: Bearer $SCREWTAPE_KEY" -H "Content-Type: application/json" \
-H "X-Model-Key: $YOUR_GROQ_KEY" \
-d '{"policy_id":"ap-default","decision_version":2,"invoice":{...}}'Evidence and replay
Turn evidence on per policy with evidence: {"enabled": true, "retain_days": 90, "store_vendor_name": false}. retain_days is 1 to 400 (default 90). Each approve or needs_review then keeps one small record: the fields the rules read, the policy version and the rule results. It keeps no line descriptions, addresses or bank details, and the vendor is a keyed hash unless store_vendor_name is true. The record's SHA-256 is signed into the receipt as evidence_sha256. deny and retry keep no evidence.
Evidence counts toward the content history quota and is included in GET /v1/retention (export) and DELETE /v1/retention (erase). When the quota is full, evidence is skipped; the decision is never blocked.
POST /v1/receipts/{receipt_id}/replay re-runs the rules on the stored record. policy is original (the policy version used at the time, the default) or current. Optional document is the original body (for example {"invoice": {...}}) to prove it is the same document. The response has original, replayed, match, diffs, model_part ("recorded, not re-run" or "no model ran"), document_match and a signed replay_receipt. A model is never called again. Replay needs a plan key and is not billed.
DELETE /v1/receipts/{receipt_id}/evidence deletes the record and returns {"deleted": true}. The signed receipt is kept.
- 400 invalid_request: bad receipt id or body.
- 404 receipt_not_found, evidence_not_found (evidence was off, or the decision was deny or retry), policy_not_found.
- 410 evidence_deleted: deleted or expired; the receipt is kept.
- 409 evidence_tampered (record does not match the signed hash), document_mismatch, rules_version_unknown.
curl -s -X POST https://screwtape.ai/v1/receipts/$RECEIPT_ID/replay \
-H "Authorization: Bearer $SCREWTAPE_KEY" -H "Content-Type: application/json" \
-d '{"policy":"original"}'Audit export: how an auditor verifies receipts
Coverage: the receipt log holds only what the key's retention_days allows. The default is 1 day, 0 stores nothing, and free and pack keys keep at most 1 day, so export daily. Keys on a subscription plan keep receipts for the plan's retention period.
- Export with GET /v1/receipts/export?format=jsonl (or csv or json), from and to at most 92 days apart, limit up to 1000. Follow next_cursor (also in the X-Next-Cursor and Link rel="next" headers) until it is null. At most 30 exports per minute per key; they are free and do not use calls.
- Fetch /.well-known/screwtape-receipt-keys.json and pick the JWK whose kid matches the receipt. Retired keys stay listed with status retired and not_after; they only vouch for receipts issued up to not_after.
- Remove signature and expires_at. expires_at is export metadata and is not signed. In CSV, the receipt_json column is the signed receipt without expires_at.
- Build the canonical JSON: keys sorted, no whitespace, standard JSON numbers, absent fields left out.
- Verify the base64url-decoded 64-byte Ed25519 signature over the UTF-8 bytes of that JSON. Or POST the receipt without expires_at to /v1/receipts/verify.
Node:
// node verify.mjs receipts.jsonl (Node 18+, no packages)
import { readFileSync } from "node:fs";
import { createPublicKey, verify } from "node:crypto";
const doc = await (await fetch("https://screwtape.ai/.well-known/screwtape-receipt-keys.json")).json();
const canon = (v) => Array.isArray(v) ? `[${v.map(canon).join(",")}]`
: v && typeof v === "object" ? `{${Object.keys(v).sort().filter((k) => v[k] !== undefined).map((k) => `${JSON.stringify(k)}:${canon(v[k])}`).join(",")}}`
: JSON.stringify(v);
let bad = 0;
for (const line of readFileSync(process.argv[2], "utf8").split("\n").filter(Boolean)) {
const { signature, expires_at, ...fields } = JSON.parse(line);
const jwk = doc.keys.find((k) => k.kid === fields.kid && (!k.not_after || Date.parse(fields.issued_at) <= Date.parse(k.not_after)));
const key = jwk && createPublicKey({ key: { kty: "OKP", crv: "Ed25519", x: jwk.x }, format: "jwk" });
const ok = Boolean(key) && verify(null, Buffer.from(canon(fields), "utf8"), key, Buffer.from(signature, "base64url"));
if (!ok) bad += 1;
console.log(ok ? "ok " : "BAD", fields.receipt_id);
}
process.exit(bad ? 1 : 0);
Python:
# pip install cryptography; python3 verify.py receipts.jsonl
import base64, json, sys, urllib.request
from datetime import datetime
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
def b64(s): return base64.urlsafe_b64decode(s + "=" * (-len(s) % 4))
def when(s): return datetime.fromisoformat(s.replace("Z", "+00:00"))
def canon(v): return json.dumps(v, sort_keys=True, separators=(",", ":"), ensure_ascii=False)
url = "https://screwtape.ai/.well-known/screwtape-receipt-keys.json"
keys = json.load(urllib.request.urlopen(urllib.request.Request(url, headers={"User-Agent": "receipt-audit"})))["keys"]
bad = 0
for line in open(sys.argv[1], encoding="utf-8"):
if not line.strip(): continue
fields = json.loads(line); fields.pop("expires_at", None); sig = b64(fields.pop("signature"))
jwk = next((k for k in keys if k["kid"] == fields["kid"] and ("not_after" not in k or when(fields["issued_at"]) <= when(k["not_after"]))), None)
try:
Ed25519PublicKey.from_public_bytes(b64(jwk["x"])).verify(sig, canon(fields).encode("utf-8")); ok = True
except Exception: ok = False
bad += not ok
print("ok " if ok else "BAD", fields["receipt_id"])
sys.exit(1 if bad else 0)
Limitations
- How decisions are enforced. Screwtape.ai never holds your funds. Calls to the check tools (judge, consensus, duplicate, budget, trust score, and payment guard authorize) return a decision and a signed receipt; your agent has to check the result before it acts. The one place Screwtape.ai itself gates a payment is a payment sent through Payment Guard, which only goes ahead when your rules allow it. Card enforcement (when enabled) is decision-only at authorization time for your card program; shadow mode records what rules would decide but does not block toward the issuer. Screwtape.ai never holds card numbers.
- A receipt proves the recorded fields have not changed since Screwtape issued them, and that Screwtape made that decision or recorded that action at the stated time.
- A receipt does not prove that a payment was correct, that money moved, or that an outside action actually happened. Screwtape.ai advises and records; your agent must honor the result.
- Deterministic checks test only the rules and records you supply, such as the invoices already recorded for your key.
- Model verdicts can be wrong. Finance checks (duplicate, and any call with a duplicate or sum check) fail closed: if the primary model is unavailable the response is retry, not pass.
- Consensus measures similarity and risk signals between answers, not truth. Agreement is not proof of correctness.
- The benchmark is unfinished. No comparative accuracy or superiority is claimed; see /benchmark/ for the cases, method and current results.
