Q API Reference
The Queue API is a set of operations under theagentlink/ prefix. Base URL:
- Trusted Agent operations —
inquire,check-status,cancel— authenticate with an agent key (Authorization: Bearer bs_agent_<name>__<secret>). - User-app operations —
cards,confirm— authenticate with the user’s BotShield session (Clerk JWT) and are called by the BotShield app, not by you. They are documented here for completeness. expireis an internal cron sweep with no public route.
inquire
POST /agentlink/inquire — Propose an action for the user to confirm. Queues a Q card and notifies the user.
Auth: agent key. Idempotency: (agent_id, request_id).
Request
Response — 200
"idempotent_replay": true.
Errors
check-status
GET /agentlink/check-status — Poll for the user’s decision on a previously proposed action.
Auth: agent key.
Request
Response — 200
404 if the request_id is not found for this agent.
cancel
POST /agentlink/cancel — Withdraw a still-queued action.
Auth: agent key. Idempotent: a no-op if the card already resolved.
Request
reason (≤ 200 chars) is optional and surfaced in the audit log.
Response — 200
"already_resolved": true and makes no change.
cards
GET /agentlink/cards — Returns the authenticated user’s currently-queued Q cards. Called by the BotShield app, not by agents.
Auth: Clerk JWT. Scoped to the authenticated user — never returns another user’s cards.
Response — 200
confirm
POST /agentlink/confirm — Commit the user’s staged decisions after a biometric ceremony, signing one Proof of Resolution per card. Called by the BotShield app after the Face ID / Touch ID check passes.
Auth: Clerk JWT.
Request
Response — 200
iat and ceremony_id — the single-act, N-proof guarantee. Each card flips to approved / denied, and BotShield fires the matching q.resolution.confirmed / q.resolution.denied webhook per card.
Errors
expire
POST /agentlink/expire — Internal cron sweep. Marks every queued card past its ttl_at as expired, logs a card.expired audit event, and fires q.resolution.expired. No public route — runs on a periodic (≈60s) schedule. Documented for completeness.
Request
limit (1–1000, default 200) caps cards processed per sweep.
Response — 200
queued, past-TTL cards. Expiry is terminal and produces no Proof of Resolution.
Related
Agent Integration
Prerequisites, idempotency, and the TRUST Layer in context.
Proof of Resolution
Verify the token returned by these operations.