Guard wire reference
This is the exact contract behind the Direct API quickstart. It is the same contract Local Operator uses: a custom harness sends the same bytes and gets the same answers.
Guard is not switched on yet: every route below answers 404 guard_not_available until it is. See the quickstart for how to build against that.
#Routes
| Route | Called by | Purpose |
|---|---|---|
GET /v1/guard/status?tenant=&install_id= | The harness | Whether to ask the member, and what to ask. |
POST /v1/guard/consents | The harness, signed | Record the member's yes. The first grant from a computer also registers its key. |
POST /v1/guard/consents/revoke | The harness | Stop sharing for the caller, from every computer. Body {"tenant": "…"}. |
GET /v1/guard/binding?tenant=&install_id= | The harness | What this computer may send now: collection_rev, revocation_gen and scopes. |
POST /v1/guard/ingest | The harness, signed | Send a batch of records. |
POST /v1/guard/reports | The harness, signed | Send a standing report (needs the reports scope). |
POST /v1/guard/report-actions | The harness, an assistant or the console | Draft a one-shot report. Writes one pending draft and nothing else. |
GET /v1/guard/report-actions/{id} | The account that drafted it | Read a draft's status. |
POST /v1/guard/report-actions/consume | The harness, signed | Send a drafted report after the member confirmed it. |
GET /v1/guard/me?tenant_id= | The member | Their own state, computers and timeline. |
POST /v1/guard/devices/{id}/revoke | The member | Remove one of their computers. |
Console-only routes (GET and PUT /v1/guard/org, POST /v1/guard/revoke) belong to the organization admin pages and are not part of what a harness sends.
Every route takes the member's user token. Signed routes also refuse a request that carries a Cookie or Origin header (403 guard_browser_refused), checked before authentication, and Guard responses carry no CORS headers: a web page cannot call them.
#Envelope and signing
Every signed request has this shape:
{"payload": { "…": "…" }, "alg": "Ed25519", "key_id": "<first 32 hex of sha256(raw public key)>", "signature": "<base64url, unpadded>"}
signature = Ed25519( domain || canonical_json(payload) )
canonical_json = sorted keys, no whitespace, printable-ASCII strings, integers only
algis alwaysEd25519. The public key is the raw 32 bytes, encoded base64url without padding.- Canonical JSON has no floats, booleans or
null, and every string is printable ASCII. - The server rebuilds the canonical form from what you sent, so key order and whitespace on the wire do not matter.
- Keys are exact. A key that differs only in case, a key repeated in one object at any depth, or an unknown key refuses the request:
guard_invalid_requestfor a payload,guard_device_signature_requiredfor the envelope. That is deliberate: free text can never ride along beside a value the server keeps.
Each message type has its own domain, a fixed ASCII string ending in one zero byte (\0), so a signature for one type never verifies as another:
| Message | Route | Domain |
|---|---|---|
| Grant | POST /v1/guard/consents | radient-guard-consent-v1\0 |
| Batch | POST /v1/guard/ingest | radient-guard-batch-v1\0 |
| Standing report | POST /v1/guard/reports | radient-guard-report-v1\0 |
| One-shot report consume | POST /v1/guard/report-actions/consume | radient-guard-consume-v1\0 |
Identifiers (tenant, install_id) are 1 to 128 characters from A-Za-z0-9_-. A nonce is 16 to 128 characters from the same set and is used once. ts is Unix seconds and must be within 15 minutes of the server's clock. A body over 8 KiB for a grant, report or consume, or 256 KiB for a batch, is refused.
#Grant payload
{
"tenant": "acme-team", "install_id": "…", "collection_rev": 1, "revocation_gen": 0,
"scopes": ["decisions", "task_time"], "terms_digest": "sha256:…", "nonce": "…", "ts": 1790000000,
"enroll": {"public_key": "<base64url raw key>", "device_name": "my-harness"}
}
collection_rev,revocation_genandscopescome from the statusprompt;terms_digestisprompt.rendered_terms_digest.enrollappears only on the first grant from a computer.device_nameis optional, 1 to 64 printable ASCII characters, and shows in the member's own timeline only.scopesis a non-empty list with no repeats, drawn fromdecisions,posture,task_time,review_cycles,reports,trace_detailandadmin_share. A grant is all or nothing: it accepts exactly the scopes offered.- Answers:
201for a new consent (kindisstarted,widenedornarrowed),200when an identical consent is already in force (kindisunchanged; no new record, no new email).
#Batch payload
{
"schema": "guard_batch_v1", "tenant", "install_id",
"batch_id": "<32 lowercase hex>", "nonce": "<16-128 of A-Za-z0-9_->", "ts": <unix seconds>,
"collection_rev": <from binding>, "revocation_gen": <from binding>,
"decisions": [...], "task_time": [...], "review_cycles": [...], "posture": [...]
}
- A family may be omitted or empty, but at least one record is required.
- Caps per batch: 1024
decisions, 256task_time, 64review_cycles, 16posture, and a 256 KiB body. Over a cap:413 guard_batch_too_large. collection_revandrevocation_genare the only generations on the wire. Radient binds everything else (the organization's settings revision, plan generation, key generation and consent identity) from its own rows. A payload that names any of them is refused as an unknown key.
#Record families and closed values
Every record carries its own schema. An unknown key or a value outside the list refuses the whole batch with 400 guard_invalid_request and stores nothing.
| Family and schema | Keys and allowed values |
|---|---|
decisions, guard_decision_v1 | record_id (32 hex), day (UTC YYYY-MM-DD), outcome: block warn allow pass; rule_class: dangerous_delete policy_write custom guard_error; tool_class: shell file_write file_read browser web other |
task_time, guard_task_time_v1 | record_id, day, workflow_class: coder reviewer architect manager designer scout general other; terminal_state: done cancelled dropped blocked; active_duration_band: lt_1m 1m_5m 5m_15m 15m_60m 1h_4h gt_4h, present if and only if terminal_state is done |
review_cycles, guard_review_cycle_v1 | record_id, day, terminal_outcome: merged closed; rounds_band: 1 2 3 4_plus (strings); source: harness_code_requests github gitlab |
posture, guard_posture_v1 | fact, week (ISO YYYY-Www), bit: 0 or 1. No record_id and no other value |
Notes for producers:
workflow_classusesgeneralfor a top-level task andotherfor any agent the operator named: never send the name. Your own agent roles map onto these eight values.active_duration_bandis for active time. If tasks run in parallel or nest, combine their overlapping intervals first, so the same minute is never counted twice.review_cycles.source:harness_code_requestsis for review cycles tracked inside your harness.githubandgitlabare reserved for forge adapters that have been enrolled with Radient.tool_classandrule_classdescribe kinds, never instances:customis any rule the user wrote, and no rule or tool name is ever sent.- Friction (how often a rule blocked someone) stays on the computer. It leaves only as a band inside a report the member confirms (see below).
#Posture
Posture records answer "are the recommended settings on?" for six facts. Each name states its recommended reading, and bit is the answer to "is it recommended?".
| Fact | Recommended when |
|---|---|
guardrails_enabled | guardrails are on |
critical_override_off | the critical override is not set |
user_rules_present | there is at least one user rule |
builtin_policy_intact | the shipped default policy is unmodified |
guard_version_current | the harness runs the newest known release |
update_check_recent | an update check ran within the last 7 days |
Randomise before you send. The bit you send is never the true answer directly. Send the true answer with probability 0.75 and its opposite with probability 0.25 (randomised response, ε = ln 3), and draw once per (member, fact, true value), then reuse that draw whenever the same true value comes back, including after a revoke, a re-grant or an organization turning Guard off and on. Drawing fresh each week lets repeated reports be averaged back to the real answer. The server never sees or stores the true value, so this promise is kept by your harness and tested by the conformance checklist.
How posture is counted:
- The first computer of a member's account to report a fact becomes its designated computer. A record from any other computer of that account is rejected with
guard_posture_not_designated, and nothing is stored. - A posture bit is state, not an event. Send it again whenever it changes, including when it changes back.
- The same week and the same bit is a
duplicate. The same week and a different bit replaces it: the later signed day wins, and an older day never overwrites a newer one. - Send the current week's bits during the week. A week is open from its Monday until 24 hours after it ends.
#Windows
A record outside its window is rejected per record with guard_day_closed, inside a 200 answer.
| Records | Accepted from | Accepted until |
|---|---|---|
decisions, task_time, review_cycles (a UTC day) | the start of that day | 72 hours after the day ends |
posture (an ISO week) | that week's Monday | 24 hours after the week ends |
The 72 hours let a laptop that was closed from Friday evening to Monday morning still deliver Friday. A day is never accepted after it has been released into an organization's totals. Treat guard_day_closed as "too late", not as delivered: delete the record.
#Idempotency
- Per record:
record_idnames one occurrence: mint it when the event happens and keep it with the queued record. Sending that record again counts as aduplicate, so two separate events that share arecord_idcount once. A different record under an id already held is rejected asguard_record_conflict. Whether that comes back as a rejected record or a refused batch depends on thebatch_id: sent in a batch with a newbatch_id(for example beside other new records), the batch answers200and lists the record underrejectedasguard_record_conflict; sent alone with thebatch_idyour client derives, thatbatch_idequals the first batch's only when the first batch held just that record, and then the answer is409 guard_replay. - Per batch, events only:
batch_idis matched on the events (decisions,task_time,review_cycles) and the header (tenant, install,batch_id,collection_rev,revocation_gen), withoutnonce,tsorposture. A retry with a fresh nonce andtsreturns the stored result with"replayed": trueand inserts nothing. The samebatch_idwith a different set of events is409 guard_replay. A batch that stored nothing leaves nothing behind, so it can never turn a later valid batch under the same id into a replay. - Posture is not part of the batch receipt. It is evaluated afresh on every arrival, by the rules above, so a changed bit under an unchanged
batch_idis accepted.
A good batch_id is the first 32 hex characters of a SHA-256 over the tenant and the sorted record ids. Both quickstart clients do this. It follows that a conflicting record sent alone has the same batch_id as the batch it conflicts with, and answers 409 guard_replay; the guard_record_conflict rejection appears when the record travels in a batch with a new batch_id.
#The 200 answer
{"batch_id", "replayed": bool, "accepted": <new records across families>, "refused_fields": ["<family refused whole>"],
"decisions" | "task_time" | "review_cycles" | "posture": {
"status": "accepted" | "refused", "code"?, "accepted", "duplicate",
"rejected": [{"ref": "<record_id or fact@week>", "code": "guard_day_closed" | "guard_record_conflict" | "guard_posture_not_designated"}]}}
A family outside the member's consent and the organization's current ceiling is refused with guard_scope_not_consented, and the other families are still stored. If every non-empty family is refused, the answer is 403 guard_scope_not_consented and nothing is stored. This is how a member at an older settings revision keeps sending after an admin widens the ceiling.
#Refusals
Every refusal below writes zero records, including the bookkeeping. They are checked in this order. The computer's signature is verified before anything about the organization is read, so a caller without the key learns nothing about membership, plan or organization state.
| Status and code | Meaning | What the producer does |
|---|---|---|
401 (no Guard code) | No or invalid token | Sign in again |
403 guard_browser_refused | A Cookie or Origin header was present | A bug: never send them |
403 guard_device_signature_required | No envelope, a malformed one, or a signature that does not verify | Stop |
400 guard_invalid_request | Outside the grammar: unknown, case-variant or duplicate key, or a value outside the list | Drop the batch |
413 guard_batch_too_large | Over a cap | Split |
400 guard_request_expired | ts more than 15 minutes from the server | Re-sign with the current time |
403 guard_device_unknown, guard_device_revoked | This account holds no live computer for install_id | Stop |
403 not_a_member, guard_membership_inactive | Membership | Stop for this organization |
403 guard_not_entitled, guard_org_not_on | The plan lapsed, or the organization is off | Pause |
409 guard_revocation_stale | A revoke landed from any surface | Sticky stop; discard the queue |
403 guard_consent_not_live | No live consent for this computer, or one from before a rejoin or re-activation | Stop; discard the queue |
409 guard_binding_stale | collection_rev is not the consent's | Discard what was prepared; read binding before collecting more |
403 guard_scope_not_consented | Every family was refused | Drop those families |
409 guard_replay | batch_id reused for a different set of events | A bug |
429 guard_rate_limited (+ Retry-After) | Too many writes | Back off |
404 guard_not_available | No Guard on this deployment | Stop; do not loop |
Grant-specific refusals: 409 guard_offer_stale (the organization changed what it offers since your prompt: re-read status and show the new prompt), 409 guard_device_conflict (this install is registered with a different key), 403 guard_device_revoked (a removed key stays removed; make a new key and a new install_id), 409 guard_replay (the nonce was already used), 400 guard_grant_expired (the signed ts is outside the window), 429 guard_enroll_quota (a 4th enrolment in 24 hours, or an 11th live computer on the account).
Errors answer {"code": "…", "error": "…"} with a fixed sentence and no caller data. Match on code.
#Limits
| What | Limit |
|---|---|
| Writes (ingest, reports, report drafts, consume) | Per account, burst 60 then 1 per 5 seconds, shared across those routes |
binding reads | Per account, burst 30 then 1 per second |
| Grants | Per account, burst 20 then 1 every 3 minutes (Retry-After: 180) |
| Stops (revokes) | Per account, burst 60 then 1 a minute. A stop that would end a live consent or computer is never refused |
| Enrolment | 3 new computers per account per 24 hours; 10 live computers per account |
| Time skew | ts within 15 minutes |
#Reports
A report is a short, closed-list statement a member chooses to send. guard_report_v1 carries no free text, credential value, hash, path or identity.
{"schema": "guard_report_v1", "kind": "suspected_credential_exposure" | "excessive_friction",
"credential_type"?: api_key | access_token | password | private_key | cloud_credential | database_credential | unknown, (exposure: required)
"exposure_context"?: seen_in_output | seen_in_file | pasted_by_me | other, (exposure: required)
"friction_rule_class"?: <a decisions rule_class>, (friction: required)
"friction_block_count_band"?: 0 | 1_5 | 6_20 | gt_20, (friction, one-shot only, optional)
"severity_self": low | medium | high, "day": YYYY-MM-DD, "provenance": "client_reported", "origin": agent_drafted | human_initiated}
When more than one credential_type applies, label by the first that applies in this order: private_key, cloud_credential, database_credential, access_token, api_key, password, unknown. An AWS access key pair is cloud_credential, never api_key.
One-shot reports need no reports scope, because the member confirms each one:
- Anything with the member's token (the harness, an MCP assistant or the console) calls
POST /v1/guard/report-actionswith{tenant, install_id, report}. The computer must be registered, with a live key. The answer is201withaction_id, adigestof the canonical report, the canonicalreport,confirm_deadline(120 seconds after drafting) andstatus: "pending". - The harness shows the member exactly that report. Only the harness can send it: it signs
{"schema": "guard_report_consume_v1", action_id, digest, install_id, nonce, ts}with the consume domain and posts it toPOST /v1/guard/report-actions/consume. The answer is{receipt_id, action_id, digest, committed_at, committed, replayed}, andcommitted_atis the day at midnight UTC. - Assistants and the console can draft and read status. They can never send: no route accepts a consume without the computer's signature.
Refusals: guard_action_expired (not confirmed within 120 seconds: draft again), guard_digest_mismatch, guard_action_not_found (also for another account's action), guard_binding_stale (the organization's settings moved since the draft: draft again), guard_report_quota (3 per member per kind per UTC day, and 50 per organization per day).
Standing reports need the reports scope and no confirmation: sign {"schema": "guard_report_submit_v1", tenant, install_id, client_report_id (32 hex), created_day, ts, collection_rev, revocation_gen, report} with the report domain and post it to POST /v1/guard/reports. They are admitted like a batch and are idempotent on (install, client_report_id). A created_day more than 7 days old is 400 guard_report_stale; one in the future is 400 guard_invalid_request. A standing report never carries friction_block_count_band.
#Binding
GET /v1/guard/binding?tenant=&install_id= returns exactly {tenant, install_id, collection_rev, revocation_gen, scopes}, where scopes is what this computer may send now (the member's consent, limited by the organization's current ceiling). It refuses the way a batch would, in the same order. Reading it is optional, but it is the cleanest way to get the two generations a batch must carry.
#How long Radient keeps things
Stats and reports expire from their own period, never from when they arrived. A few small records work differently, and the table says which.
| Data | Kept until |
|---|---|
| Decision, task and review records | 90 days after the day ends |
| Reports | 180 days after the period ends |
| Report confirmations | 30 days after the day the report was confirmed. The record names the account and the computer and holds no report text. |
| A pending report draft | 10 minutes after it was drafted |
| Posture bits | 9 days after the week starts, or earlier once the week's totals are published |
| Setup-check computer | For as long as the Radient account exists. It records which of the account's computers reports setup checks, and holds no time and no answer. |
| Consent, computer and timeline records | No expiry date. They are kept while the account exists, because the member's own Guard timeline reads them. Erasing them when an account is deleted is required before Guard is switched on for members, and is not live yet. |
| Backups | A removed record is also removed from backups within 31 days |
Times. Stats and reports carry a day or a week, never a finer time. The records that make up a member's own Guard timeline keep exact times, because the timeline shows them: when a consent was given and when it ended, when a computer was added or removed, and the time on each timeline entry. The membership record also keeps the time of the member's most recent Guard activity (a batch, a report draft or a report confirmation). No Guard route returns that last one. The only other exact times are in a pending report draft, which needs real instants for its 120-second window.