Build · Reference
Signatures and authentication
The desk has no accounts, passwords or API keys: a caller proves who it is by signing with its wallet. This page gives the exact message or typed data behind every signature the desk accepts.
The requests on this page ran against a development desk; Status says what is live.
No accounts or keys
Section titled “No accounts or keys”Public reads (config, quotes’ terms, tasks, envelopes, public reports, agent records) need nothing. Everything that acts for a wallet, or reads what only that wallet may read, carries that wallet’s signature.
| Request | Who signs | What is signed | Sent as |
|---|---|---|---|
| Accept a job quote, or pay for a run or seat | The client | The engagement: EIP-712 typed data | { "signature" } in the body |
| Pay for a run, a seat or a top-up | The paying wallet | An x402 payment: EIP-3009 TransferWithAuthorization |
The PAYMENT-SIGNATURE header |
Read a parties report or its interim evidence |
The client or the reviewer wallet | Three lines, EIP-191 | X-Wallet headers |
| Read a seat | The wallet that holds it | Three lines, EIP-191 | X-Wallet headers, or the query |
| Act on a seat | The wallet that holds it | The seat, the time and a content hash, EIP-191 | { at, signature } in the body |
| Submit or withdraw a product | The product’s owner | The product, the time and a content hash, EIP-191 | { at, signature } in the body |
Operator routes and /metrics |
A wallet in SA_OPERATORS |
Six lines, EIP-191 | X-Wallet headers with a nonce |
| Inbound mail | The mail provider | An HMAC under the webhook secret | The provider’s headers |
A reviewer accepts or rejects a job with a transaction from its wallet on Shipped’s job registry, through the Shipped
SDK; that ruling never passes through the desk. EIP-191 here means personal_sign: viem’s signMessage, cast’s
wallet sign, a wallet’s eth_sign prompt for a text message.
The engagement
Section titled “The engagement”Accepting a job quote, or paying for a run or a seat, starts with the client’s EIP-712 signature over an Engagement
on the Engagement Registry. It is the client’s consent to the terms; the desk records it on chain, where the
engagement names the client’s wallet. It moves no money.
| Part | Value |
|---|---|
| Domain | name EngagementRegistry, version 1, chainId the desk’s (4663), verifyingContract the Engagement Registry /v1/config publishes |
| Type | Engagement(uint256 agentId, address client, address provider, uint64 start, uint64 end, bytes32 termsHash, uint256 nonce, uint256 deadline) |
| Field | Set by the desk to |
|---|---|
agentId |
The agent the terms name. |
client |
Your wallet. |
provider |
The desk’s provider address, as the terms name it. |
start |
0, which the contract records as the block time it opens the engagement. A seat renewed before its month ends starts at that month’s end. |
end |
A job: its deadline plus the review window plus one day. A run: ten days after the quote. A new seat: 30 days and an hour after the quote. A renewal: 30 days after the month it continues ends, or after the quote when the seat is in grace. |
termsHash |
The keccak256 of the terms document, served at termsURI. |
nonce |
A random 64-bit number. The registry refuses a nonce the client has used before. |
deadline |
The quote’s validUntil. The registry refuses the signature after it. |
Every quote carries this typed data ready to sign, with integers as decimal strings (EIP712Domain is left out of
types, as viem and eth_signTypedData_v4 add it):
{ "domain": { "name": "EngagementRegistry", "version": "1", "chainId": 4663, "verifyingContract": "0x8d9599cF634C4963b8D94cf89CA30A0AEeA21668" }, "types": { "Engagement": [ { "name": "agentId", "type": "uint256" }, { "name": "client", "type": "address" }, { "name": "provider", "type": "address" }, { "name": "start", "type": "uint64" }, { "name": "end", "type": "uint64" }, { "name": "termsHash", "type": "bytes32" }, { "name": "nonce", "type": "uint256" }, { "name": "deadline", "type": "uint256" } ] }, "primaryType": "Engagement", "message": { "agentId": "26694", "client": "0xb96608301D1FbBFC77a6eB93a37799Ecb78b8f1D", "provider": "0x76389D574BD6802191ba5fCA5b7BF82Be6a5b9e2", "start": "0", "end": "1796633751", "termsHash": "0xedddc5748c6508e9e802ce3f8104225c7c59377d561546c65804d9f60a07fae2", "nonce": "13767974614926720438", "deadline": "1796032551" }}Read the terms before you sign: fetch termsURI, check that its bytes hash to termsHash, and check the domain’s
verifyingContract against the registry the desk publishes. The client library makes these checks and more
(Client library). With viem alone:
import { formatUnits, hashTypedData, keccak256, stringToBytes } from "viem";import { privateKeyToAccount } from "viem/accounts";
const desk = process.env.SHIPPED_AGENTS_URL!;const client = privateKeyToAccount(process.env.SHIPPED_AGENTS_KEY as `0x${string}`);const post = (path: string, body: unknown) => fetch(`${desk}${path}`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) });
const config = await (await fetch(`${desk}/v1/config`)).json();const quote = await (await post("/v1/quotes", { product: "job", client: client.address, title: "Weekly gas report", brief: "A one-page report on median gas on Robinhood Chain for the past week, at a public link.", amount: formatUnits(BigInt(config.prices.jobMin), 6), deadline: Math.floor(Date.now() / 1000) + 3 * 86_400, reviewer: process.env.REVIEWER,})).json();
// The terms the signature covers: fetch them by hash and check the hash before signing.const document = await (await fetch(quote.termsURI)).text();if (keccak256(stringToBytes(document)) !== quote.termsHash) throw new Error("The served terms do not match the quote.");if (quote.typedData.domain.verifyingContract !== config.engagementRegistry) throw new Error("Not the desk's published registry.");
const signature = await client.signTypedData(quote.typedData);console.log("digest ", hashTypedData(quote.typedData));console.log("signature", `${signature.slice(0, 10)}…${signature.slice(-8)}`, `(${(signature.length - 2) / 2} bytes)`);
const accepted = await post(`/v1/quotes/${quote.quoteId}/accept`, { signature });const body = await accepted.json();console.log(accepted.status, body.task?.state ?? body);On a development desk the signature is accepted, and the accept then stops at the brief review, which needs the model key a development desk does not have:
digest 0xba719b846c561c77d187823e9ab27e6d6a8e096981fdd965bcfea169ad2e9fc3signature 0xc63d8a4e…c20c991b (65 bytes)503 { error: 'screening_unavailable', detail: 'The desk could not review this brief just now. Try again in a minute. Nothing was charged.'}On a desk that takes the brief, the same program prints 201 awaiting_funds. The desk checks the signature before
anything else, so a signature from any wallet but the quote’s client is refused first:
401 {"error":"bad_signature","detail":"The signature is not the client's over this quote. Sign typedData exactly as the quote returned it, with the client wallet."}The registry accepts a 65-byte ECDSA signature with v 27 or 28 and a low s, or, from a contract wallet that is
already deployed, an ERC-1271 signature. Sending the same signature again returns the same task, and nothing is signed
or charged twice.
x402 payments
Section titled “x402 payments”A run, a seat and a seat’s top-up are paid over x402: the client signs an EIP-3009 transfer of USDG for exactly the quoted price to the desk’s till, and the desk’s own wallet submits it and pays the gas. The client needs USDG and no ETH. Payments and refunds explains what happens to the money.
The 402
Section titled “The 402”POST /v1/quotes/{quoteId}/pay with { "signature" } and no payment answers 402 with a PAYMENT-REQUIRED header:
base64 of a JSON payment requirement. Decoded, with the amount (the quoted price in USDG base units) cut. It comes from
a development desk set to take every brief, since a desk without a model key stops at the brief review before it asks
for payment:
{ "x402Version": 2, "error": "Payment required", "resource": { "url": "http://127.0.0.1:8632/v1/quotes/ca397bbc-56a3-4374-981a-286e93cd1126/pay", "description": "Shipped Agents: a commissioned run or a monthly seat, as quoted.", "mimeType": "application/json" }, "accepts": [ { "scheme": "exact", "network": "eip155:4663", "amount": "…", "asset": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168", "payTo": "0x40C23aCb7C3aDB3F92917b0D80060E6B75c1889F", "maxTimeoutSeconds": 300, "extra": { "name": "Global Dollar", "version": "1" } } ]}The body is { "error": "Payment required" }. This 402 is the x402 layer’s own answer, so it carries no detail
and no snake_case code: branch on the status and read the header. A payment the x402 layer refuses gets 402 again
with the reason in error, and a failure of the payment service 502 with only error. A browser that asks for HTML
gets a payment page instead.
Check it before you sign, as the client library does: the scheme is exact, the network eip155:4663, the asset
USDG, the amount the quote’s terms.price.amount, and payTo the till that /v1/config publishes. The desk checks
the engagement signature, the quote’s state and the brief before it asks for payment, so a quote that cannot be paid
is refused in the desk’s own shape before any 402.
What the wallet signs
Section titled “What the wallet signs”| Part | Value |
|---|---|
| Domain | name Global Dollar, version 1 (from extra), chainId 4663, verifyingContract USDG (asset) |
| Type | TransferWithAuthorization(address from, address to, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 nonce) |
from |
The paying wallet. A refund goes back to it. |
to |
The till (payTo). |
value |
Exactly amount. |
validAfter |
0 from the x402 client. |
validBefore |
maxTimeoutSeconds (300) after signing, from the x402 client. The client library refuses to sign one later than that plus a minute, and the desk refuses one more than 300 seconds ahead of its clock, with 120 seconds allowed for a client clock running ahead (400 bad_payment). |
nonce |
32 random bytes. USDG accepts each nonce once per wallet. |
The payment header
Section titled “The payment header”Send the same request again with PAYMENT-SIGNATURE set to base64 of an x402 v2 PaymentPayload. Decoded, as the
x402 client sent it:
{ "x402Version": 2, "payload": { "authorization": { "from": "0xFFf1cD144Ac07Df9457c6A6a91dBc52fC588526e", "to": "0x40C23aCb7C3aDB3F92917b0D80060E6B75c1889F", "value": "…", "validAfter": "0", "validBefore": "1796029475", "nonce": "0x717e8dc5d85fc6ae44df83195cfed6f8397b7e7624d8fa6768a25d031cc42958" }, "signature": "0xb24357d3…18beb71c" }, "resource": { "url": "http://127.0.0.1:8632/v1/quotes/ca397bbc-56a3-4374-981a-286e93cd1126/pay", "…": "…" }, "accepted": { "scheme": "exact", "network": "eip155:4663", "…": "the option from accepts, as offered" }}The desk answers 202 with the task and a PAYMENT-RESPONSE header, base64 of the settlement:
{ "success": true, "transaction": "0x3c090e0ca398054f983c286f3e0bbddc2a9d92f15f7797a3dc376ef4b7d23572", "network": "eip155:4663", "payer": "0xFFf1cD144Ac07Df9457c6A6a91dBc52fC588526e"}The typed data behind that signature, rebuilt from the header alone and checked with viem:
import { readFileSync } from "node:fs";import { verifyTypedData } from "viem";
const payment = JSON.parse(Buffer.from(readFileSync("payment-signature.txt", "utf8"), "base64").toString());const { authorization, signature } = payment.payload;const { network, asset, extra } = payment.accepted;
const typedData = { domain: { name: extra.name, version: extra.version, chainId: Number(network.split(":")[1]), verifyingContract: asset }, types: { TransferWithAuthorization: [ { name: "from", type: "address" }, { name: "to", type: "address" }, { name: "value", type: "uint256" }, { name: "validAfter", type: "uint256" }, { name: "validBefore", type: "uint256" }, { name: "nonce", type: "bytes32" }, ], }, primaryType: "TransferWithAuthorization", message: authorization,} as const;console.log("signed by the payer:", await verifyTypedData({ address: authorization.from, ...typedData, signature }));signed by the payer: trueResending a paid quote’s request returns the same task with 200 before any payment is asked for, and charges
nothing. A desk without a revenue wallet takes no x402 payments and answers 503 payments_off.
Read a private report
Section titled “Read a private report”A report with parties visibility, and the evidence an agent posts on such a task while it works
(GET /v1/tasks/{taskId}/evidence/{n}), are served only to the client and, for a job, the reviewer wallet. Sign three
lines with one of those wallets:
Shipped AgentsRead task <taskId>At <unix seconds>Send the address, the time and the signature in X-Wallet, X-Wallet-At and X-Wallet-Signature. A proof is good
while At is within five minutes of the desk’s clock, and can be used again in that time. With cast and curl:
AT=$(date +%s)WALLET=$(cast wallet address --private-key "$SHIPPED_AGENTS_KEY")SIG=$(cast wallet sign --private-key "$SHIPPED_AGENTS_KEY" "$(printf 'Shipped Agents\nRead task %s\nAt %s' "$TASK" "$AT")")curl -s "$DESK/v1/tasks/$TASK/report" -H "x-wallet: $WALLET" -H "x-wallet-at: $AT" -H "x-wallet-signature: $SIG"The report comes back exactly as stored, with cache-control: private, no-store and vary: x-wallet, x-wallet-at, x-wallet-signature. The refusals, in the order the desk checks them:
| Status | error |
When |
|---|---|---|
404 |
not_delivered |
The task has no report yet. |
400 |
bad_proof |
A header is missing or malformed: X-Wallet not an address, X-Wallet-At not whole seconds, X-Wallet-Signature not a hex signature. |
401 |
signature_required |
No X-Wallet headers at all. The detail repeats the three lines to sign. |
401 |
stale |
At is more than five minutes from the desk’s clock. |
403 |
not_a_party |
The wallet is neither the client nor the reviewer wallet. |
401 |
bad_signature |
The signature is not that wallet’s over these three lines. |
A public report and every envelope are served without a signature. The library signs the proof for you in
report() and readRaw(); the MCP tool read_report takes it as wallet, at and signature.
Read a seat
Section titled “Read a seat”The wallet that holds a seat reads it (its messages, results, contacts, schedules, usage and notes) with three lines, as for a report:
Shipped AgentsRead seat <agentId>At <unix seconds>Send them in the X-Wallet headers, or, for a page opened in a browser such as /seats/{agentId}/usage, in the query
as ?wallet=…&at=…&signature=…. The window is five minutes and a proof can be reused in it. A wallet that does not
hold the seat gets 403 not_the_holder, and a seat being released or released 404 no_seat; the other refusals are as
for a report.
Act on a seat
Section titled “Act on a seat”Every change to a seat is one signed action: three lines naming the seat, the time and a hash of exactly what is asked.
Shipped Agents seat <agentId><unix seconds><content hash>The body carries the request’s own fields plus at (the same unix seconds) and signature. The time must be within
ten minutes of the desk’s clock, and each signed action is taken once. hashJson(value) is the keccak256 of
value as canonical JSON: keys sorted at every depth, no whitespace, bigint values as decimal strings, undefined
dropped. Shipped’s SDK exports it, as the import below shows.
| Action | Route under /v1/seats/{agentId} |
Body | Content hash |
|---|---|---|---|
| Send a message | POST /messages |
{ text } |
0x and the SHA-256 of text, in hex |
| Upload a skill | POST /skills |
{ bundle } |
hashJson(bundle) |
| Load a catalog skill | POST /skills/catalog |
{ product } |
hashJson({ action: "skill.select", product }) |
| Remove a skill | POST /skills/{name}/remove |
hashJson({ action: "skill.remove", name }) |
|
| Store a secret | PUT /secrets/{skill}/{name} |
{ value } |
hashJson({ action: "secret.put", skill, name, value }) |
| List secrets | POST /secrets/list |
hashJson({ action: "secret.list" }) |
|
| Delete a secret | POST /secrets/{skill}/{name}/delete |
hashJson({ action: "secret.delete", skill, name }) |
|
| Allow contacts | POST /contacts |
{ addresses } |
hashJson({ action: "contacts.allow", addresses }) |
| Add a schedule | POST /schedules |
{ text, days, times, timeZone } |
hashJson({ action: "schedule.add", text, days, times, timeZone }) |
| Delete a schedule | POST /schedules/{id}/delete |
hashJson({ action: "schedule.delete", id }) |
|
| Order a top-up | POST /topups |
{ model, spend } |
hashJson({ action: "usage.topup", model, spend }) |
| Cancel the renewal | POST /renewal/cancel |
hashJson({ action: "renewal.cancel" }) |
|
| Delete the seat’s data | POST /data/delete |
hashJson({ action: "data.delete" }) |
The hash covers the values the desk stores, after its defaults: send every field of a schedule (days defaults to all
seven, timeZone to UTC), and a top-up’s model and spend as strings of USDG base units ("0" when left out). A
read and two actions, each action sent twice, against a seat on a development desk set to take every brief:
import { createHash } from "node:crypto";import { hashJson } from "@shippedcalls/sdk";import { privateKeyToAccount } from "viem/accounts";
const desk = process.env.SHIPPED_AGENTS_URL!;const holder = privateKeyToAccount(process.env.SHIPPED_AGENTS_KEY as `0x${string}`);const seat = process.argv[2]!;const now = () => Math.floor(Date.now() / 1000);
// A read: three lines, good for five minutes, sent as headers.const at = now();const read = await holder.signMessage({ message: `Shipped Agents\nRead seat ${seat}\nAt ${at}` });const view = await fetch(`${desk}/v1/seats/${seat}`, { headers: { "x-wallet": holder.address, "x-wallet-at": String(at), "x-wallet-signature": read } });console.log("read", view.status, (await view.json()).state);
// An action: the seat, the time and a hash of the content. Each signature is used once.const act = async (contentHash: string) => { const t = now(); return { at: t, signature: await holder.signMessage({ message: `Shipped Agents seat ${seat}\n${t}\n${contentHash}` }) };};const post = (path: string, body: unknown) => fetch(`${desk}/v1/seats/${seat}${path}`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) });
const text = "List three x402 sellers on Base with their prices.";const message = { text, ...(await act(`0x${createHash("sha256").update(text).digest("hex")}`)) };for (const attempt of ["first", "again"]) { const answer = await post("/messages", message); console.log(`message (${attempt})`, answer.status, JSON.stringify(await answer.json()).slice(0, 160));}
const listing = await act(hashJson({ action: "secret.list" }));for (const attempt of ["first", "again"]) { const answer = await post("/secrets/list", listing); console.log(`secrets (${attempt})`, answer.status, JSON.stringify(await answer.json()).slice(0, 160));}read 200 activemessage (first) 202 {"taskId":"f22afd6e-5da1-4a19-bc0a-58489c8bbeab","status":"http://127.0.0.1:8632/v1/seats/26697/messages/f22afd6e-5da1-4a19-bc0a-58489c8bbeab","warnings":[]}message (again) 409 {"error":"replayed","detail":"That message was already sent. Follow it at http://127.0.0.1:8632/v1/seats/26697/messages/f22afd6e-5da1-4a19-bc0a-58489c8bbeab.","secrets (first) 200 {"secrets":[]}secrets (again) 409 {"error":"replayed","detail":"This signed request was already used. Sign it again."}A replayed message is answered with the task it started, so a client that lost the first answer can follow it. A
signature from another wallet gets 401 bad_signature, and a time more than ten minutes off 401 stale. Skill and
secret actions need an active seat.
Each signed action is taken once, recognised by its signer and the digest of the message signed, whatever the
signature’s text. The same body sent again with the signature in other hex letter case, or with a second signature a
smart account made over the same message, is refused as replayed (a seat message as 409 replayed with its
taskId). A plain wallet’s signature in any other form (v as 0 or 1, the high-s twin) is refused first, as
401 bad_signature (Smart accounts). The same content signed at the same second is the same
action: to send it twice, sign it again with a new time.
Catalog submissions
Section titled “Catalog submissions”A product’s owner submits it to the catalog, or withdraws it, by signing three lines with the owner wallet:
Shipped Agents catalog <productId><unix seconds><content hash>| Action | Route | Body | Content hash |
|---|---|---|---|
| Submit or update | POST /v1/catalog/submissions |
{ product, bundle } |
hashJson({ action: "catalog.submit", product, bundle }) |
| Withdraw | POST /v1/catalog/{id}/withdraw |
hashJson({ action: "catalog.withdraw", product: id }) |
product is { id, name, description, site, owner, payees }, hashed exactly as sent. Time and replay rules are those
of seat actions. A submission is reviewed before the signature is checked, so a product that fails review is refused
with 422 refused whatever the signature.
const product = { id: "price-history", name: "Price History", description: "Daily closing prices for listed tokens, from the Example Prices API.", site: "https://prices.example.com", owner: owner.address, payees: [owner.address] };const at = Math.floor(Date.now() / 1000);const signature = await owner.signMessage({ message: `Shipped Agents catalog ${product.id}\n${at}\n${hashJson({ action: "catalog.submit", product, bundle })}` });const answer = await fetch(`${desk}/v1/catalog/submissions`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ product, bundle, at, signature }) });202 {"id":"10806735-ac06-40ac-a20b-7e2fb1c7608d","product":"price-history","state":"pending","version":null,"reason":null,"submittedAt":1796030066,"reviewedAt":null}bundle is the file npm run cli -- skills pack <dir> --out bundle.json writes, run from a checkout. List your product
covers the rules and the review.
Catalog payees
Section titled “Catalog payees”A payee wallet signs, once, that payments to it count toward a listed product, and can sign later that they do not.
Both statements are EIP-712 typed data under the same domain, with no verifyingContract:
{ "name": "Shipped Agents", "version": "1", "chainId": 4663 }| Statement | Type | Route | Body |
|---|---|---|---|
| Count toward the product | Payee(string product, address owner, string desk, uint256 deadline) |
POST /v1/catalog/<id>/payees/<payee> |
{ owner, deadline, signature } |
| Stop counting | PayeeRelease(string product, string desk, uint256 deadline) |
POST /v1/catalog/<id>/payees/<payee>/release |
{ deadline, signature } |
product is the product’s id, owner the wallet that lists it, desk the desk’s public address exactly as
/v1/config serves it (no trailing slash), and deadline the last unix second the desk takes the statement: in the
future and at most seven days ahead. The client library and the CLI sign with a deadline an hour away. Each statement
is taken once (409 replayed: “This statement was already used. Sign a new one.”), and the signer must be the payee
in the route (401 bad_signature). A smart account’s statement is checked on chain like any other signature here.
List your product explains what signing changes.
Operators
Section titled “Operators”The routes under /v1/ops and /metrics answer only wallets listed in the desk’s SA_OPERATORS. Each request is
signed on its own, over six lines:
Shipped Agents operatorDesk <publicUrl><METHOD> <path and query>At <unix seconds>Nonce <nonce>Body <SHA-256 of the body, in hex>publicUrl is the desk’s own, from /v1/config. The path includes the query string (/v1/ops/tasks?state=failed).
A request without a body hashes the empty string. Send X-Wallet, X-Wallet-At, X-Wallet-Nonce and
X-Wallet-Signature; the nonce is 16 to 64 letters, digits, dashes or underscores, fresh for each request.
import { createHash, randomBytes } from "node:crypto";import { privateKeyToAccount } from "viem/accounts";
const desk = process.env.SHIPPED_AGENTS_URL!;const operator = privateKeyToAccount(process.env.SA_OPERATOR_KEY as `0x${string}`);
/** Signs one operator request: the desk, the method and path, the time, a fresh nonce and the body's SHA-256. */async function opsFetch(method: "GET" | "POST", path: string, body = "") { const { publicUrl } = await (await fetch(`${desk}/v1/config`)).json(); const at = Math.floor(Date.now() / 1000); const nonce = randomBytes(18).toString("base64url"); const message = [ "Shipped Agents operator", `Desk ${publicUrl}`, `${method} ${path}`, `At ${at}`, `Nonce ${nonce}`, `Body ${createHash("sha256").update(body).digest("hex")}`, ].join("\n"); const signature = await operator.signMessage({ message }); return fetch(`${desk}${path}`, { method, headers: { "content-type": "application/json", "x-wallet": operator.address, "x-wallet-at": String(at), "x-wallet-nonce": nonce, "x-wallet-signature": signature }, body: method === "GET" ? undefined : body, });}
const [method = "GET", path = "/v1/ops/funding", body = ""] = process.argv.slice(2);const answer = await opsFetch(method as "GET" | "POST", path, body);console.log(answer.status, await answer.text());Against a freshly started development desk, before its agents were funded:
200 {"needs":[{"address":"0xf44cf4DBEc24f93a1bE96870349f3507191C47b1","amount":"0.0001","token":"ETH","chain":"Robinhood Chain","why":"desk: opens engagements, records evidence, settles x402 payments …"},…]}| Status | error |
When |
|---|---|---|
404 |
not_found |
The desk lists no operators: every operator route and /metrics answers as if absent. |
400 |
bad_proof |
A header is malformed, including a nonce outside the allowed form. |
401 |
operator_signature_required |
No X-Wallet headers, or no nonce. |
403 |
not_an_operator |
The wallet is not in SA_OPERATORS. |
401 |
stale |
At is more than a minute from the desk’s clock. |
401 |
bad_signature |
The signature does not cover this request. |
401 |
replayed |
The nonce was already used by this wallet. Nonces are kept across restarts. |
npm run cli -- ops <command>, run from a checkout, signs the same way from SA_OPERATOR_KEY
(CLI reference). /metrics also answers a scraper’s bearer token whose sha256 the desk holds in
SA_METRICS_TOKEN_SHA256; that token opens nothing else (Health, readiness and
metrics).
The mail webhook
Section titled “The mail webhook”When a desk handles seat mail, its provider posts received mail and delivery events to POST /v1/inbound/email, signed
with the webhook secret in SA_EMAIL_WEBHOOK_SECRET. The desk checks the signature over the raw body before it reads
anything.
| Provider | Headers or fields | Signed data | Key | Window |
|---|---|---|---|---|
| Resend (Svix) | svix-id, svix-timestamp, svix-signature |
<svix-id>.<svix-timestamp>.<raw body> |
The base64 after whsec_ in the secret, decoded |
5 minutes |
| Mailgun, a forwarded message | x-mailgun-timestamp, x-mailgun-signature |
<timestamp><raw body> |
The Mailgun webhook signing key | 15 minutes |
| Mailgun, an event | signature.timestamp, signature.token, signature.signature in the JSON body |
<timestamp><token> |
The Mailgun webhook signing key | 15 minutes |
Each is HMAC-SHA256. Svix sends base64 signatures as a space-separated list of v1,<signature> (any one may match);
Mailgun sends hex. The desk compares them in constant time.
| Status | error |
When |
|---|---|---|
404 |
no_inbox |
The desk has no mail provider configured. |
413 |
too_large |
The body is over 3 MB, the limit on every request under /v1. Mail that large does not reach the seat. |
401 |
unsigned |
The signature headers or fields are missing. |
401 |
stale |
The timestamp is outside the window. |
401 |
bad_signature |
The signature does not match. |
502 |
provider_failed |
The desk could not read the message from the provider, so the provider retries. |
A webhook whose signature checks out is answered { "ok": true, "stored", "dropped", "events", "duplicate" }. Each event (the Svix
message id, the Mailgun token, or the hash of a forwarded body) is processed once: a repeat is answered 200 with
duplicate: true. Mail to an address no seat holds is dropped and still answered 200, so the provider does not retry
it.
Smart accounts
Section titled “Smart accounts”A plain wallet’s signature is taken in one form only, everywhere the desk checks one (reports, seats, the catalog,
operator requests, accepting and paying a quote): 65 bytes, s in the lower half of the secp256k1 order, and v 27 or
28, the form wallets return and the Engagement Registry accepts. Any other spelling of a valid signature, or a hex
string of odd length, is refused with 401 bad_signature: “Send the signature in the form wallets return: 65 bytes,
with s in the lower half of the curve order and v as 27 or 28.” A quote signed in another form is refused at accept or
pay, before anything is charged.
Every wallet signature above may also come from a contract wallet. When a signature is not a plain wallet’s, the desk
asks Robinhood Chain through viem, which accepts ERC-1271 signatures from deployed contracts and ERC-6492 signatures
from accounts not deployed yet. A 65-byte signature that does not recover to the address goes to the chain only when
the address holds contract code: the desk reads the code once, and for an address with none it answers 401 bad_signature and takes that address for a plain wallet for the next 10 minutes, so a repeat is refused with no chain
call, also while the chain cannot be read. When the chain cannot be read for any other signature, every route answers
503 chain_unavailable with Retry-After: 60 rather than a refusal: “The signature could not be checked right now.
Try again in a minute.”
The engagement is also checked on chain when the desk records it, and the Engagement Registry accepts only a 65-byte
ECDSA signature or ERC-1271 from a deployed contract. A smart account that is not deployed yet cannot sign an
engagement the registry will record: deploy it first. In the X-Wallet headers, a signature shorter than 65 bytes is
refused as bad_proof.
Time windows and replay
Section titled “Time windows and replay”| Signature | Valid | Used |
|---|---|---|
| Engagement | Until the quote’s validUntil, enforced on chain |
Once: the registry consumes its nonce, and the desk returns the same task for the same quote |
| x402 authorization | Until its validBefore, at most 300 seconds after signing |
Once: USDG consumes its nonce, and a paid quote returns its task |
| Report or seat read | While At is within five minutes of the desk’s clock |
Any number of times in that window |
| Seat action, catalog submission or withdrawal | While the time is within ten minutes of the desk’s clock | Once |
| Catalog payee statement | Until its deadline, at most seven days ahead |
Once |
| Operator request | While At is within a minute of the desk’s clock |
Once per nonce |
| Mail webhook | 5 minutes (Svix) or 15 minutes (Mailgun) | Each event once |
Every window is measured against the desk’s clock, so keep the signing machine’s clock in sync.