curl,
Python, a Lambda, an edge worker, or another tool outside the Archal CLI.
Most Node.js code should use @archal/runtime; it handles this auth shape for
you.
Direct clone calls need route auth plus a normal service-shaped auth header:
The two-header pattern
x-route-authorizationauthenticates you to Archal. For raw HTTP, exportARCHAL_TOKENyourself. Use a workspace API key (archal_ws_...) created witharchal workspace api-key create <label>in CI or headless shells.archal workspace api-keyslists keys andarchal workspace api-key revoke <key-id>revokes one. Browser or CLI login is enough for CLI commands, but it does not automatically add a bearer token to your owncurl, SDK, Lambda, or worker.Authorizationis the service credential the clone sees. The accepted value depends on the clone. GitHub accepts any non-empty token (public reads need no token at all). Slack is stricter: it rejects any non-bootstrap token withaccount_inactive, so you must send that clone’s exact bootstrap token.
ghp_AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTt.
Always send both headers when you want the clone to see a service-shaped token
instead of your Archal token.
During archal run --docker or sandboxed runs, harnesses can read the route
pieces directly from the environment:
AGENT_CLONE_URLSis a JSON map. In controlled routing it can point SDKs at normal service-shaped hosts such ashttps://api.github.com; in direct mode it can point at hosted clone URLs such ashttps://.../github/api.AGENT_ROUTE_HEADERSis a JSON object containing the route auth headers.
ARCHAL_TOKEN into the harness. When your agent SDK is already using normal
service hosts inside Docker or sandbox mode, prefer the injected URL/header
contract and do not add Archal-specific clone URLs to the prompt.
Example (curl)
Given a running clone session:Authorization is missing, a strict clone can
return a real service-shaped auth error, such as:
Example (Python urllib)
Example (AWS Lambda / Cloudflare Worker)
Header semantics
Request handling order:- Validate
x-route-authorization: Bearer <archal-token>against your session. Bad/expired/wrong-user tokens get a 401 or 403 here - the clone never sees them. - Strip route-control request headers.
- Forward the request to the clone with your original service
Authorization.
Authorization header.
See also
- Clone sessions (
archal clone) - how to create, list, and stop clone sessions with the CLI. - Authentication - bootstrap tokens for each clone.
