Skip to main content
An agent gets its own OneCLI credential (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

Every 401 from the API carries the same headers, whatever credential was sent:
On /v2, the error body also names the page in docUrl:
The metadata at /.well-known/oauth-protected-resource follows RFC 9728. It names no authorization server yet:

Sign up with the CLI

With no token, onecli connect starts a sign-up, prints a link and a code on stderr, and waits. Piped, that line is JSON:
Show your person the link and the code together. Once they approve, the CLI writes 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:
  • name: 1 to 64 characters. Unset: the server picks one.
  • runtime: docker, linux, macos or windows. Default linux.
  • kind: which agent you are, such as claude, codex or cursor.
The answer, 201:
A sign-up lasts 15 minutes. One address may start at most 10 sign-ups an hour. Past that, a 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 in ONECLI_AGENT_CREDENTIAL, readable only by you. Never print or log it.
  • The proxy. Set HTTPS_PROXY to <gateway.scheme>://x:<credential>@<gateway.address>, and trust the OneCLI certificate from https://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> with Authorization: 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/items and POST /v2/agents/me/check, with Authorization: Bearer <credential>.
With the CLI, 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 401 with your credential means it no longer works: your person disconnected you, or it reached its expiresAt. 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 disconnect disconnects you yourself and deletes agent.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_auth and anonymous.
  • An OAuth authorization server and token endpoint for agents.

Next steps