# Futex: human approvals as a service > Futex asks named people to approve an action and tells your system the outcome. You raise a decision under a policy, people act on tasks, and the result reaches you by webhook or by polling. Base URL https://futex.rodmena.co.uk. Every /v1 call takes "Authorization: Bearer futex_sk_...". Longer guides, served as markdown from the Futex repository: - https://futex.rodmena.co.uk/guides/webhooks.md (delivery contract) - https://futex.rodmena.co.uk/guides/api-reference.md (fields, policy rules, acting on behalf, step-up) - https://futex.rodmena.co.uk/guides/provisioning.md (provisioning keys for platforms) - https://futex.rodmena.co.uk/guides/state-machine.md (decision and task states) - https://futex.rodmena.co.uk/docs (live OpenAPI) and https://futex.rodmena.co.uk/claude (setup for coding agents, MCP) ## Tenants and keys A tenant is the isolation boundary. Each tenant has its own row-level security and its own auth namespace. A key from one tenant gets 404 for anything in another, which is the answer for an id that does not exist. If you are a platform serving several customers of your own, give each customer its own Futex tenant. Inside one tenant Futex does not separate your customers. An unpinned key can read and cancel any decision in its tenant by id, and webhook subscriptions and audit reads cover the whole tenant. A key with a policy_allowlist sees only decisions and tasks under its pinned policies (404 for the rest) and gets 403 on webhooks, webhook deliveries, audit and RunFlow bindings. Keys belong to one principal in one tenant, and a principal holds one role. Use one key per job: policy_author create, read and retire policies; read decisions agent_operator request, read and cancel decisions; register webhooks; read inbox attesting_operator as agent_operator, plus the requester field on a decision delegated_actor act on a task for a named person (on_behalf_of); read inbox reviewer act on its own tasks; manage its own delegations auditor read the audit trail and decisions tenant_admin all of the above, plus members, keys and in-place policy edits The key that raises a decision cannot also act on it for someone (403 service_cannot_act_on_own_submission). Keep raising and acting on separate keys. A member's role change applies to that member's keys at once. The response to POST /v1/tenants/{id}/members carries keys_refreshed, the number of active keys whose cached permissions were dropped. The same holds for a provisioning key when the Futex operator changes the roles it may grant. In CI, store each Futex key as its own single-line secret. Never print the key or the job's environment in a CI step, because CI logs keep what a step prints. ## Provisioning keys (platforms that create tenants at runtime) The Futex operator issues a provisioning key per environment. It creates tenants, adds members and mints keys, and only in tenants it created. It cannot read decisions, policies, audit or webhooks, and every route outside /v1/provisioning/* answers 403 to it. POST /v1/provisioning/tenants {"name": "..."} 409 tenant_name_exists carries error.details.tenant_id; treat it as success GET /v1/provisioning/tenants?name=&limit=&offset= POST /v1/provisioning/tenants/{id}/members {"principal_id", "role"} POST /v1/provisioning/tenants/{id}/api-keys {"principal_id", "name"?, "policy_allowlist"?} the api_key is in this response only GET /v1/provisioning/tenants/{id}/api-keys DELETE /v1/provisioning/tenants/{id}/api-keys/{key_id} DELETE /v1/provisioning/tenants/{id} 409 open_decisions while any decision is open; otherwise closes the tenant and revokes its keys Setting up one customer: create the tenant, add one member per role you need, mint one key per member, create the policies with the policy_author key, then register the webhook with the runtime key. Every provisioning key can grant policy_author, agent_operator and reviewer. The Futex operator can also let a key grant attesting_operator, delegated_actor and auditor, one by one; ask the Futex agent on AgentBus. A 422 on a member add lists the roles your key may grant. No provisioning key grants tenant_admin. ## Policies POST /v1/policies {name, definition} with a policy_author key. Controls live at definition level. A step takes only name, mode, assignees, n_required, sla and reject_is_terminal. Anything else at any level answers 422 naming the field. {"stages": [{"name": "committee", "steps": [{ "name": "two-of-three", "mode": "n_of_m", "n_required": 2, "assignees": ["user-a", "user-b", "user-c"], "sla": "P3D", "reject_is_terminal": true}]}], "reason_codes": ["incomplete", "out_of_scope"], "require_reason_on_reject": true, "sod_rules": {"submitter_cannot_act": true}, "delegation_allowed": false, "expiration_action": "timed_out", "notifications": "none"} - mode is all_of, any_of or n_of_m. Stages run in order, and the steps in a stage run in parallel. - assignees and escalation targets are literal principal ids. Use a stable user id. Futex has no directory and does not resolve role words such as "manager". - notifications "none" stops all email for the policy. Tasks, webhooks, expiry and audit carry on. Use it when people approve in your own screens, and for test policies. - require_step_up true mails a one-time code to the assignee before an action is accepted. allow_one_click_approve true mails an approve link. Leave both false if your users never get email from Futex. - delegation_allowed defaults to true. Set it false unless assignees may hand tasks to each other in Futex. - sod_rules accepts submitter_cannot_act and mutually_exclusive_principals. Other names answer 422. - expiration_action "timed_out" ends an unanswered decision as timed_out. "auto_approve" approves it. - A step with an sla and no escalation_path gets 3 reminders (after 1 hour, then 4 hours). With notifications "none" they are stored as suppressed. The create response carries the stored definition. Compare its values with what you sent. Fields you left out come back at their defaults. Changing a policy: PUT /v1/policies/{id} {definition, expected_version} needs tenant_admin on an unpinned key. Without it, create a new policy, send new decisions to the new id and retire the old one with POST /v1/policies/{id}/retire. A retired policy answers 409 to new decisions. Open decisions finish under the definition they were raised with. ## Decisions POST /v1/decisions with an agent_operator or attesting_operator key: {"policy_id": "pol_...", "idempotency_key": "...", "title": "...", "summary": "...", "proposed_action": {...}, "context": {...}, "expires_in_hours": 72, "requester": "user-x"} - The create returns at once with status pending. Proceed only when GET /v1/decisions/{id} shows status approved. - idempotency_key is required. Derive it from the request. The same key and body returns the same decision. The same key with a different body answers 409 idempotency_key_reused and lists details.mismatched_fields. - requester names the person who asked, and needs attesting_operator. Futex then applies submitter_cannot_act to that person. If removing them leaves a step short of approvers, the create answers 422 requester_is_assignee. Without the role it answers 403 attestation_not_permitted. - on_behalf_of on a decision is display text and binds no identity. - A closed decision names who acted. outcome.actors[] lists each action with actor_id, acting_as, acting_service, action and at. outcome.terminated_by gives the actor_id, via and at of the action that closed the decision. actor_id is the principal as the policy's assignees list writes it, and Futex does not change its case. When a delegate acted, actor_id is the delegate and acting_as is the assignee. - via says how the closing action arrived. action_web means the holder of the review link mailed to actor_id pressed the button. action_web_otp means they also entered the step-up code mailed to that address. one_click is the confirm link in the same email. rest and mcp mean an API key acted: actor_id is the key's own principal, or the person a delegated_actor key named in on_behalf_of, and then acting_service holds that key's principal. Read actor_id as the person's own act only when via is action_web, action_web_otp or one_click and acting_service is null. - POST /v1/decisions/{id}/cancel cancels it. The decision then reads status cancelled with outcome.result cancelled. On a decision that has already ended (approved, rejected, changes_requested, timed_out or cancelled) it answers 409 with error.code conflict and the message "Decision already terminal". The decision stays as it was and no second decision.terminal is sent. - Statuses: pending, in_review, escalated, approved_pending_clearance, then one of approved, rejected, changes_requested, timed_out, cancelled. - Times are UTC in ISO 8601 with no zone designator, for example 2026-11-26T18:42:43.618835. This covers expires_at, terminal_at, the at fields inside outcome, queued_at and sent_at in API responses, and terminal_at in a webhook body. Parse a time that has no zone as UTC. Before acting on an approval, recompute context_hash from GET /v1/decisions/{id}: "sha256:" + sha256(json.dumps({"context": context, "proposed_action": proposed_action, "policy_version": policy_version}, sort_keys=True)) Use Python's default separators (", " and ": " with spaces). Compact separators produce a different digest. ## Acting on tasks - GET /v1/inbox/tasks lists the caller's open tasks. With a delegated_actor key, add ?on_behalf_of= to list that person's tasks, and &decision_id=dec_... to narrow it. - POST /v1/tasks/{id}/actions {"type": "approve"}. A delegated_actor adds "on_behalf_of": "". The person must be the assignee or their delegate, and separation of duty applies to them. Futex records them as the actor and the key's principal as acting_service. - Types: approve, reject, request_changes, amend_and_approve, escalate, delegate_task, abstain, request_clearance. - reject and request_changes need reason_code (from the policy) and reason_text. Without them the action answers 422. - With require_step_up, the first POST answers 401 step_up_required and mails a code to the assignee. Send the action again with "otp". - When that code email cannot be sent, the POST answers 503 step_up_code_not_sent with Retry-After: 5, and no code is valid. Send the action again without "otp". - Refusals: 403 act_on_behalf_not_permitted, 403 service_cannot_act_on_own_submission, 422 invalid_on_behalf_of, 409 when the task is no longer actionable. - amend_and_approve sends "amendments": {"": }. Each pointer must be in the policy's amendments.fields, its parent object must exist in proposed_action, and the amended proposed_action must pass amendments.schema. It is accepted only on the last stage (422 AMEND_NOT_LAST_STEP otherwise). - The emailed review page shows one answer box per allowlisted pointer when the policy has amendments.allowed. On such a page the approve button reads "Approve with these answers", both in the decision panel and under the list, and it records amend_and_approve with the value shown in each box. A box the reviewer did not change is recorded with the requester's value. An empty number box is left out, and so is an empty text box whose value the requester did not send. The page has no plain approve for these requests, and a plain approve posted from a copy of the page rendered before 24 November 2026 is refused with 422. REST and MCP callers can still send approve, which accepts the request as sent. - To tell an answered request from one approved as sent, read outcome.actors[].action. With amend_and_approve the reviewer's answers are in outcome.amendments. With approve, outcome.amendments is {} and the answers are the ones you sent in proposed_action. - A text answer is recorded with LF newlines. A text box the reviewer left as sent is recorded byte for byte as the requester sent it. - On a policy with require_justification_on_approve, approve, amend_and_approve and request_clearance each need a justification (422 otherwise). For request_clearance this holds from 25 November 2026. - A request whose review page shows answer boxes gets no one-click link in its email, whatever allow_one_click_approve says. A one-click link mailed for such a request before 25 November 2026 is refused with 403 answers_required, and its page points to the review link. Requests whose page shows no answer boxes keep the link. - A review page submitted after its 30-minute session has ended records nothing and is shown again with the reviewer's entries still filled in. The second press records the action. - The box type comes from the sub-schema at the pointer: radio buttons for enum, Yes/No for boolean, a text box for string (with maxLength), a number box for integer and number. A parent object's "title" string heads its group, and its "link" is shown as a link when it starts with https://. - After an amend_and_approve, outcome.amendments holds the pointer-to-value map that was recorded and outcome.effective_context_hash is the context_hash formula computed over the amended proposed_action. It is null when nothing was amended. context_hash itself never changes. ## Notification email - GET /v1/decisions/{id}/notifications lists each email Futex queued for the decision. state "sent" means mail-api accepted the message. attempts is the number of failed tries, which is 0 when mail-api accepted the message first time. mail_track_id is mail-api's track id for that message (null for mail sent before 20 Nov 2026). Ask mail-api what happened after acceptance. - POST /v1/decisions/{id}/notifications/resend emails the current reviewer again with a new link. It needs hitl:decision:cancel and works once every 5 minutes (429 with Retry-After before that). - Reminders are sent only for a step with an sla (see above). A step without one gets only the first email. - The email and the review page both show an Issuer line: your platform's name, the submitting principal, the requester when you sent one, and the on_behalf_of text when you sent it. - The email shows the first 500 characters of summary. When the summary is longer, a line after them says it is cut and points to the review page. The email shows proposed_action as text up to 2,000 characters, then a line that points to the review page. The review page shows summary and proposed_action in full. context is shown to the approver in neither. - title and summary are outside context_hash. Put what the approver must see, and what you will act on, in proposed_action. ## Webhooks POST /v1/webhooks {"url": "https://...", "secret": "...", "events": [...]} with a key holding hitl:webhook:manage. A subscription belongs to one tenant. An empty or missing events list means every event. Event names are matched exactly. An unknown name is stored without error and receives nothing. These are the names Futex emits: EVENTS: decision.created, decision.terminal, decision.escalated, decision.clearance_required, decision.gate_revived, decision.workflow_withdrawn, decision.binding_credential_rejected, decision.binding_unobservable, task.assigned, task.completed, policy.created, policy.updated, tenant.created, delegation.created, delegation.accepted, delegation.revoked Every ending arrives as decision.terminal. Branch on outcome.result (approved, rejected, changes_requested, timed_out, cancelled). There are no separate approved, rejected or cancelled events. task.assigned carries data {"decision_id", "assignee"}. Body: {"event_id", "event_type", "tenant_id", "resource": {"type", "id"}, "data"}. For decision.terminal, resource.type is "decision", and resource.id and data.decision_id both hold the decision's id. The body has no top-level decision_id. data also carries status, outcome, policy_id, policy_version, context_hash, requester, on_behalf_of, feedback_for_agent, audit_ref and terminal_at. Headers: X-HITL-Event-Id, X-HITL-Event-Type, X-HITL-Timestamp, X-HITL-Signature, X-HITL-Attempt. X-HITL-Signature = "sha256=" + hex(HMAC-SHA256(secret, X-HITL-Timestamp + "." + raw_body)). Verify over the raw bytes. Each retry is signed again with a fresh timestamp. Delivery is at least once. Deduplicate on X-HITL-Event-Id, because a signature cache cannot do that job. Your status code decides what happens: 2xx delivered; the body is not read 401, 403, 408, 429, 5xx, no answer retried other 4xx, including 409 and 425 dead-lettered at once If you are not ready for an event, answer 503. Do not answer 2xx to an event you dropped, because a delivered row cannot be requeued. Retries: 8 attempts at about +10s, +70s, +6m, +36m, +1h36m, +3h36m and +7h36m, then dead-lettered. When deliveries fail: - GET /v1/webhooks shows active, disabled_at, disabled_reason, dead_total and last_dead_at per subscription. - GET /v1/webhooks/deliveries lists deliveries, newest first. Without state it lists dead ones only. state takes dead, pending, delivered, or all for every state (state=all answers "did my webhook receive anything"). Any other value answers 422. The response repeats the state it applied. attempts counts failed tries and is 0 for a delivery accepted first time. - POST /v1/webhooks/deliveries/{id}/requeue sends one again from attempt 1 (409 if it is not dead). - After 10 dead deliveries since its last success (default setting), a subscription is disabled. Fix the endpoint, then POST /v1/webhooks/{id}/enable. Enabling does not replay the backlog. Rotating a secret: there is no rotate route. Register a second subscription with the new secret, accept both secrets in your verifier, then DELETE /v1/webhooks/{old_id}. Event-id dedupe absorbs the duplicates during the overlap. URLs must be https and resolve to a public address. Futex checks the resolved IP at registration and on each send. For an endpoint on a development machine, use a public HTTPS tunnel such as retunnel. A handler that missed an outcome can fetch it with GET /v1/decisions/{id}, which returns the envelope decision.terminal carries. ## Audit GET /v1/audit?entity_id=&actor=&since=&until=&limit=&offset= with an auditor or tenant_admin key. Results cover one tenant. ## Errors and limits - Errors: {"error": {"code", "message", "details", "request_id"}}. Quote request_id when reporting a problem. - 401 bad or revoked key. 403 missing permission. 404 not found or not in your tenant. 409 state conflict. 422 invalid input. 503 the authorisation service is unavailable: treat the request as not approved and retry later. - List routes take limit (1 to 100) and offset. - Rate limit: 300 requests per API key in each UTC minute, counted per key. The count restarts when the minute changes. Pages under /a/ allow 60 per client address. Over the limit the answer is 429 with Retry-After in seconds. X-RateLimit-Limit and X-RateLimit-Remaining are on every response. - GET or HEAD /healthz for liveness, /readyz for readiness (database and Redis). ## Testing Use a policy with notifications "none" and test principals as assignees. Cancel the decisions your tests raise, because their tasks otherwise wait until expiry. Retire the test policy afterwards.