Skip to main content
The OneCLI API manages what the gateway enforces: vaults, the items in them, the agents connected to them, what agents may do with each item, organization rules, approvals and activity. The dashboard calls the same API. This reference covers version 2. Every path starts with /v2.

Base URL

On a self-hosted deployment, use your API address. A default install serves the API on port 10256. Behind a reverse proxy, it is your https:// address.

Authentication

Send a credential as a bearer token:
There are four kinds of credential. Each endpoint page says which one it takes.

Managing keys

A managing key is the credential for your own scripts. Make one in the dashboard at Settings > API keys. The key is shown once. A managing key:
  • Acts as you. It reaches the vaults you can use and stops working when you leave the organization.
  • Belongs to one organization. You do not send an organization header with it.
  • Carries one or both of two permissions. manage covers every call a signed-in person can make except answering an approval. approve covers answering an approval and nothing else. A new key has manage unless you choose otherwise.
  • Expires after 90 days unless you set another expiry.
  • Cannot make another key. Making a key takes a signed-in session.
An older API key, which starts with oc_ and has none of the three prefixes above, still works as a managing key.

Agent credentials

An agent credential belongs to one agent on one vault. The agent uses it to reach the gateway. On this API it opens the Agent self-service endpoints and nothing else. On an endpoint for a person, an agent credential answers 403 with the detail person_required. The credential is valid, so signing in again does not help. Use a managing key or a session for that call.
The reverse is a 401: an agent self-service endpoint answers unauthenticated to a managing key, a connect token or a session.

Session-only endpoints

Some endpoints take a signed-in session and refuse every key. Examples are making a key, renaming or deleting the organization, reading the audit log, approving an agent sign-up, and the organization’s shared items. A managing key there answers 403 with the detail session_required. Each of these says so on its page.

Roles

A person has one role in an organization: owner, admin or member. An endpoint that needs more than member says so in its description. A caller below the role it needs gets 403.

Paging

Every list takes limit (1 to 100, default 50) and cursor, and answers in one shape:
Pass nextCursor back as ?cursor= for the next page. It is null on the last page. A cursor is opaque and works only with the same list and the same filters. Anything else answers 400.

Idempotency

A POST takes an optional Idempotency-Key header of 1 to 255 visible characters. A retry with the same key, path and body returns the first answer for 24 hours, with the header Idempotent-Replayed: true.
  • The same key with another path or body answers 422 with idempotency_conflict.
  • The same key while the first call is still running answers 409.
  • An endpoint whose answer shows a secret once does not take the header and answers 400 if you send it. Its page says so.

Errors

Every error has one shape:
Branch on error.code, and on details[].issue where a code has more than one cause. See Errors for every code. Errors on an agent’s calls through the gateway are a separate surface. See Gateway errors and Multiple accounts.

Editions

Endpoints with a Cloud pill exist on OneCLI Cloud only. Every other endpoint exists on OneCLI Cloud and on a self-hosted deployment. See Editions.

Next steps

  • Vaults: list and make vaults
  • Items: add a key to a vault
  • Agents: connect an agent and get its credential
  • Permissions: set what agents may do with an item