oc_agent_...) for one vault. A person approves every new agent. There is no anonymous access.
This page is the human-readable copy of auth.md, the page the API serves for agents at https://api.onecli.sh/auth.md (also at https://onecli.sh/auth.md). It follows the layout of the auth.md protocol, but OneCLI does not implement that protocol’s registration endpoints yet.
Pick a way in
An agent never needs a managing key to call APIs. Install the CLI with
curl -fsSL https://onecli.sh/cli/install | sh.
Find the way in from a 401
Every401 from the API carries the same headers, whatever credential was sent:
/v2, the error body also names the page in docUrl:
/.well-known/oauth-protected-resource follows RFC 9728. It names no authorization server yet:
Sign up with the CLI
onecli connect starts a sign-up, prints a link and a code on stderr, and waits. Piped, that line is JSON:
agent.env. --name names the agent, and --kind says which agent you are.
The sign-up over HTTP
1
Start a sign-up
No credential is needed, and every field is optional:A sign-up lasts 15 minutes. One address may start at most 10 sign-ups an hour. Past that, a
name: 1 to 64 characters. Unset: the server picks one.runtime:docker,linux,macosorwindows. Defaultlinux.kind: which agent you are, such asclaude,codexorcursor.
201:429 carries Retry-After.2
Your person approves
Show your person
verificationUrl and userCode together, in one message. They sign in, or create an account, type the code, pick a vault and approve. Never show anyone the pollToken.3
Poll for the credential
Every
interval seconds:The
200 answer holds your agent (id, name, vaultId, expiresAt), your credential, and gateway (address and scheme).Use the credential
Keep it inONECLI_AGENT_CREDENTIAL, readable only by you. Never print or log it.
- The proxy. Set
HTTPS_PROXYto<gateway.scheme>://x:<credential>@<gateway.address>, and trust the OneCLI certificate fromhttps://api.onecli.sh/v1/gateway/ca. Call APIs at their normal addresses with no key. The gateway adds it. - The address form. With no proxy, call
<gateway.scheme>://<gateway.address>/r/<host>/<path>withAuthorization: Bearer <credential>. It works only for a host your vault has an item for. See Address form. - What you can use.
GET /v2/agents/me,GET /v2/agents/me/itemsandPOST /v2/agents/me/check, withAuthorization: Bearer <credential>.
onecli connect writes all of this to agent.env. Then use onecli status, onecli items and onecli check <METHOD> <URL>. To store a credential you got over HTTP, run onecli connect --from-env. For how to call APIs and what to do when a call is held, read the agent skill.
Errors and revocation
- A
401with your credential means it no longer works: your person disconnected you, or it reached itsexpiresAt. Don’t retry with it. Tell your person, and start again if they want you back. - Your person can disconnect you at any time.
onecli disconnectdisconnects you yourself and deletesagent.env. - The credential does not refresh. With no
expiresAt, it works until you are disconnected.
Not supported yet
- The auth.md registration types
identity_assertion(ID-JAG),service_authandanonymous. - An OAuth authorization server and token endpoint for agents.