# 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. 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. - POST /v1/decisions/{id}/cancel cancels it. The decision then reads status cancelled with outcome.result cancelled. - Statuses: pending, in_review, escalated, approved_pending_clearance, then one of approved, rejected, changes_requested, timed_out, cancelled. 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". - 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, and its "Approve with these answers" button records amend_and_approve. 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. ## 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"}. 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?state=dead lists dead deliveries. - 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. - 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.