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. Use the token fromarchal login, a dashboard token, or a workspace API key (archal_ws_...) created viaarchal workspace api-key create <label> --scope sessions:write.Authorizationis the service credential the clone sees. Use any non-empty service-shaped test 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, local harnesses can read the route pieces directly from
the environment:
AGENT_CLONE_URLSis a JSON map such as{"github":"https://.../github/api"}.AGENT_ROUTE_HEADERSis a JSON object containing the route auth headers.
ARCHAL_TOKEN into the harness.
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.
