Documentation

Send the output. Get a verdict and a receipt.

AgentGate checks what an AI agent is about to say or do against 50 deterministic rules in 8 gates. Each call returns one of four verdicts and, unless you opt out, a signed receipt that anyone can verify. There is no model in the request path: the same request against the same ruleset always gives the same verdict.

engine 2.0.0 base URL https://agengate.com receipt format v1 Postman collection
On this page

Quickstart

Three steps: get a key, send the text your agent is about to output, and branch on the verdict. The API is plain HTTPS with JSON bodies. There is no SDK to install.

1 Get an API key

Create an account at /signup. Your key starts with ag_live_. The Free plan includes 10,000 validations a month and runs every rule. The samples below read the key from an environment variable called AGENTGATE_KEY.

2 Validate an output

Only agent_output is required.

curl https://agengate.com/v1/validate \
  -H "X-API-Key: $AGENTGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_output": "Hi Dana, the statement was sent to dana.reyes@gmail.com. Your loan application has been declined."
  }'

3 Read the response

The call returns 200 whatever the verdict. This is the response to the request above, trimmed to the parts you will use first. The full shape is under Validate.

200 OK · trimmed
{
  "id": "val_e5e7d308f2627cbc7d2be125",
  "status": "failed",
  "verdict": "review",
  "findings": [
    {
      "rule": "G7-DECISION-NO-REASON",
      "gate": "G7",
      "title": "Adverse decision without a reason",
      "fix": "State the principal reason, or hold the message for a human to complete.",
      "severity": "high",
      "action": "review",
      "confidence": "medium",
      "count": 1,
      "spans": [{ "start": 57, "end": 96, "preview": "You••••••••ed" }],
      …
    },
    { "rule": "G7-NO-RECOURSE", "action": "review", … },
    { "rule": "G3-PII-EMAIL", "action": "redact", "label": "EMAIL", … }
  ],
  "redacted_output": "Hi Dana, the statement was sent to [EMAIL]. Your loan application has been declined.",
  "receipt": {
    "verdict": "review",
    "evaluated": 50,
    "seq": 1,
    "hash": "sha256:ef18be8d…",
    "signature": { "alg": "Ed25519", "kid": "e4e62a477fbd2d86", "sig": "uqO41Lz7…" },
    …
  },
  "receipt_salt": "c943bd9faaf3a3b040c89da17132725e",
  …
}

Two rules in gate G7 held the message for a person, because it tells someone their application was declined without giving a reason or a way to appeal. One rule in G3 found an email address and masked it in redacted_output. The most severe action decides, so the verdict is review.

4 Branch on the verdict

Your code handles four cases, not 50 rules.

// send, holdForHuman and refuse are your own functions
function deliver(output, result) {
  switch (result.verdict) {
    case "allow":  return send(output);
    case "redact": return send(result.redacted_output);
    case "review": return holdForHuman(output, result);
    case "block":  return refuse(result);
  }
}

AgentGate returns a verdict; acting on it is your code's job. Decide in advance what your agent does when the call itself fails — a timeout, a 429, a 5xx — because that choice between failing open and failing closed cannot be made for you.

Authentication

Send your key in the X-API-Key header on every request to an authenticated endpoint.

X-API-Key: ag_live_…
  • A key is ag_live_ followed by 64 hexadecimal characters. An account has one key, and the key's plan sets its quota and rate limit.
  • A missing header returns 401 MISSING_API_KEY. An unknown or revoked key returns 401 INVALID_API_KEY.
  • Call the API from your server. By default the production API accepts cross-origin browser requests only from this site, so a key in front-end code would be exposed and would not work. The public receipt endpoints are the exception: they accept requests from any origin.
  • Every response carries X-Request-Id — your own value if you sent that header, a generated one if not — and X-API-Version: 1. Quote the request ID when you report a problem.
  • No endpoint issues a replacement key. DELETE /v1/auth/me revokes the key and closes the account with it. If a key leaks and you want to keep the account, write to info@pactum.uz.

Endpoints that need no key

EndpointReturns
GET /v1/healthLiveness: status, service, timestamp.
GET /v1/statusThe uptime summary behind the status page. A service the monitor has not checked yet is reported as "unknown" with a null uptime, not as operational.
GET /v1/rulesThe rule catalogue.
POST /v1/receipts/verify
GET /v1/receipts/:hash
GET /.well-known/agentgate-keys.json
Receipt verification and the signing key.
GET /v1/productsEvery product with its maturity label. See Other products.
GET /v1/billing/plansThe current price list. See Plans.

Account endpoints

The sign-up and sign-in pages use these; you can call them directly.

EndpointKeyWhat it does
POST /v1/auth/signupnoBody: email, password, optional company, optional marketing_consent (send true to receive the six getting-started emails; without it only the welcome email is sent). Returns 201 with api_key, plan and monthly_quota. A password needs at least 12 characters with an upper-case letter, a lower-case letter, a digit and a symbol. 409 ALREADY_REGISTERED if the address already has an account.
POST /v1/auth/loginnoBody: email, password. Returns api_key, plan and email, or 401 INVALID_CREDENTIALS.
POST /v1/auth/forgot-passwordnoBody: email. Answers 200 whether or not the address has an account. If it has one, a single-use reset link that is valid for 30 minutes is sent to it.
POST /v1/auth/reset-passwordnoBody: token, new_password. 400 INVALID_TOKEN if the link has expired or was used. The API key does not change.
GET /v1/auth/meyesYour email, plan and profile, plus usage for the current month: validations, quota, gatesRun, period and lastUsedAt.
PATCH /v1/auth/meyesBody: displayName and/or company, up to 120 characters each.
POST /v1/auth/change-passwordyesBody: old_password, new_password. The API key does not change.
DELETE /v1/auth/meyesRevokes the key and deactivates the account.

Validate

POST /v1/validate API key · any plan

Checks one piece of text against the rules of the gates that apply and returns a verdict, the findings behind it and, unless you opt out, a signed receipt. The call is synchronous. It returns 200 for every completed check: a block verdict is a result, not an HTTP error.

Request body

JSON, up to 1 MB.

FieldTypeDescription
agent_output requiredstringThe text to check. It must contain something other than whitespace and be no longer than 200,000 characters.
contextobjectDescribes the task: domain, task_type, tier, regulatory, ai_touching and metadata. It selects which gates run and adjusts a few rules. See Context.
gatesstring[]Gate IDs to run, for example ["G2", "G3"]. It narrows the gates that context selects and can never add one. Not case-sensitive. An ID that does not exist, or a selection that leaves no gate to run, is refused with 422. An empty array is the same as leaving the field out.
evidencebooleanDefault true. Set false to skip the receipt.
policyobjectRule settings for this request: disable (rule or gate IDs to skip) and actions (rule ID → action). See Policy.
modestringEchoed back in the response; it does not change what is checked. One of output_validation (the default), workflow_validation, policy_review or fairness_audit. Any other value is replaced by the default.

A field of the wrong type is rejected with 422 INVALID_INPUT, and detail names the field. A request that uses every option:

request body
{
  "agent_output": "Done. I have transferred $50,000 to the account ending 4829.",
  "context": {
    "domain": "banking",
    "task_type": "payment",
    "tier": "T3",
    "regulatory": true,
    "ai_touching": true,
    "metadata": { "approved_by": "j.smith@example.com" }
  },
  "gates": ["G1", "G2", "G3", "G4"],
  "evidence": true,
  "policy": {
    "disable": ["G2-INTERNAL-HOST"],
    "actions": { "G3-PII-PHONE": "flag" }
  }
}

Response

FieldTypeDescription
idstringThe validation ID: val_ and 24 hexadecimal characters.
statusstringpassed, warning or failed: can the text go out exactly as written? See Verdicts.
verdictstringallow, redact, review or block: what to do.
gatesobject[]One entry for each gate that ran: gate, name, status and checks. A check is one rule — id, name, passed — and a failed check also carries evidence, a short string such as 1 match → redact. durationMs on a gate is always 0: the gates are evaluated in one pass and are not timed separately.
findingsobject[]One entry for each rule that matched. See Findings.
violationsstring[]A readable line for each finding whose action is redact, review or block.
recommendationsstring[]The fix text of each finding, without duplicates.
redacted_outputstringThe text with every redactable match replaced by a token such as [EMAIL]. A card number keeps its last four digits: [CARD •••• 1111]. Present only when something redactable was found. Returned live and never stored.
receiptobjectThe signed record of this check. See Receipts. Absent with evidence: false.
receipt_saltstring32 hexadecimal characters that open the receipt's commitment to your text. Returned once, by the call that issued the receipt, and not stored. Keep it with the receipt if you may need to prove which text the receipt is about.
evidenceobjectA flat view of the same receipt: packageHash (the receipt hash without its prefix), records (one per evaluated rule: controlId, hash, type, timestamp, where hash is that rule's leaf under checks_root) and attestation (the receipt signature). Absent with evidence: false.
contextobjectThe context you sent, without metadata.
engineobjectversion and ruleset, the hash that identifies the exact rules that ran.
validatedAtstringISO 8601 time of the check.
durationMsnumberServer-side time for the whole call, in milliseconds.
modestringThe mode you sent, or the default.

Size limit

An agent_output longer than 200,000 characters is rejected with 413 INPUT_TOO_LARGE. Nothing is evaluated and nothing is truncated.

413 Payload Too Large
{
  "type": "https://agengate.com/errors/input-too-large",
  "title": "INPUT_TOO_LARGE",
  "status": 413,
  "detail": "agent_output is 200001 characters; the limit is 200000. Split it and validate each part.",
  "limit": 200000
}

Length is counted the way JavaScript counts it, in UTF-16 code units, so most emoji count as two. The current limit is also published as engine.max_input_chars by GET /v1/rules. To check a longer text, split it and validate each part — and remember that each call is judged on its own, so a rule that looks for a statement and its safeguard needs both in the same part.

Skipping the receipt

With "evidence": false the rules run as usual and the verdict, findings and redacted_output are the same. What changes:

  • No receipt is built, signed or added to your ledger chain. receipt, receipt_salt and evidence are missing from the response.
  • The result is still held in the recent list, still counts towards your quota and is still reported by webhooks, with receiptHash: null.
  • The result itself lives only in memory. After a restart of the service it can no longer be retrieved, and it never appears in audit packages.

Use it for dry runs and tests where you do not want the chain to grow.

Repeated requests

If you send exactly the same request again — same key, text, context including metadata, gates, policy and evidence flag — while the first result is still held in memory, you get the first result back: the same id, the same receipt, and no new entry in the ledger. receipt_salt is not returned a second time. The repeat still counts towards your quota and still triggers webhooks.

Verdicts

Every finding carries an action. The verdict is the most severe action among the findings, in the order flag < redact < review < block. status answers a narrower question: can the text go out exactly as written?

VerdictStatusWhenWhat to do
allowpassedNo rule matched.Send the output.
allowwarningOnly advisory findings, with action flag.Send the output. The advisories are in findings: log them or show them to whoever owns the agent.
redactfailedThe most severe action among the findings is redact: a value that can be masked, such as an email address or a card number.Send redacted_output instead of the original.
reviewfailedAt least one finding needs a person: a decision, a promise, an action.Hold the output until someone has looked at it.
blockfailedAt least one finding must not leave: a credential, a guaranteed return, an agent claiming to be human.Do not send it. Regenerate or escalate.
  • failed does not mean the request failed. It means the text must not ship unchanged, which is why a redact verdict is failed too.
  • redacted_output comes back whenever a redactable value was found, also under review and block. Under those verdicts masking is not enough: the other findings still stand.
  • Each entry in gates has its own status, worked out the same way from that gate's findings.

After a review verdict

A review verdict asks for a human decision. AgentGate does not run the review for you. There are three ways to close one:

  1. Fix the text and validate again. In the quickstart example, adding the reason for the decision and a way to appeal clears both G7 findings. Only the email address is left, and the verdict drops to redact.
  2. Have a person approve, then validate again with the approval in context.metadata: approved_by for held actions and promises, human_reviewed for automated decisions. See Context.
  3. Record the exception with an override. It documents who accepted the finding and why. It does not change the verdict.

Findings

A finding is one rule that matched. findings is sorted with the most severe action first, then by severity, then by rule ID.

one finding
{
  "rule": "G3-PII-EMAIL",
  "gate": "G3",
  "title": "Personal email address",
  "summary": "An individual's email address (role mailboxes such as support@ are ignored).",
  "fix": "Use the redacted output, or reference the customer by an internal ID.",
  "severity": "high",
  "action": "redact",
  "confidence": "high",
  "label": "EMAIL",
  "count": 1,
  "citations": [
    { "framework": "GDPR", "ref": "Art. 5(1)(c)", "note": "Data minimisation" },
    { "framework": "GDPR", "ref": "Art. 5(1)(f)", "note": "Integrity and confidentiality" },
    { "framework": "CCPA", "ref": "§1798.100(c)", "note": "Proportionate use" }
  ],
  "spans": [{ "start": 35, "end": 55, "preview": "dan••••••••om" }]
}
FieldTypeDescription
rulestringThe rule ID. It starts with the gate, as in G3-PII-EMAIL.
gatestringThe gate the rule belongs to.
title
summary
fix
stringWhat the rule looks for and what to do about a match, as written in the catalogue.
severitystringlow, medium, high or critical.
actionstringflag, redact, review or block — the action applied on this request, after any policy setting or approval.
confidencestringhigh or medium: how literal the rule is. See below.
labelstring or nullThe redaction token for a rule whose matches can be masked, such as EMAIL. null for the rest.
countnumberHow many matches there are in total.
citationsobject[]The provisions the rule is mapped to: framework, ref and usually a note.
spansobject[]Where the matches are: start, end and a masked preview. The first 50 are listed. redacted_output masks every match, listed or not.
spans_truncatedbooleanPresent, and true, when spans lists fewer matches than count.
notestringPresent when the action differs from the rule's own for a reason worth stating: approved_by downgraded the finding, or there were too many matches to mask and the output was blocked instead.

Spans and previews

start and end are positions in agent_output, counted in UTF-16 code units as JavaScript string indices are, with end exclusive: agent_output.slice(start, end) is the match. The response never repeats a matched value in full. preview is masked: a value of four characters or fewer is masked completely, and a longer one keeps its first two characters and its last one — three and two for values of twelve characters or more — with at most eight bullets in between. Findings about something that is missing, or about a total, have no spans.

Confidence

high marks a literal rule. It looks for a specific format, sometimes with a checksum — a card number has to pass the Luhn check, an IBAN needs a valid length and check digits — or for an explicit phrase. medium marks a heuristic rule: the pattern is looser, so it fires on harmless text more often. Either kind can miss a problem that is worded differently. Confidence belongs to the rule. It is not a score for the individual match.

Citations are mappings, not guarantees

Rules match patterns. They do not read meaning, weigh context or know your legal position. A citation says which obligation a check supports: mapped to means exactly that. It does not mean that a finding is a breach, or that the absence of findings is compliance. Treat a receipt as evidence that a check ran, not as a compliance certificate.

Kinds of rule

The catalogue gives each rule a kind:

  • pattern — a format or a phrase is present.
  • trigger-without-safeguard — a trigger phrase is present and no safeguard phrase appears anywhere in the same output. An adverse decision with no reason is one example.
  • required-statement — a statement that should be there is missing. The only one today is the opt-in AI disclosure.
  • aggregate — several other rules together reach a total. The only one today blocks an output that contains five or more personal identifiers.

Context

context is optional, and so is every field in it. It does two things: tier, regulatory, ai_touching and domain choose the gates, and four keys in metadata adjust individual rules.

FieldTypeEffect
tier"T1" to "T4"Selects the gates, as in the table below. Any other value is a 422.
regulatorybooleanWith tier T2, switches on G6 and G7.
ai_touchingbooleanWith tier T2, switches on G8.
domainstringFree text, recorded in the receipt. Its only effect on the check: with tier T2, the values banking, finance, accounting, insurance, payments and fintech (in any letter case) switch on G6 and G7.
task_typestringFree text, recorded in the receipt. No rule reads it.
metadataobjectFree-form. The engine reads the four keys described below and ignores the rest. It is not stored, not echoed in the response and not written to the receipt.

Which gates run

tierGates
not setAll 8.
T1G1, G2 and G3.
T2G1 to G5. G6 and G7 as well when regulatory is true or domain is one of the finance domains. G8 as well when ai_touching is true.
T3, T4All 8.

What each gate covers is listed under Rules and gates. The top-level gates field then narrows the set: only gates that are both selected by the context and named in gates run.

A request that would check nothing is refused. An allow has to mean that rules ran and found nothing. If the gates you name do not exist (G99), or have nothing in common with the gates the context selects (["G7"] together with "tier": "T1"), or policy.disable switches off every rule that would have run, the answer is 422 INVALID_INPUT with a reason of UNKNOWN_GATE, NO_GATES or NO_RULES. Nothing is metered and no receipt is written.

Metadata the engine reads

KeyValueEffect
approved_byanything truthy, usually a name or an IDSays a person has already approved the action. The rules that would hold such an output for review — G4-MONEY-MOVEMENT, G4-IRREVERSIBLE, G4-PRIVILEGE-CHANGE, G4-EXTERNAL-SHARE and G5-BINDING-COMMITMENT — are downgraded to the advisory action flag, and each such finding gets a note.
amount_thresholda number above zeroThe amount, in approximate US dollars, from which G4-MONEY-MOVEMENT fires. The default is 1000.
human_reviewedtrueSays a person has confirmed the decision. Switches off G8-AUTOMATED-DECISION.
require_ai_disclosuretrueSwitches on G8-AI-DISCLOSURE, which is off by default: the output is held for review unless it says that it comes from an AI system.
  • human_reviewed and require_ai_disclosure must be the boolean true. The string "true" is ignored.
  • These keys act on rules in G4, G5 and G8. If the tier or the gates field leaves the gate out, the rule does not run and the key has no effect.
  • Metadata is taken as sent. AgentGate cannot know whether approved_by names a real approver. The value is not stored and is not in the receipt — the receipt's context holds only domain, task_type, tier, regulatory and ai_touching — so keep your own record of who approved what. The downgraded finding stays on the receipt with the action flag.
  • Amounts in other currencies are converted with fixed rates built into the engine, not market rates: euros and pounds count one for one with dollars. Treat the threshold as approximate.
  • An explicit policy.actions entry for a rule takes precedence over approved_by.

Without approved_by, the request below gets the verdict review from G4-MONEY-MOVEMENT. With it, the transfer is recorded but not held:

request body
{
  "agent_output": "Done. I have transferred $50,000 to the account ending 4829.",
  "context": {
    "metadata": { "approved_by": "j.smith@example.com" }
  }
}
200 OK · trimmed
{
  "status": "warning",
  "verdict": "allow",
  "findings": [
    {
      "rule": "G4-MONEY-MOVEMENT",
      "action": "flag",
      "severity": "high",
      "count": 1,
      "spans": [{ "start": 25, "end": 32, "preview": "$5••••0" }],
      "note": "approved_by present — recorded, not held",
      …
    }
  ],
  …
}

Policy

policy changes how rules behave for one request. Nothing is stored on your account: send it with every call that needs it.

FieldTypeEffect
policy.disablestring[]Rule IDs and gate IDs to skip. A disabled rule is not evaluated: it is absent from gates[].checks and is not counted in the receipt's evaluated. A gate ID disables every rule in that gate.
policy.actionsobjectRule ID → flag, redact, review or block. Replaces the rule's action for this request, in either direction. Any other value is a 422.
request body
{
  "agent_output": "…",
  "policy": {
    "disable": ["G7-LEGAL-CITATION", "G6"],
    "actions": {
      "G3-PII-PHONE": "flag",
      "G2-INTERNAL-HOST": "block"
    }
  }
}

This request skips the legal-citation advisory and the whole of G6, lets phone numbers through with an advisory instead of masking them, and blocks any output that mentions an internal network address.

  • An ID that is not in the catalogue is refused. A misspelt rule or gate ID in disable or actions returns 422 INVALID_INPUT with "reason": "UNKNOWN_RULE", so a typo cannot quietly leave a rule on. IDs are not case-sensitive.
  • A disabled gate still appears in gates, with no checks and the status passed.
  • redact is only for redactable rules — those with "redactable": true in the catalogue. Setting it on any other rule is refused with 422 and "reason": "NOT_REDACTABLE": there is no value to mask, so the verdict would promise a safe copy that does not exist.
  • The receipt shows what you changed. The IDs you disabled are listed, as sent, in the receipt's policy.disabled. Action changes are not listed separately, but every finding in the receipt carries the action that was applied, and anyone can compare it with the rule's default in the public catalogue.
  • Downgrading a block rule is allowed. It is your decision, and it is on the record.

Receipts

A receipt is the record of one validation: which ruleset ran, on a text of what length, what it found and what the verdict was. It holds none of the text — no output, no matched value and no plain hash of either. The receipts of one API key form a chain, and each one is signed with the service's Ed25519 key.

receipt · hashes shortened
{
  "v": 1,
  "id": "val_e5e7d308f2627cbc7d2be125",
  "issued_at": "2026-11-09T22:32:22.111Z",
  "issuer": "agengate.com",
  "engine": "agentgate-policy/2.0.0",
  "ruleset": "sha256:455c9a6c…",
  "subject": { "commitment": "sha256:3b584c0f…", "chars": 97 },
  "context": {},
  "gates": ["G1", "G2", "G3", "G4", "G5", "G6", "G7", "G8"],
  "evaluated": 50,
  "findings": [
    { "rule": "G7-DECISION-NO-REASON", "action": "review", "severity": "high", "count": 1 },
    { "rule": "G7-NO-RECOURSE", "action": "review", "severity": "high", "count": 1 },
    { "rule": "G3-PII-EMAIL", "action": "redact", "severity": "high", "count": 1 }
  ],
  "checks_root": "sha256:1bc486f3…",
  "verdict": "review",
  "status": "failed",
  "seq": 1,
  "prev": "sha256:00000000…",
  "hash": "sha256:ef18be8d…",
  "signature": {
    "alg": "Ed25519",
    "kid": "e4e62a477fbd2d86",
    "sig": "uqO41Lz7E00kckJc…"
  }
}
FieldMeaning
vReceipt format version.
idThe validation ID.
issued_atWhen the receipt was issued, by the issuer's clock.
issuerWho issued it.
engineThe engine and its version.
rulesetA hash that identifies the exact rules that ran.
subject.commitmentA salted hash of the text that was checked.
subject.charsThe length of that text.
contextdomain, task_type, tier, regulatory and ai_touching, where you sent them. Never metadata.
gatesThe IDs of the gates that ran.
evaluatedHow many rules were evaluated.
findingsFor each rule that matched: rule, action, severity and count. No spans and no previews.
checks_rootOne hash over the result of every evaluated rule.
verdict, statusAs in the response.
seqThe receipt's position in your key's chain, starting at 1.
prevThe hash of the receipt before it. For the first receipt: sha256: followed by 64 zeros.
policy.disabledThe IDs from policy.disable, sorted. Present only when you sent some.
hashThe hash of everything above.
signaturealg (always Ed25519), kid (which key) and sig.

Canonical form

Every hash is taken over canonical JSON as defined by RFC 8785: object keys sorted, no whitespace, strings and numbers written the way ECMAScript writes them. A receipt contains only strings, integers, booleans, arrays and objects, so any serialiser that sorts keys at every level and adds no whitespace reproduces it. In Python that is json.dumps(body, sort_keys=True, separators=(",", ":"), ensure_ascii=False).

How each value is computed

hash
Remove hash and signature from the receipt, serialise what is left in canonical form, take the SHA-256 of its UTF-8 bytes and write it as sha256: plus lower-case hex.
checks_root
For each evaluated rule, in catalogue order, compute a leaf: the SHA-256, in hex, of the canonical form of {"count": n, "result": "pass" or "fail", "rule": id}. A rule that is not in findings passed with a count of 0. Join the leaf hex strings with nothing between them and hash the result. The evaluated rules are the rules of the gates in gates, minus anything in policy.disabled. The validate response hands you the leaves as evidence.records[].hash.
subject.commitment
The SHA-256 of the salt, a line feed and the output, as UTF-8: sha256(receipt_salt + "\n" + agent_output). The salt is 16 random bytes written as 32 hex characters. Without it the commitment cannot be used to test guesses about the text. With it, and the original text, anyone can confirm that the receipt is about exactly that text.
ruleset
The SHA-256 of the canonical form of the engine version and, for every rule, its ID, gate, default action, severity and pattern sources. GET /v1/rules reports the hash of the ruleset that is running now. To recompute it yourself, load the engine file this site serves at /assets/policy-engine.js — the file the API runs — and call its rulesetHash(), which returns the hex without the sha256: prefix.
signature.sig
An Ed25519 signature over the UTF-8 bytes of the hash string, the sha256: prefix included, in unpadded base64url. kid is the first 16 hex characters of the SHA-256 of the raw 32-byte public key.

Recompute the hash before you trust the signature. The signature covers only the hash string. A receipt whose body has been edited still carries a signature that verifies against its untouched hash field — the edit shows up only when you recompute the hash from the body.

The chain

There is one chain for each API key. seq starts at 1 and goes up by one with every receipt, and prev is the hash of the receipt before. Validations with evidence: false and repeats of an identical request add nothing to the chain. If the service cannot sign, a receipt is still chained but has no signature; the verification endpoint reports that as absent and does not call the receipt valid.

What a receipt shows, and what it does not

It shows

  • That the holder of the signing key evaluated a text of subject.chars characters under the ruleset in ruleset, and reached this verdict with these findings.
  • With the output and its receipt_salt: that the text was exactly that output.
  • With the ledger: that the receipt holds position seq in its chain, directly after prev.

It does not show

  • That the text was true, appropriate or lawful.
  • That the text, or its redacted version, is what was sent afterwards.
  • That the system which produced it complies with anything.
  • Who approved a held action: approved_by is not in the receipt.
  • An independent time. issued_at is the issuer's own clock and the ledger is run by the issuer; no third-party timestamp is involved.

Verifying receipts

Three questions can be asked of any receipt, and none of them needs an API key. Is it intact? Recompute its hash. Did AgentGate issue it? Check the signature against the published key. Is it in the ledger? Look the hash up.

In the browser

Paste a receipt into /verify. The hash, the checks root and the signature are checked on your device, and the server is asked one thing: whether the hash is in the ledger. If you also hold the output and its salt, the page checks the commitment locally. A browser without Ed25519 support sends the receipt to the server to have the signature checked; a receipt contains no text.

On the server

POST /v1/receipts/verify no key

Send receipt, and optionally output together with salt to have the commitment checked as well.

request
curl https://agengate.com/v1/receipts/verify \
  -H "Content-Type: application/json" \
  -d '{ "receipt": { "v": 1, "id": "val_…", "hash": "sha256:…", "signature": { … }, … } }'
200 OK
{
  "valid": true,
  "hash": {
    "ok": true,
    "expected": "sha256:ef18be8d…",
    "actual": "sha256:ef18be8d…"
  },
  "signature": "valid",
  "anchored": true,
  "anchor": { "seq": 1, "issued_at": "2026-11-09T22:32:22.111Z" },
  "checks_root": { "ok": true, "reason": null },
  "commitment": null,
  "ruleset": {
    "receipt": "sha256:455c9a6c…",
    "current": "sha256:455c9a6c…"
  }
}
FieldMeaning
validtrue only when the hash recomputes, the signature is valid, the receipt is anchored, the checks root did not fail and the commitment, if you asked for it, matched.
hashok, plus expected (the hash in the receipt) and actual (the hash of its body).
signaturevalid, invalid, absent or unknown-key — signed with a key this service does not hold now.
anchored, anchorWhether the hash is in the ledger at the seq the receipt states, and if so its seq and issued_at.
checks_rootok is true or false, or null when the root could not be checked. reason says why: ruleset-mismatch (the receipt was issued under a ruleset other than the one running now, so it cannot be re-derived here), evaluated-count-mismatch, or not-checked (the hash already failed).
commitmenttrue or false; null when you sent no output and salt.
rulesetThe receipt's ruleset hash and the current one.

The request is not stored. A commitment check does send your output to the server, though. If the text should not leave your side, check the commitment yourself: it is one SHA-256.

Ledger lookup

GET /v1/receipts/:hash no key

Is a receipt with this hash in the ledger? The hash may be written with or without the sha256: prefix. The answer gives a position and a time, never a customer or any content.

200 OK
{ "anchored": true, "seq": 1, "issued_at": "2026-11-09T22:32:22.111Z" }

An unknown hash returns 404 NOT_FOUND with "anchored": false in the body.

The signing key

GET /.well-known/agentgate-keys.json no key

The Ed25519 public key, as a JWK set. Match kid against the receipt's signature.kid. The response may be cached for an hour.

200 OK · from a test instance
{
  "keys": [
    {
      "kty": "OKP",
      "crv": "Ed25519",
      "alg": "Ed25519",
      "use": "sig",
      "kid": "e4e62a477fbd2d86",
      "x": "IR8KFCKTznW524WL…"
    }
  ]
}

These three endpoints and GET /v1/rules accept requests from any origin. Together they share a limit of 60 requests a minute for each IP address.

Your whole chain

GET /v1/ledger/verify API key · any plan

Walks your key's chain and checks every receipt: the hash matches the body, seq has no gap, prev links to the receipt before, and the signature, where there is one, verifies. Add ?from= and ?to= (ISO 8601) to check a window; the first receipt in the window is then taken as the starting point.

200 OK · hashes shortened
{
  "ok": true,
  "entries": 32,
  "first": { "seq": 1, "hash": "sha256:ef18be8d…" },
  "last": { "seq": 32, "hash": "sha256:efe9702a…" },
  "signatures": { "valid": 32, "invalid": 0, "absent": 0, "unknown-key": 0 },
  "head": { "seq": 32, "hash": "sha256:efe9702a…" },
  "verifiedAt": "2026-11-09T22:32:22.256Z"
}

When ok is false, brokenAt names the first problem: its seq, its id and a reason — hash-mismatch, sequence-gap, broken-link, bad-genesis, bad-signature or unparseable-entry. head is the newest receipt of the chain.

Offline, in Node

The checks need nothing beyond SHA-256 and Ed25519. Save a receipt as receipt.json and run this as an ES module. It uses the network twice, for the public key and for the rule catalogue; save those two responses and it runs with no network at all.

verify.mjs
import { createHash, createPublicKey, verify } from "node:crypto";
import { readFileSync } from "node:fs";

const ORIGIN = "https://agengate.com";
const receipt = JSON.parse(readFileSync("receipt.json", "utf8"));
const sha256 = (s) => createHash("sha256").update(s, "utf8").digest("hex");

// RFC 8785 canonical JSON: keys sorted, no whitespace
const canon = (v) =>
  Array.isArray(v) ? "[" + v.map(canon).join(",") + "]"
  : v && typeof v === "object"
    ? "{" + Object.keys(v).sort().map((k) => JSON.stringify(k) + ":" + canon(v[k])).join(",") + "}"
    : JSON.stringify(v);

// 1. Hash: the receipt without `hash` and `signature`
const { hash, signature, ...body } = receipt;
console.log("hash       ", hash === "sha256:" + sha256(canon(body)));

// 2. Signature: Ed25519 over the bytes of the `hash` string
const jwks = await (await fetch(ORIGIN + "/.well-known/agentgate-keys.json")).json();
const jwk = jwks.keys.find((k) => k.kid === signature?.kid);
console.log("signature  ", Boolean(jwk) && verify(null, Buffer.from(hash, "utf8"),
  createPublicKey({ key: jwk, format: "jwk" }), Buffer.from(signature.sig, "base64url")));

// 3. Checks root: every evaluated rule passed unless it is listed in `findings`
const catalogue = await (await fetch(ORIGIN + "/v1/rules")).json();
const off = new Set(receipt.policy?.disabled ?? []);
const failed = new Map(receipt.findings.map((f) => [f.rule, f.count]));
const leaves = catalogue.rules
  .filter((r) => receipt.gates.includes(r.gate) && !off.has(r.id) && !off.has(r.gate))
  .map((r) => sha256(canon({ rule: r.id, result: failed.has(r.id) ? "fail" : "pass", count: failed.get(r.id) ?? 0 })));
console.log("checks root", catalogue.ruleset !== receipt.ruleset
  ? "issued under another ruleset: cannot be re-derived"
  : leaves.length === receipt.evaluated && receipt.checks_root === "sha256:" + sha256(leaves.join("")));

// 4. Commitment: only if you hold the output and the salt that came with it
const [output, salt] = [process.env.OUTPUT, process.env.SALT];
if (output && salt) console.log("commitment ", receipt.subject.commitment === "sha256:" + sha256(salt + "\n" + output));

The script does not ask the ledger whether the receipt is anchored. That takes one request to GET /v1/receipts/:hash.

Overrides

An override records that a person accepted a finding on a specific validation: who, when and why. Use it for the exception a rule cannot see — the reason was sent by letter, the customer asked for the account to be closed.

An override is a record, not a switch. It does not change the validation, its verdict or its receipt, and the engine does not look at overrides when it checks later requests. If the output should go out, your system sends it. The override is the note in the file that says who decided.

EndpointWhat it does
POST /v1/overridesFiles a request. Body: validation_id, gate_id and justification of at least 10 characters. The validation must be one of yours, must have ended with the verdict review or block, and the gate must have a finding on it. Returns 201 with the record in the status pending.
POST /v1/overrides/:id/reviewDecides it. Body: decision (approved or rejected), reviewer_email and an optional note. A request can be reviewed once: after that, and for an unknown ID, the answer is 404. A request that expired before anyone reviewed it answers 409 OVERRIDE_EXPIRED.
GET /v1/overridesLists your overrides, newest first. Query: status (pending, approved, rejected or expired), validation_id, limit (default 50, at most 200).
GET /v1/overrides/:idReturns one.

All four need an API key and are available on every plan.

file a request
curl https://agengate.com/v1/overrides \
  -H "X-API-Key: $AGENTGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "validation_id": "val_7772995905ef48b1398ffd38",
    "gate_id": "G7",
    "justification": "Reason is sent in a separate letter by the credit officer."
  }'
review it
curl https://agengate.com/v1/overrides/ovr_7e702d9c38ea43d1/review \
  -H "X-API-Key: $AGENTGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "decision": "approved",
    "reviewer_email": "risk.lead@example.com",
    "note": "Confirmed with the branch."
  }'
200 OK · shortened
{
  "override": {
    "id": "ovr_7e702d9c38ea43d1",
    "validationId": "val_7772995905ef48b1398ffd38",
    "gateId": "G7",
    "justification": "Reason is sent in a separate letter by the credit officer.",
    "reviewerEmail": "risk.lead@example.com",
    "status": "approved",
    "createdAt": "2026-11-09T22:48:36.411Z",
    "reviewedAt": "2026-11-09T22:48:36.414Z",
    "reviewerNote": "Confirmed with the branch.",
    "expiresAt": "2027-02-07T22:48:36.411Z"
  }
}
  • A request is refused when there is nothing to override: 404 if the validation is unknown or belongs to another key, 409 VALIDATION_NOT_HELD if its verdict was allow or redact, 409 GATE_NOT_HELD if the gate has no finding on it, and 422 for a gate ID that does not exist.
  • The reviewer is whoever your system says it is. reviewer_email is recorded as sent, and anyone who holds the API key can file a request and review it. Put your own access control in front of the review call.
  • expiresAt is 90 days after createdAt. A request still pending after that date has the status expired, can be listed with ?status=expired, and can no longer be approved or rejected: file a new one.
  • An override is not part of the receipt chain and is not signed. It is a stored record that we could, in principle, alter; the receipt of the validation it refers to is what can be verified independently. Records no longer carry the hash and previousHash fields that earlier responses showed: nothing checked them.
  • Filing and reviewing emit webhook events.

Webhooks

A webhook posts a small JSON event to your URL when a validation finishes or an override changes. Webhook endpoints need the Developer plan or above.

EndpointWhat it does
POST /v1/webhooksRegisters a URL. Body: url and an optional events array. Returns 201 with id, url, events and secret.
GET /v1/webhooksLists your webhooks: id, url, events, active, lastDeliveryAt.
DELETE /v1/webhooks/:idRemoves one.
GET /v1/webhooks/:id/deliveriesRecent deliveries for one webhook, with the payload, the HTTP status, the number of attempts and any error. Query: limit (default 20, at most 100).
GET /v1/webhooks/statstotalWebhooks, activeWebhooks, totalDeliveries and successRate, a percentage.

Set one up

request
curl https://agengate.com/v1/webhooks \
  -H "X-API-Key: $AGENTGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/hooks/agentgate",
    "events": ["validation.failed", "override.approved"]
  }'
201 Created
{
  "webhook": {
    "id": "wh_02451b9845834bdf",
    "url": "https://example.com/hooks/agentgate",
    "events": ["validation.failed", "override.approved"],
    "secret": "whsec_…"
  }
}
  • The secret is shown in this response and nowhere else. Store it: you need it to verify signatures.
  • The URL must be http or https — https only in production — and its host must resolve to public addresses only: loopback, private, link-local, carrier-grade NAT and cloud-metadata addresses are refused, in any spelling. The name is resolved when you register and again before every delivery, and a delivery connects to the address that was checked. A URL that breaks the rules is refused with 422 INVALID_INPUT.
  • Leave events out and the webhook receives the two validation events.
  • An event name that is not in the table below is refused with 422 INVALID_INPUT; the response lists the valid names.

Events

EventSent whendata
validation.completedA validation ends with the status passed or warning.validationId, status, verdict, gates (how many ran), violations (how many), receiptHash (null without a receipt), durationMs
validation.failedA validation ends with the status failed: the verdict is redact, review or block.
override.requestedAn override is filed.overrideId, validationId, gateId
override.approved
override.rejected
An override is reviewed.overrideId, decision, reviewerEmail, validationId, gateId

These five are the events the API sends today. No event contains output text.

request body sent to your URL
{
  "id": "evt_44ccc7a296634b86",
  "event": "validation.failed",
  "data": {
    "validationId": "val_31d1172c445a1cabf774eb6c",
    "status": "failed",
    "verdict": "review",
    "gates": 8,
    "violations": 2,
    "receiptHash": "sha256:44324a55…",
    "durationMs": …
  },
  "timestamp": "2026-11-09T22:34:46.347Z",
  "apiVersion": "1"
}

Verify the signature

Each delivery is a POST with these headers:

HeaderValue
X-AgentGate-Signaturesha256= and the hex HMAC-SHA256 of the raw request body, keyed with the webhook's secret.
X-AgentGate-EventThe event name.
X-AgentGate-DeliveryThe delivery ID, del_….
User-AgentAgentGate-Webhook/1.0
Content-Typeapplication/json

Compute the HMAC over the bytes you received, before parsing them, and compare in constant time.

import { createHmac, timingSafeEqual } from "node:crypto";

// rawBody: the request body exactly as received, before any JSON parsing
export function isFromAgentGate(rawBody, signatureHeader, secret) {
  const expected = "sha256=" + createHmac("sha256", secret).update(rawBody).digest("hex");
  const a = Buffer.from(expected);
  const b = Buffer.from(String(signatureHeader ?? ""));
  return a.length === b.length && timingSafeEqual(a, b);
}

Delivery and retries

  • Any 2xx response counts as delivered. Each attempt times out after 10 seconds.
  • An event is tried up to three times, with waits of 2 and then 4 seconds between attempts. After that it is not sent again.
  • When five events in a row fail all their attempts, the webhook is switched off: active becomes false. Nothing switches it back on. Delete it and register it again.
  • Deliveries are sent by the API process in the background, so they do not delay the validation response, and they are not queued durably. Events can arrive out of order, and an event in flight when the service restarts is lost. Treat webhooks as a notification, and reconcile against GET /v1/validations.
  • A repeated identical validation request fires its event again with the same validationId.
  • The delivery log holds the most recent 1,000 deliveries for the whole service, so older entries drop out.

Audit packages

POST /v1/audit-package API key · Team plan and above

Summarises your receipts for one framework over a period: how many validations ran, what the verdicts were, which of the rules mapped to that framework fired and how often, and whether your receipt chain for the period verifies.

request
curl https://agengate.com/v1/audit-package \
  -H "X-API-Key: $AGENTGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "regulation": "gdpr", "from": "2026-11-01", "to": "2026-12-01" }'
FieldTypeDescription
regulation requiredstringA framework ID from GET /v1/regulations, such as GDPR, EU-AI-ACT or PCI-DSS. Letter case, spaces and punctuation are ignored, so gdpr and eu ai act resolve too, as do a few short forms such as pci, owasp and aiact. An unknown name returns 422 UNKNOWN_REGULATION with the list of supported IDs.
from, tostringISO 8601. to defaults to now, and from to 30 days before to. A date without a time means midnight UTC at the start of that day, so "to": "2026-11-30" leaves the 30th out.
200 OK · trimmed
{
  "regulation": "GDPR",
  "framework": { "name": "GDPR", "full": "Regulation (EU) 2016/679", "region": "EU" },
  "period": { "from": "2026-11-01T00:00:00.000Z", "to": "2026-12-01T00:00:00.000Z" },
  "validations": 2,
  "verdicts": { "allow": 1, "redact": 0, "review": 1, "block": 0 },
  "controls": [
    {
      "rule": "G3-PII-EMAIL",
      "title": "Personal email address",
      "citations": [
        { "framework": "GDPR", "ref": "Art. 5(1)(c)", "note": "Data minimisation" },
        { "framework": "GDPR", "ref": "Art. 5(1)(f)", "note": "Integrity and confidentiality" }
      ],
      "findings": 1
    },
    …
  ],
  "evidencePackage": { "packageHash": "d1fabaec…", "records": 2, "dateRange": { … } },
  "chain": {
    "entries": 2,
    "first": { "seq": 1, "hash": "sha256:002d5add…" },
    "last": { "seq": 2, "hash": "sha256:c3cef936…" },
    "verified": true
  },
  "generatedAt": "2026-11-09T22:48:36.389Z",
  "attestationHash": "3955d35a…",
  "signature": { "alg": "Ed25519", "kid": "e4e62a477fbd2d86", "sig": "yGIckwXs…" },
  …
}
FieldMeaning
validations, verdictsThe number of receipts issued to your key in the period, and how their verdicts divide.
controlsAssessedThe number of rules mapped to the framework.
passed, failedOf those rules, how many never fired in the period and how many fired at least once.
controlsFor each mapped rule: its citations for this framework and findings, the number of receipts in the period that list it.
evidencePackagepackageHash is the SHA-256 over the hash strings of every receipt in the period, joined in issue order. records is their number.
chainThe first and last receipt of the period, the number of entries, and verified: every receipt is intact, linked to the one before and, where signed, correctly signed.
attestationHashThe SHA-256, in hex, of the canonical form of the package without attestationHash and signature.
signatureAn Ed25519 signature over sha256: plus the attestation hash, by the key that signs receipts.

Read it for what it is. The package is built only from your receipts. It reports what the gate saw in agent output. passed means a rule never fired, not that a control is in place, and nothing here assesses your systems or states that you comply with the framework. Validations made with evidence: false left no receipt and are not counted.

Rules and gates

The catalogue is public, so you can read what a gate checks before you rely on its verdict: as a page at /rules, and as JSON from the API. Rules are grouped into 8 gates.

GateNameWhat it is for
G1Output IntegrityThe output is finished and carries no machinery: no placeholders, leaked prompts, stack traces or destructive commands.
G2SecurityNo credentials, tokens, internal hosts or hijacked instructions leave the boundary.
G3Data ProtectionPersonal, payment and special-category data stay out of the response.
G4Action SafetyMoney movement, irreversible operations and privilege changes wait for a human.
G5LegalNo unqualified legal or medical advice, binding promises, absolute claims or threats.
G6Financial ConductNo guaranteed returns, unsuitable recommendations or help evading controls.
G7ExplainabilityAdverse decisions come with a reason and a route to a human.
G8Ethics & TransparencyNo posing as a human, protected-attribute decisions, manipulation or abuse.

The catalogue

GET /v1/rules no key

200 OK · trimmed
{
  "engine": { "version": "2.0.0", "receipt_version": 1, "max_input_chars": 200000 },
  "ruleset": "sha256:455c9a6c…",
  "count": 50,
  "gates": [{ "id": "G1", "name": "Output Integrity", "blurb": "…", "rules": … }, …],
  "frameworks": [{ "id": "GDPR", "name": "GDPR", "full": "Regulation (EU) 2016/679", "region": "EU", "rules": … }, …],
  "rules": [
    {
      "id": "G3-PII-EMAIL",
      "gate": "G3",
      "gateName": "Data Protection",
      "title": "Personal email address",
      "summary": "An individual's email address (role mailboxes such as support@ are ignored).",
      "fix": "Use the redacted output, or reference the customer by an internal ID.",
      "severity": "high",
      "action": "redact",
      "confidence": "high",
      "redactable": true,
      "kind": "pattern",
      "optIn": false,
      "citations": [{ "framework": "GDPR", "ref": "Art. 5(1)(c)", "note": "Data minimisation", "frameworkName": "GDPR" }, …],
      "languages": ["en"],
      "example": "I've sent the statement to john.doe@gmail.com."
    },
    …
  ]
}
  • action is the rule's default action. A request can change it with policy.actions.
  • redactable says whether matches can be masked in redacted_output.
  • kind is one of the four kinds of rule; optIn marks a rule that runs only when you ask for it.
  • languages lists the languages the rule has patterns for: en, ru, uz.
  • example is a text the rule matches. The test suite runs the examples of every rule.
  • The response does not include the patterns themselves. They are in the engine file, which this site serves unchanged at /assets/policy-engine.js.
  • The response may be cached for five minutes.

Gates and frameworks

EndpointKeyReturns
GET /v1/gatesyescount and gates. Each gate has id, name, description, checks (the number of rules), checkIds, rules (id, title, severity, action, confidence) and applicability: whether the gate runs by default and, for each tier, "always", a condition in words, or false.
GET /v1/regulationsyescount and regulations. Each has id, name, fullName, jurisdiction, description, controlCount (the number of rules mapped to it) and ruleIds. A framework is listed only if at least one rule cites a provision of it.

When the rules change

The API always runs the current ruleset. No parameter pins an older one. Every validate response names the rules that ran in engine.ruleset, and every receipt does in ruleset. That hash changes when the engine version changes or when any rule's ID, gate, default action, severity or pattern changes, so compare it with the value you tested against to notice a change. A receipt issued under an older ruleset can still be checked for integrity, signature and anchoring. Only its checks root can no longer be re-derived by the service, which reports ruleset-mismatch.

Stored validations

Results belong to the key that made them. Another key gets 404 for your validation IDs.

EndpointWhat it returns
GET /v1/validationstotal, limit, offset, source and items, newest first. Query: status (passed, warning or failed), limit (default 50, at most 200) and offset.
GET /v1/validations/:idOne validation.
GET /v1/statsYour totals. validations.total is the number of receipts ever issued to the key. The breakdown beside it — passed, failed, warning, passRate, byVerdict, byGate — covers only the window of results still in memory. Also the head of your ledger chain and this month's usage.
request
curl "https://agengate.com/v1/validations?status=failed&limit=20" \
  -H "X-API-Key: $AGENTGATE_KEY"

What is kept

Recent results are kept in memory. A stored result is the validate response without redacted_output and receipt_salt, which are never stored; the text you sent is not kept either. Receipts are kept in the ledger. The memory store holds the most recent 10,000 results across all keys and is emptied when the service restarts.

After a restart: the archived shape

When a validation is no longer in memory, it is rebuilt from its receipt and marked "archived": true:

GET /v1/validations/:id · archived
{
  "id": "val_e5e7d308f2627cbc7d2be125",
  "status": "failed",
  "verdict": "review",
  "gates": ["G1", "G2", "G3", "G4", "G5", "G6", "G7", "G8"],
  "findings": [
    { "rule": "G7-DECISION-NO-REASON", "action": "review", "severity": "high", "count": 1, "title": "Adverse decision without a reason" },
    { "rule": "G7-NO-RECOURSE", "action": "review", "severity": "high", "count": 1, "title": "Adverse decision without a route to a human" },
    { "rule": "G3-PII-EMAIL", "action": "redact", "severity": "high", "count": 1, "title": "Personal email address" }
  ],
  "receipt": { "v": 1, "id": "val_e5e7d308f2627cbc7d2be125", … },
  "validatedAt": "2026-11-09T22:32:22.111Z",
  "archived": true
}
  • gates is a list of gate IDs, not a list of objects with checks.
  • A finding has only rule, action, severity, count and title. Spans, previews, citations and fix text are gone.
  • violations, recommendations, evidence, engine, durationMs and the top-level context are absent. The receipt still carries the context and the ruleset.
  • A validation made with evidence: false left no receipt, so it cannot be rebuilt: the answer is 404.

The list is one sequence, before and after a restart:

  • GET /v1/validations returns your validations newest first: the full result for those still in memory, the archived shape for those rebuilt from the ledger. total, limit and offset all describe that one sequence, so paging runs straight through from recent results into older receipts.
  • source is "recent" when the page you asked for contains at least one result from memory, and "ledger" when all of it was rebuilt from receipts.
  • Paging stops at a depth of 10,000: a request with offset + limit beyond that is refused with 422. Fetch older validations by ID, or read the period you need from an audit package.

Errors

An error body uses the field names of RFC 7807, problem details. The content type is plain application/json.

422 Unprocessable Entity
{
  "type": "https://agengate.com/errors/invalid-input",
  "title": "INVALID_INPUT",
  "status": 422,
  "detail": "context.tier must be one of: T1, T2, T3, T4."
}
FieldMeaning
typeA URI that identifies the error: https://agengate.com/errors/ and the code in lower-case with hyphens. It is an identifier. Nothing is served at that address.
titleThe error code. Branch on this.
statusThe HTTP status, repeated.
detailA sentence for a person. Do not parse it.
othersSome errors add fields, listed below.

Codes

StatusCodeWhen
400MISSING_URL
INVALID_URL
A webhook was registered without a url, or with one that does not parse.
401MISSING_API_KEYNo X-API-Key header.
401INVALID_API_KEYThe key is unknown or has been revoked.
401INVALID_CREDENTIALSWrong email or password.
402PAYMENT_FAILEDA subscription payment was declined.
403PLAN_REQUIREDThe endpoint needs a higher plan. Adds requiredPlan and currentPlan.
404NOT_FOUNDAn unknown route, or a validation, override, webhook or receipt hash that does not exist or is not yours.
409ALREADY_REGISTEREDSign-up with an address that already has an account.
413INPUT_TOO_LARGEagent_output is over the limit. Adds limit.
422INVALID_INPUTA field is missing or has the wrong type, or the request names a gate or rule that does not exist, or would leave nothing to check. detail says which; for /v1/validate a reason field gives a stable code: UNKNOWN_GATE, NO_GATES, UNKNOWN_RULE, NOT_REDACTABLE, NO_RULES, INVALID_GATES or INVALID_POLICY.
422UNKNOWN_REGULATIONAn audit package was requested for a framework that is not in the catalogue. Adds supported.
429RATE_LIMIT_EXCEEDEDThe key's per-minute limit. Adds retryAfter.
429QUOTA_EXCEEDEDThe key's monthly quota is used up. Adds resetAt, quota and retryAfter.
429RATE_LIMITEDA per-IP limit on a public or sign-in endpoint.
500INTERNAL_ERRORSomething failed on our side. In production detail is generic.
503MULTICARD_NOT_CONFIGURED
STRIPE_NOT_CONFIGURED
A payment was started while that payment provider is not configured. Reading billing data does not need either.
  • Three errors are raised before the request reaches a handler: a body that is not valid JSON is 400 INVALID_JSON, a body over 1 MB is 413 PAYLOAD_TOO_LARGE (with limit in the body), and a body in an encoding the API does not read is 415 UNSUPPORTED_MEDIA_TYPE.
  • Other endpoints add a few codes of their own. Account and billing: INVALID_TOKEN (400), INVALID_EMAIL, INVALID_PRODUCT, INVALID_PLAN, INVALID_BILLING_CYCLE and USAGE_BASED_PRODUCT (all 400), SUBSCRIPTION_NOT_FOUND (404) and STRIPE_ERROR (500 when a checkout session cannot be created, 502 when a cancellation cannot be confirmed with Stripe). Overrides: VALIDATION_NOT_HELD, GATE_NOT_HELD and OVERRIDE_EXPIRED (all 409).
  • Fix and resend on a 4xx other than 429; retrying the same request will fail the same way. On 429, wait for the number of seconds in Retry-After. On 5xx, retry later and quote X-Request-Id if it persists.

Rate limits

Two limits apply to a key: requests per minute, and validations per calendar month.

PlanPlan IDRequests per minuteValidations per month
Freefree6010,000
Developerstarter300100,000
Teampro1,2001,000,000
Enterpriseenterpriseno fixed capno fixed cap

Per minute

  • The window is a rolling 60 seconds for each key. Every request to an authenticated endpoint counts, not only validations — including requests that were themselves answered with 429.
  • Responses from authenticated endpoints carry X-RateLimit-Limit (your per-minute limit), X-RateLimit-Remaining (requests left in the window) and X-RateLimit-Reset (the Unix time, in seconds, at which the oldest request leaves the window). These three describe the per-minute window and nothing else.
  • Over the limit you get 429 RATE_LIMIT_EXCEEDED with a Retry-After header in seconds and the same number as retryAfter in the body.
  • An Enterprise key has no per-minute cap. Its responses show X-RateLimit-Limit: 0 and X-RateLimit-Remaining: 999999.
429 Too Many Requests
{
  "type": "https://agengate.com/errors/rate-limit-exceeded",
  "title": "RATE_LIMIT_EXCEEDED",
  "status": 429,
  "detail": "Rate limit exceeded. Max 60 requests/minute for free plan.",
  "retryAfter": 59
}

Per month

  • The quota counts completed validations: every 200 from POST /v1/validate, repeats of an identical request included. Other endpoints do not use it up.
  • The month is the calendar month in UTC. The count resets on the 1st at 00:00 UTC.
  • When the quota is used up, POST /v1/validate answers 429 QUOTA_EXCEEDED until the reset, with Retry-After in seconds and resetAt, quota and retryAfter in the body. Every other endpoint keeps working: you can still read your validations and receipts, and you can still upgrade — the new quota applies at once.
  • Every authenticated response reports the month: X-Quota-Limit (0 means no cap), X-Quota-Remaining (absent when there is no cap) and X-Quota-Reset (Unix time, in seconds). The same numbers are in usage from GET /v1/auth/me.

By IP address

Endpoints that take no key are limited by address instead.

EndpointsLimit for each IP address
GET /v1/rules, POST /v1/receipts/verify, GET /v1/receipts/:hash, GET /.well-known/agentgate-keys.json60 requests a minute, shared between them.
GET /v1/health600 requests a minute.
POST /v1/auth/signup5 attempts in 15 minutes.
POST /v1/auth/login and the password endpoints10 failed attempts in 15 minutes, shared between them. Successful requests are not counted.

These answer 429 RATE_LIMITED with a Retry-After header, and report their state in the RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers. Here RateLimit-Reset is the number of seconds until the window resets.

Plans

Every plan runs all 50 rules and issues receipts. Plans differ in volume and rate, shown under Rate limits, and in two groups of endpoints. Prices are on the pricing page.

NeedsEndpoints
No keyGET /v1/rules, POST /v1/receipts/verify, GET /v1/receipts/:hash, GET /.well-known/agentgate-keys.json, GET /v1/health, GET /v1/status, GET /v1/products, GET /v1/billing/plans
A key on any planPOST /v1/validate, GET /v1/validations and /v1/validations/:id, every /v1/overrides endpoint, GET /v1/ledger/verify, GET /v1/gates, GET /v1/regulations, GET /v1/stats, /v1/auth/me
Developer and aboveEvery /v1/webhooks endpoint, and GET /v1/dashboard, a usage summary in one call. The dashboard page itself works on every plan.
Team and abovePOST /v1/audit-package

A call from a plan that is too low returns 403 PLAN_REQUIRED. The API names plans by ID: free, starter for Developer, pro for Team, and enterprise.

403 Forbidden
{
  "type": "https://agengate.com/errors/plan-required",
  "title": "PLAN_REQUIRED",
  "status": 403,
  "detail": "This endpoint requires the pro plan or higher. Your plan: starter.",
  "requiredPlan": "pro",
  "currentPlan": "starter"
}

Billing endpoints

The pricing and checkout pages use these. product is agentgate, pii-shield, audittrail, biasguard, routeiq, learnloop or vectorvault; plan is starter, pro or enterprise; billing_cycle is monthly or annual.

EndpointKeyWhat it does
GET /v1/billing/plansnoThe price list: the plan ladder in tiers and the price of each product and plan in plans.
POST /v1/billing/stripe/checkoutyesBody: product, plan, billing_cycle. Returns the url of a hosted Stripe Checkout page to send the customer to, with session_id and amount_usd. The payment is tied to the key that made the call: when Stripe confirms it, that key moves to the plan.
POST /v1/billing/subscribeyesBody: product, plan, billing_cycle. Creates a subscription for the account that owns the key and takes payment in UZS through Multicard. Returns 201 with subscription_id, invoice_id, the amounts and key_plan — for an AgentGate subscription the key is on the new plan by the time the response arrives — or 402 PAYMENT_FAILED.
GET /v1/billing/statusyesWhether the key has a subscription in force: active, plan. A cancelled subscription stays active until its effective_at.
GET /v1/billing/usageyesThe current billing period: period, total_calls_logged, projected_cost_uzs, projected_cost_usd.
GET /v1/billing/historyyesThe key's billing records, with invoice IDs, amounts and statuses.
POST /v1/billing/cancelyesCancels the subscription at the end of the current period: the key keeps its plan until effective_at, then returns to Free. Returns subscription_id and effective_at (the same date however often you call it), or 404 SUBSCRIPTION_NOT_FOUND. A card subscription is cancelled with Stripe first; if Stripe cannot be reached the answer is 502 STRIPE_ERROR and nothing is cancelled.

Other products

Three more services run beside the validation API. Each sits under its own path prefix with its own /v1, and takes the same X-API-Key. They are separate from the policy engine: none of them issues receipts. GET /v1/products lists every product with its maturity label.

  • Paths. The apiPrefix field in /v1/products is the public path prefix of each service: /pii/v1, /audit/v1, /bias/v1.
  • New keys. A new key works on these services at once. A plan change or a revocation reaches them within about five seconds.
  • Limits. They enforce the monthly quota but not the per-minute limit. On PII Shield and AuditTrail, X-RateLimit-Remaining and X-RateLimit-Reset describe the month: calls left, and the reset time as an ISO 8601 timestamp.
  • Errors. PII Shield and AuditTrail use the error shape described above, with their own type prefix. BiasGuard does not: it returns {"error": {"code": "…", "message": "…"}} with codes such as ERR_NO_KEY, ERR_INVALID_KEY, ERR_QUOTA_EXCEEDED, ERR_VALIDATION and ERR_NOT_FOUND.

PII Shield GA

BASE https://agengate.com/pii

Finds personal data in a text with a fixed set of patterns and, if you ask, returns a redacted copy.

EndpointWhat it does
POST /pii/v1/scanBody: text (up to 1,000,000 characters; 100,000 for a key that has custom patterns), redact (default false) and mode: mask (the default, ***), type ([EMAIL]), hash (the SHA-256 of the value) or remove. Returns hasPII, findings and, with redact, redactedText.
POST /pii/v1/batchThe same for texts, an array of up to 100 strings. Returns results and totalFindings. Each text counts as one call.
GET /pii/v1/patternsThe built-in patterns and your key's own custom ones.
POST /pii/v1/patterns
DELETE /pii/v1/patterns/:id
Adds or removes one of your custom patterns. Body for adding: id, type, label, pattern (a JavaScript regular expression of at most 256 characters) and optional flags (g i m s u). At most 20 patterns for each key. A pattern with nested repetition, a backreference, or one that can match the empty string is refused with 422 UNSAFE_PATTERN.
GET /pii/v1/statsCounters for the service and for your key.
GET /pii/v1/healthLiveness. No key.
request
curl https://agengate.com/pii/v1/scan \
  -H "X-API-Key: $AGENTGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "text": "Contact john@example.com.", "redact": true, "mode": "type" }'
200 OK
{
  "id": "3913fced-a991-4562-9ba6-8b501190c6b0",
  "scanMs": …,
  "hasPII": true,
  "findings": [
    {
      "type": "email",
      "value": "john@example.com",
      "redacted": "[EMAIL]",
      "position": { "start": 8, "end": 24 }
    }
  ],
  "redactedText": "Contact [EMAIL]."
}
  • The built-in types are email, phone, ssn, credit_card, iban, ip_address, date_of_birth, passport and drivers_license.
  • This is a different and simpler detector than gate G3. Its patterns do not check checksums, so a 16-digit number that is not a card, or an order code such as AB123456, is reported as a card or a passport number.
  • Unlike /v1/validate, the response contains each matched value in full, in findings[].value. Handle it as personal data.
  • Custom patterns belong to the key that registered them: no other key can use, list or delete them. They are held in memory and are gone after a restart. Together they get 250 ms and at most 1,000 matches on each text; a request that needs more is refused with 422 rather than half-scanned.

AuditTrail GA

BASE https://agengate.com/audit

An append-only log of events that you write yourself, in which each entry carries a hash of the one before. It is not the receipt ledger, and it is unrelated to /v1/audit-package.

EndpointWhat it does
POST /audit/v1/logAppends an entry. Body: entity, action and actor (strings, required), data (any JSON) and tags (strings). Returns 201 with id, hash, previousHash, chainPosition and timestamp.
GET /audit/v1/logLists your key's entries, newest first. Query: entity, action, actor, tags (comma-separated, all must match), from, to, limit (default 50, at most 200), offset.
GET /audit/v1/log/:idReturns one of your entries. Another key's entry ID is 404.
POST /audit/v1/verifyRecomputes the hashes of your key's chain, or of the range between fromId and toId; the body is optional. Returns verified, entriesChecked, chainHash and, on a mismatch, brokenAt.
POST /audit/v1/exportBody: format (json or csv) and optional from, to, entity. Returns entries (a count), data (the export, as a string) and attestationHash, the SHA-256 over the entry hashes in order.
GET /audit/v1/statsThe length of your key's chain, its first and last hash, and your counters.
GET /audit/v1/healthLiveness. No key.
request
curl https://agengate.com/audit/v1/log \
  -H "X-API-Key: $AGENTGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "entity": "payment",
    "action": "approved",
    "actor": "agent:billing",
    "data": { "amount": 120 },
    "tags": ["refund"]
  }'
201 Created · hashes shortened
{
  "id": "80dd5ef6-adcb-4e91-a7fe-374b85111e24",
  "hash": "4c42ac03…",
  "previousHash": "00000000…",
  "chainPosition": 0,
  "timestamp": "2026-11-09T22:44:29.731Z"
}

One chain for each API key. List, read, export and verify cover only the entries of the key that calls them, and chainPosition starts at 0 for each key. Entries logged before the chains were separated are no longer served to anyone.

  • An entry's hash is the SHA-256 of the previous hash, entity, action, actor, the JSON of data and the timestamp, joined in that order. The first entry of each key's chain has a previous hash of 64 zeros. tags are not covered by the hash.
  • Verification shows that the entries are consistent with each other. It does not show who wrote them: entries are not signed.
  • Logging, verifying and exporting each count as one call. Reading does not.

BiasGuard Beta

BASE https://agengate.com/bias

Computes group-fairness statistics on a set of predictions that you send. It does not inspect a model.

EndpointWhat it does
POST /bias/v1/auditBody: predictions (at least two, each with id, predicted, optional actual and protected_attributes), favorable_outcome, protected_attribute and optional thresholds. Returns 201 with metrics, pass, violations, recommendations, the thresholds that were applied and a thresholds_note.
POST /bias/v1/reportBody: audit_id and format (json or markdown). Returns one of your audits as a report; another key's audit ID is 404.
GET /bias/v1/regulationsA fixed list of frameworks with the service's notes on each.
GET /bias/v1/statsYour key's counters and the two default thresholds.
GET /bias/v1/healthLiveness. No key.
request
curl https://agengate.com/bias/v1/audit \
  -H "X-API-Key: $AGENTGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "protected_attribute": "gender",
    "favorable_outcome": 1,
    "predictions": [
      { "id": "1", "predicted": 1, "actual": 1, "protected_attributes": { "gender": "male" } },
      { "id": "2", "predicted": 1, "actual": 1, "protected_attributes": { "gender": "male" } },
      { "id": "3", "predicted": 0, "actual": 1, "protected_attributes": { "gender": "female" } },
      { "id": "4", "predicted": 1, "actual": 1, "protected_attributes": { "gender": "female" } }
    ]
  }'
201 Created · trimmed
{
  "id": "eb64fd74-4a49-4f6a-9893-6b5a2a17a501",
  "metrics": {
    "disparate_impact_ratio": 0.5,
    "statistical_parity_difference": 0.5,
    "equal_opportunity_difference": 0.5,
    "demographic_parity": { "male": 1, "female": 0.5 }
  },
  "pass": false,
  "threshold": 0.8,
  "violations": [
    { "group": "overall", "metric": "disparate_impact_ratio", "value": 0.5, "threshold": 0.8 },
    { "group": "overall", "metric": "equal_opportunity_difference", "value": 0.5, "threshold": 0.1 }
  ],
  "recommendations": [ … ],
  "auditMs": …,
  "createdAt": "2026-11-09T22:44:29.744Z",
  "requestId": "…"
}
  • The group with the highest rate of favourable predictions is taken as the reference group. You cannot name one.
  • disparate_impact_ratio is the lowest group's favourable rate divided by the reference group's. statistical_parity_difference is the largest gap in favourable rate. equal_opportunity_difference is the largest gap in true-positive rate, and needs actual. demographic_parity is the favourable rate of each group.
  • pass is true when the ratio is at least 0.80 and the equal-opportunity difference is at most 0.10. 0.80 and 0.10 are defaults: send thresholds with an audit to use your own. They are rules of thumb — 0.80 is the four-fifths rule from the US EEOC guidelines, 0.10 a common convention — not legal thresholds, and a passing audit is not a finding that a system is fair or compliant.
  • Audits are held in memory. report works only until the service restarts, and only for the key that ran the audit.

GET /v1/products also lists RouteIQ (beta), LearnLoop (preview) and VectorVault (preview). They are not documented on this page.

Limits

What AgentGate does not do, said plainly, so you can decide what else you need around it.

The engine

  • There is no model in the loop. Every rule is a pattern, or a trigger phrase without its safeguard. Rules do not understand meaning: they do not notice a false statement, sarcasm, or a problem phrased in words no pattern covers.
  • Rules miss things and rules misfire. A medium confidence rule is a heuristic. An allow means no rule matched, not that the text is safe. If a rule misfires on your traffic, switch it off or change its action with policy — and tell us, because a false positive is a bug in a rule.
  • Masking is complete, or the output is blocked. Every match of a redactable rule is masked in redacted_output, however many there are; a finding lists the first 50 positions and gives the total in count. If one rule matches more than 20,000 times in a single output, the finding becomes a block and no redacted copy is returned. Rules that mask nothing stop counting at 50 matches.
  • One text, on its own. A call checks one string of up to 200,000 characters. It does not see earlier messages, attachments or tool calls unless you put them in the string. A safeguard given in a previous message does not count.
  • The verdict is advice to your code. AgentGate is not in the path between your agent and its user. It cannot stop a message that your code sends anyway, and a receipt does not show what was finally sent.
  • Passing is not compliance. Citations say which obligation a check supports. No set of checks on output text makes a system compliant, and nothing on this page is legal advice.

Languages

All 50 rules have English patterns. 28 also have Russian patterns, and 7 have Uzbek ones; the languages field of each rule in the catalogue says which. Text in any other language is covered only where a rule looks for a format rather than words: a card number, a token, an email address.

What is stored

KeptWhat it contains
ReceiptsEverything shown under Receipts, in a ledger with one chain for each key. The chain is filed under a hash of the key, not the key itself.
UsageA count of validations for each key and month, and a row for each validation: its ID, the key, the status, context.domain, the number of gates, the duration and the time.
AccountYour email address, plan, optional company and display name, a hash of your password, and your API key.
Request metadataFor logs and analytics: method, path, status, duration, request ID and user agent, with the first characters of the key in the log.
In memory onlyRecent results, with masked previews of matches, until a restart or until they are pushed out by newer ones.

Not stored: agent_output, redacted_output, receipt_salt and context.metadata. The text is checked in memory and dropped when the response has been sent. If you lose a salt, the service cannot give it to you again. How long records are kept, and your rights over them, are covered by the privacy policy.

Operations

  • The result list is a cache. Full results live in memory and are gone after a restart. From then on, a validation that has a receipt is served in the shorter archived shape, and the list falls back to the ledger until new validations arrive.
  • Receipts rely on the issuer for time and order. issued_at is the service's own clock, and the ledger is run by the service. There is no independent timestamp or public transparency log behind a receipt.
  • The ruleset cannot be pinned. Rules change with the engine. Watch engine.ruleset.
  • Overrides and webhooks are light. An override records a decision and changes nothing else. A webhook event is tried three times and then dropped.

If the API behaves differently from what this page says, one of them has a bug. Tell us which at info@pactum.uz.