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." }'
// Node 18 or later, as an ES module const output = "Hi Dana, the statement was sent to dana.reyes@gmail.com. Your loan application has been declined."; const res = await fetch("https://agengate.com/v1/validate", { method: "POST", headers: { "X-API-Key": process.env.AGENTGATE_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ agent_output: output }), }); if (!res.ok) throw new Error(`AgentGate ${res.status}: ${(await res.json()).detail}`); const result = await res.json(); console.log(result.verdict); // "review"
import os import requests output = "Hi Dana, the statement was sent to dana.reyes@gmail.com. Your loan application has been declined." res = requests.post( "https://agengate.com/v1/validate", headers={"X-API-Key": os.environ["AGENTGATE_KEY"]}, json={"agent_output": output}, timeout=10, ) res.raise_for_status() result = res.json() print(result["verdict"]) # "review"
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.
{
"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); } }
# send, hold_for_human and refuse are your own functions def deliver(output, result): verdict = result["verdict"] if verdict == "allow": return send(output) if verdict == "redact": return send(result["redacted_output"]) if verdict == "review": return hold_for_human(output, result) if verdict == "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 returns401 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 — andX-API-Version: 1. Quote the request ID when you report a problem. - No endpoint issues a replacement key.
DELETE /v1/auth/merevokes 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
| Endpoint | Returns |
|---|---|
GET /v1/health | Liveness: status, service, timestamp. |
GET /v1/status | The 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/rules | The rule catalogue. |
POST /v1/receipts/verifyGET /v1/receipts/:hashGET /.well-known/agentgate-keys.json | Receipt verification and the signing key. |
GET /v1/products | Every product with its maturity label. See Other products. |
GET /v1/billing/plans | The current price list. See Plans. |
Account endpoints
The sign-up and sign-in pages use these; you can call them directly.
| Endpoint | Key | What it does |
|---|---|---|
POST /v1/auth/signup | no | Body: 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/login | no | Body: email, password. Returns api_key, plan and email, or 401 INVALID_CREDENTIALS. |
POST /v1/auth/forgot-password | no | Body: 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-password | no | Body: token, new_password. 400 INVALID_TOKEN if the link has expired or was used. The API key does not change. |
GET /v1/auth/me | yes | Your email, plan and profile, plus usage for the current month: validations, quota, gatesRun, period and lastUsedAt. |
PATCH /v1/auth/me | yes | Body: displayName and/or company, up to 120 characters each. |
POST /v1/auth/change-password | yes | Body: old_password, new_password. The API key does not change. |
DELETE /v1/auth/me | yes | Revokes the key and deactivates the account. |
Validate
POST /v1/validate
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.
| Field | Type | Description |
|---|---|---|
agent_output required | string | The text to check. It must contain something other than whitespace and be no longer than 200,000 characters. |
context | object | Describes the task: domain, task_type, tier, regulatory, ai_touching and metadata. It selects which gates run and adjusts a few rules. See Context. |
gates | string[] | 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. |
evidence | boolean | Default true. Set false to skip the receipt. |
policy | object | Rule settings for this request: disable (rule or gate IDs to skip) and actions (rule ID → action). See Policy. |
mode | string | Echoed 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:
{
"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
| Field | Type | Description |
|---|---|---|
id | string | The validation ID: val_ and 24 hexadecimal characters. |
status | string | passed, warning or failed: can the text go out exactly as written? See Verdicts. |
verdict | string | allow, redact, review or block: what to do. |
gates | object[] | 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. |
findings | object[] | One entry for each rule that matched. See Findings. |
violations | string[] | A readable line for each finding whose action is redact, review or block. |
recommendations | string[] | The fix text of each finding, without duplicates. |
redacted_output | string | The 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. |
receipt | object | The signed record of this check. See Receipts. Absent with evidence: false. |
receipt_salt | string | 32 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. |
evidence | object | A 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. |
context | object | The context you sent, without metadata. |
engine | object | version and ruleset, the hash that identifies the exact rules that ran. |
validatedAt | string | ISO 8601 time of the check. |
durationMs | number | Server-side time for the whole call, in milliseconds. |
mode | string | The 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.
{
"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_saltandevidenceare 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?
| Verdict | Status | When | What to do |
|---|---|---|---|
| allow | passed | No rule matched. | Send the output. |
| allow | warning | Only advisory findings, with action flag. | Send the output. The advisories are in findings: log them or show them to whoever owns the agent. |
| redact | failed | The 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. |
| review | failed | At least one finding needs a person: a decision, a promise, an action. | Hold the output until someone has looked at it. |
| block | failed | At least one finding must not leave: a credential, a guaranteed return, an agent claiming to be human. | Do not send it. Regenerate or escalate. |
faileddoes not mean the request failed. It means the text must not ship unchanged, which is why aredactverdict isfailedtoo.redacted_outputcomes back whenever a redactable value was found, also underreviewandblock. Under those verdicts masking is not enough: the other findings still stand.- Each entry in
gateshas its ownstatus, 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:
- 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. - Have a person approve, then validate again with the approval in
context.metadata:approved_byfor held actions and promises,human_reviewedfor automated decisions. See Context. - 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.
{
"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" }]
}
| Field | Type | Description |
|---|---|---|
rule | string | The rule ID. It starts with the gate, as in G3-PII-EMAIL. |
gate | string | The gate the rule belongs to. |
titlesummaryfix | string | What the rule looks for and what to do about a match, as written in the catalogue. |
severity | string | low, medium, high or critical. |
action | string | flag, redact, review or block — the action applied on this request, after any policy setting or approval. |
confidence | string | high or medium: how literal the rule is. See below. |
label | string or null | The redaction token for a rule whose matches can be masked, such as EMAIL. null for the rest. |
count | number | How many matches there are in total. |
citations | object[] | The provisions the rule is mapped to: framework, ref and usually a note. |
spans | object[] | Where the matches are: start, end and a masked preview. The first 50 are listed. redacted_output masks every match, listed or not. |
spans_truncated | boolean | Present, and true, when spans lists fewer matches than count. |
note | string | Present 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.
| Field | Type | Effect |
|---|---|---|
tier | "T1" to "T4" | Selects the gates, as in the table below. Any other value is a 422. |
regulatory | boolean | With tier T2, switches on G6 and G7. |
ai_touching | boolean | With tier T2, switches on G8. |
domain | string | Free 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_type | string | Free text, recorded in the receipt. No rule reads it. |
metadata | object | Free-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
tier | Gates |
|---|---|
| not set | All 8. |
T1 | G1, G2 and G3. |
T2 | G1 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, T4 | All 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
| Key | Value | Effect |
|---|---|---|
approved_by | anything truthy, usually a name or an ID | Says 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_threshold | a number above zero | The amount, in approximate US dollars, from which G4-MONEY-MOVEMENT fires. The default is 1000. |
human_reviewed | true | Says a person has confirmed the decision. Switches off G8-AUTOMATED-DECISION. |
require_ai_disclosure | true | Switches 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_reviewedandrequire_ai_disclosuremust be the booleantrue. The string"true"is ignored.- These keys act on rules in G4, G5 and G8. If the tier or the
gatesfield 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_bynames a real approver. The value is not stored and is not in the receipt — the receipt'scontextholds onlydomain,task_type,tier,regulatoryandai_touching— so keep your own record of who approved what. The downgraded finding stays on the receipt with the actionflag. - 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.actionsentry for a rule takes precedence overapproved_by.
Without approved_by, the request below gets the verdict review from G4-MONEY-MOVEMENT. With it, the transfer is recorded but not held:
{
"agent_output": "Done. I have transferred $50,000 to the account ending 4829.",
"context": {
"metadata": { "approved_by": "j.smith@example.com" }
}
}
{
"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.
| Field | Type | Effect |
|---|---|---|
policy.disable | string[] | 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.actions | object | Rule ID → flag, redact, review or block. Replaces the rule's action for this request, in either direction. Any other value is a 422. |
{
"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
disableoractionsreturns422 INVALID_INPUTwith"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 statuspassed. redactis only for redactable rules — those with"redactable": truein the catalogue. Setting it on any other rule is refused with422and"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
blockrule 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.
{
"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…"
}
}
| Field | Meaning |
|---|---|
v | Receipt format version. |
id | The validation ID. |
issued_at | When the receipt was issued, by the issuer's clock. |
issuer | Who issued it. |
engine | The engine and its version. |
ruleset | A hash that identifies the exact rules that ran. |
subject.commitment | A salted hash of the text that was checked. |
subject.chars | The length of that text. |
context | domain, task_type, tier, regulatory and ai_touching, where you sent them. Never metadata. |
gates | The IDs of the gates that ran. |
evaluated | How many rules were evaluated. |
findings | For each rule that matched: rule, action, severity and count. No spans and no previews. |
checks_root | One hash over the result of every evaluated rule. |
verdict, status | As in the response. |
seq | The receipt's position in your key's chain, starting at 1. |
prev | The hash of the receipt before it. For the first receipt: sha256: followed by 64 zeros. |
policy.disabled | The IDs from policy.disable, sorted. Present only when you sent some. |
hash | The hash of everything above. |
signature | alg (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
hashandsignaturefrom the receipt, serialise what is left in canonical form, take the SHA-256 of its UTF-8 bytes and write it assha256: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 infindingspassed 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 ingates, minus anything inpolicy.disabled. The validate response hands you the leaves asevidence.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/rulesreports 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 itsrulesetHash(), which returns the hex without thesha256:prefix. signature.sig- An Ed25519 signature over the UTF-8 bytes of the
hashstring, thesha256:prefix included, in unpadded base64url.kidis 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.charscharacters under the ruleset inruleset, 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
seqin its chain, directly afterprev.
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_byis not in the receipt. - An independent time.
issued_atis 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
Send receipt, and optionally output together with salt to have the commitment checked as well.
curl https://agengate.com/v1/receipts/verify \ -H "Content-Type: application/json" \ -d '{ "receipt": { "v": 1, "id": "val_…", "hash": "sha256:…", "signature": { … }, … } }'
{
"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…"
}
}
| Field | Meaning |
|---|---|
valid | true 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. |
hash | ok, plus expected (the hash in the receipt) and actual (the hash of its body). |
signature | valid, invalid, absent or unknown-key — signed with a key this service does not hold now. |
anchored, anchor | Whether the hash is in the ledger at the seq the receipt states, and if so its seq and issued_at. |
checks_root | ok 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). |
commitment | true or false; null when you sent no output and salt. |
ruleset | The 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
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.
{ "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
The Ed25519 public key, as a JWK set. Match kid against the receipt's signature.kid. The response may be cached for an hour.
{
"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
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.
{
"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.
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.
| Endpoint | What it does |
|---|---|
POST /v1/overrides | Files 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/review | Decides 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/overrides | Lists your overrides, newest first. Query: status (pending, approved, rejected or expired), validation_id, limit (default 50, at most 200). |
GET /v1/overrides/:id | Returns one. |
All four need an API key and are available on every plan.
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." }'
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." }'
{
"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:
404if the validation is unknown or belongs to another key,409 VALIDATION_NOT_HELDif its verdict wasalloworredact,409 GATE_NOT_HELDif the gate has no finding on it, and422for a gate ID that does not exist. - The reviewer is whoever your system says it is.
reviewer_emailis 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. expiresAtis 90 days aftercreatedAt. A request still pending after that date has the statusexpired, 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
hashandpreviousHashfields 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.
| Endpoint | What it does |
|---|---|
POST /v1/webhooks | Registers a URL. Body: url and an optional events array. Returns 201 with id, url, events and secret. |
GET /v1/webhooks | Lists your webhooks: id, url, events, active, lastDeliveryAt. |
DELETE /v1/webhooks/:id | Removes one. |
GET /v1/webhooks/:id/deliveries | Recent 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/stats | totalWebhooks, activeWebhooks, totalDeliveries and successRate, a percentage. |
Set one up
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"] }'
{
"webhook": {
"id": "wh_02451b9845834bdf",
"url": "https://example.com/hooks/agentgate",
"events": ["validation.failed", "override.approved"],
"secret": "whsec_…"
}
}
- The
secretis shown in this response and nowhere else. Store it: you need it to verify signatures. - The URL must be
httporhttps—httpsonly 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 with422 INVALID_INPUT. - Leave
eventsout 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
| Event | Sent when | data |
|---|---|---|
validation.completed | A 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.failed | A validation ends with the status failed: the verdict is redact, review or block. | |
override.requested | An override is filed. | overrideId, validationId, gateId |
override.approvedoverride.rejected | An override is reviewed. | overrideId, decision, reviewerEmail, validationId, gateId |
These five are the events the API sends today. No event contains output text.
{
"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:
| Header | Value |
|---|---|
X-AgentGate-Signature | sha256= and the hex HMAC-SHA256 of the raw request body, keyed with the webhook's secret. |
X-AgentGate-Event | The event name. |
X-AgentGate-Delivery | The delivery ID, del_…. |
User-Agent | AgentGate-Webhook/1.0 |
Content-Type | application/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); }
import hashlib import hmac # raw_body: the request body exactly as received (bytes), before any JSON parsing def is_from_agentgate(raw_body, signature_header, secret): expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, signature_header or "")
Delivery and retries
- Any
2xxresponse 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:
activebecomesfalse. 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
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.
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" }'
| Field | Type | Description |
|---|---|---|
regulation required | string | A 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, to | string | ISO 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. |
{
"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…" },
…
}
| Field | Meaning |
|---|---|
validations, verdicts | The number of receipts issued to your key in the period, and how their verdicts divide. |
controlsAssessed | The number of rules mapped to the framework. |
passed, failed | Of those rules, how many never fired in the period and how many fired at least once. |
controls | For each mapped rule: its citations for this framework and findings, the number of receipts in the period that list it. |
evidencePackage | packageHash is the SHA-256 over the hash strings of every receipt in the period, joined in issue order. records is their number. |
chain | The 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. |
attestationHash | The SHA-256, in hex, of the canonical form of the package without attestationHash and signature. |
signature | An 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.
| Gate | Name | What it is for |
|---|---|---|
G1 | Output Integrity | The output is finished and carries no machinery: no placeholders, leaked prompts, stack traces or destructive commands. |
G2 | Security | No credentials, tokens, internal hosts or hijacked instructions leave the boundary. |
G3 | Data Protection | Personal, payment and special-category data stay out of the response. |
G4 | Action Safety | Money movement, irreversible operations and privilege changes wait for a human. |
G5 | Legal | No unqualified legal or medical advice, binding promises, absolute claims or threats. |
G6 | Financial Conduct | No guaranteed returns, unsuitable recommendations or help evading controls. |
G7 | Explainability | Adverse decisions come with a reason and a route to a human. |
G8 | Ethics & Transparency | No posing as a human, protected-attribute decisions, manipulation or abuse. |
The catalogue
GET /v1/rules
{
"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."
},
…
]
}
actionis the rule's default action. A request can change it withpolicy.actions.redactablesays whether matches can be masked inredacted_output.kindis one of the four kinds of rule;optInmarks a rule that runs only when you ask for it.languageslists the languages the rule has patterns for:en,ru,uz.exampleis 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
| Endpoint | Key | Returns |
|---|---|---|
GET /v1/gates | yes | count 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/regulations | yes | count 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.
| Endpoint | What it returns |
|---|---|
GET /v1/validations | total, limit, offset, source and items, newest first. Query: status (passed, warning or failed), limit (default 50, at most 200) and offset. |
GET /v1/validations/:id | One validation. |
GET /v1/stats | Your 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. |
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:
{
"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
}
gatesis a list of gate IDs, not a list of objects with checks.- A finding has only
rule,action,severity,countandtitle. Spans, previews, citations and fix text are gone. violations,recommendations,evidence,engine,durationMsand the top-levelcontextare absent. The receipt still carries the context and the ruleset.- A validation made with
evidence: falseleft no receipt, so it cannot be rebuilt: the answer is404.
The list is one sequence, before and after a restart:
GET /v1/validationsreturns your validations newest first: the full result for those still in memory, the archived shape for those rebuilt from the ledger.total,limitandoffsetall describe that one sequence, so paging runs straight through from recent results into older receipts.sourceis"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 + limitbeyond that is refused with422. 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.
{
"type": "https://agengate.com/errors/invalid-input",
"title": "INVALID_INPUT",
"status": 422,
"detail": "context.tier must be one of: T1, T2, T3, T4."
}
| Field | Meaning |
|---|---|
type | A 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. |
title | The error code. Branch on this. |
status | The HTTP status, repeated. |
detail | A sentence for a person. Do not parse it. |
| others | Some errors add fields, listed below. |
Codes
| Status | Code | When |
|---|---|---|
| 400 | MISSING_URLINVALID_URL | A webhook was registered without a url, or with one that does not parse. |
| 401 | MISSING_API_KEY | No X-API-Key header. |
| 401 | INVALID_API_KEY | The key is unknown or has been revoked. |
| 401 | INVALID_CREDENTIALS | Wrong email or password. |
| 402 | PAYMENT_FAILED | A subscription payment was declined. |
| 403 | PLAN_REQUIRED | The endpoint needs a higher plan. Adds requiredPlan and currentPlan. |
| 404 | NOT_FOUND | An unknown route, or a validation, override, webhook or receipt hash that does not exist or is not yours. |
| 409 | ALREADY_REGISTERED | Sign-up with an address that already has an account. |
| 413 | INPUT_TOO_LARGE | agent_output is over the limit. Adds limit. |
| 422 | INVALID_INPUT | A 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. |
| 422 | UNKNOWN_REGULATION | An audit package was requested for a framework that is not in the catalogue. Adds supported. |
| 429 | RATE_LIMIT_EXCEEDED | The key's per-minute limit. Adds retryAfter. |
| 429 | QUOTA_EXCEEDED | The key's monthly quota is used up. Adds resetAt, quota and retryAfter. |
| 429 | RATE_LIMITED | A per-IP limit on a public or sign-in endpoint. |
| 500 | INTERNAL_ERROR | Something failed on our side. In production detail is generic. |
| 503 | MULTICARD_NOT_CONFIGUREDSTRIPE_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 is413 PAYLOAD_TOO_LARGE(withlimitin the body), and a body in an encoding the API does not read is415 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_CYCLEandUSAGE_BASED_PRODUCT(all 400),SUBSCRIPTION_NOT_FOUND(404) andSTRIPE_ERROR(500 when a checkout session cannot be created, 502 when a cancellation cannot be confirmed with Stripe). Overrides:VALIDATION_NOT_HELD,GATE_NOT_HELDandOVERRIDE_EXPIRED(all 409). - Fix and resend on a
4xxother than429; retrying the same request will fail the same way. On429, wait for the number of seconds inRetry-After. On5xx, retry later and quoteX-Request-Idif it persists.
Rate limits
Two limits apply to a key: requests per minute, and validations per calendar month.
| Plan | Plan ID | Requests per minute | Validations per month |
|---|---|---|---|
| Free | free | 60 | 10,000 |
| Developer | starter | 300 | 100,000 |
| Team | pro | 1,200 | 1,000,000 |
| Enterprise | enterprise | no fixed cap | no 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) andX-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_EXCEEDEDwith aRetry-Afterheader in seconds and the same number asretryAfterin the body. - An Enterprise key has no per-minute cap. Its responses show
X-RateLimit-Limit: 0andX-RateLimit-Remaining: 999999.
{
"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
200fromPOST /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/validateanswers429 QUOTA_EXCEEDEDuntil the reset, withRetry-Afterin seconds andresetAt,quotaandretryAfterin 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(0means no cap),X-Quota-Remaining(absent when there is no cap) andX-Quota-Reset(Unix time, in seconds). The same numbers are inusagefromGET /v1/auth/me.
By IP address
Endpoints that take no key are limited by address instead.
| Endpoints | Limit for each IP address |
|---|---|
GET /v1/rules, POST /v1/receipts/verify, GET /v1/receipts/:hash, GET /.well-known/agentgate-keys.json | 60 requests a minute, shared between them. |
GET /v1/health | 600 requests a minute. |
POST /v1/auth/signup | 5 attempts in 15 minutes. |
POST /v1/auth/login and the password endpoints | 10 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.
| Needs | Endpoints |
|---|---|
| No key | GET /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 plan | POST /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 above | Every /v1/webhooks endpoint, and GET /v1/dashboard, a usage summary in one call. The dashboard page itself works on every plan. |
| Team and above | POST /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.
{
"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.
| Endpoint | Key | What it does |
|---|---|---|
GET /v1/billing/plans | no | The price list: the plan ladder in tiers and the price of each product and plan in plans. |
POST /v1/billing/stripe/checkout | yes | Body: 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/subscribe | yes | Body: 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/status | yes | Whether the key has a subscription in force: active, plan. A cancelled subscription stays active until its effective_at. |
GET /v1/billing/usage | yes | The current billing period: period, total_calls_logged, projected_cost_uzs, projected_cost_usd. |
GET /v1/billing/history | yes | The key's billing records, with invoice IDs, amounts and statuses. |
POST /v1/billing/cancel | yes | Cancels 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
apiPrefixfield in/v1/productsis 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-RemainingandX-RateLimit-Resetdescribe 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
typeprefix. BiasGuard does not: it returns{"error": {"code": "…", "message": "…"}}with codes such asERR_NO_KEY,ERR_INVALID_KEY,ERR_QUOTA_EXCEEDED,ERR_VALIDATIONandERR_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.
| Endpoint | What it does |
|---|---|
POST /pii/v1/scan | Body: 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/batch | The same for texts, an array of up to 100 strings. Returns results and totalFindings. Each text counts as one call. |
GET /pii/v1/patterns | The built-in patterns and your key's own custom ones. |
POST /pii/v1/patternsDELETE /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/stats | Counters for the service and for your key. |
GET /pii/v1/health | Liveness. No key. |
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" }'
{
"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,passportanddrivers_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, infindings[].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
422rather 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.
| Endpoint | What it does |
|---|---|
POST /audit/v1/log | Appends 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/log | Lists 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/:id | Returns one of your entries. Another key's entry ID is 404. |
POST /audit/v1/verify | Recomputes 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/export | Body: 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/stats | The length of your key's chain, its first and last hash, and your counters. |
GET /audit/v1/health | Liveness. No key. |
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"] }'
{
"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
hashis the SHA-256 of the previous hash,entity,action,actor, the JSON ofdataand the timestamp, joined in that order. The first entry of each key's chain has a previous hash of 64 zeros.tagsare 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.
| Endpoint | What it does |
|---|---|
POST /bias/v1/audit | Body: 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/report | Body: 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/regulations | A fixed list of frameworks with the service's notes on each. |
GET /bias/v1/stats | Your key's counters and the two default thresholds. |
GET /bias/v1/health | Liveness. No key. |
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" } } ] }'
{
"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_ratiois the lowest group's favourable rate divided by the reference group's.statistical_parity_differenceis the largest gap in favourable rate.equal_opportunity_differenceis the largest gap in true-positive rate, and needsactual.demographic_parityis the favourable rate of each group.passistruewhen the ratio is at least 0.80 and the equal-opportunity difference is at most 0.10. 0.80 and 0.10 are defaults: sendthresholdswith 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.
reportworks 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
mediumconfidence rule is a heuristic. Anallowmeans no rule matched, not that the text is safe. If a rule misfires on your traffic, switch it off or change its action withpolicy— 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 incount. If one rule matches more than 20,000 times in a single output, the finding becomes ablockand 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
| Kept | What it contains |
|---|---|
| Receipts | Everything 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. |
| Usage | A 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. |
| Account | Your email address, plan, optional company and display name, a hash of your password, and your API key. |
| Request metadata | For logs and analytics: method, path, status, duration, request ID and user agent, with the first characters of the key in the log. |
| In memory only | Recent 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_atis 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.