Skip to main content
POST
Connect an agent
Takes a vault’s connect token (oc_connect_...), or a person’s managing key or signed-in session. See the Quickstart for connecting an agent. Connects one new agent to a vault and returns its credential once. Called with a connect token of the vault (the vault is the token’s), or by a person with a key that has manage and a vaultId. A one-use connect token connects one agent and then stops: a second call with it is 401, as for a token that expired or was turned off. A place that already holds an agent’s credential sends it in OneCLI-Agent-Credential: one place holds one agent, on one vault.
Availability: OneCLI Cloud and self-hosted.

Authorizations

Authorization
string
header
required

A vault's connect token (oc_connect_...). It connects one agent to its own vault and does nothing else.

Headers

OneCLI-Agent-Credential
string

Optional. The agent credential this place already holds. On this vault: 200 with that agent and nothing made. On another vault: 409, or with replace that agent is disconnected and a new one is made. A credential that no longer works, or is not known, is ignored.

Maximum string length: 255
Idempotency-Key
string

Not accepted on this call. Sending it is 400 bad_request.

Required string length: 1 - 255

Body

application/json
expiresAt
string<date-time>

ISO 8601, at least 5 minutes and at most 90 days ahead. Unset: no expiry.

host
string

The machine's host name. With no name, the agent is named after it (with 4 hex characters added when that name is taken on the vault).

Required string length: 1 - 64
Pattern: ^[^\p{Cc}]+$/u
name
string

1 to 64 characters. Unset: the server names the agent after host, or from the runtime and 4 hex characters. With a one-use connect token that fixes a name, the token's is used.

Required string length: 1 - 64
Pattern: ^[^\p{Cc}]+$/u
provider
string

The agent's provider: a short lowercase label that never decides access. With a one-use connect token that fixes a provider, the token's is used.

Pattern: ^[a-z0-9][a-z0-9._-]{0,31}$
Example:

"boat"

replace
boolean
default:false

Used only when the OneCLI-Agent-Credential header names an agent on another vault. true: disconnect that agent and connect a new one here.

runtime
enum<string>
default:linux

What the agent runs on. Default: linux.

Available options:
docker,
linux,
macos,
windows
vaultId
string

The vault to connect to. Required with a key or a session. Not taken with a connect token, whose vault is fixed.

Required string length: 1 - 64

Response

This place is connected to this vault already. The agent, with no credential: the place holds it.

createdAt
string
required

ISO 8601.

expiresAt
string | null
required

ISO 8601. When the agent's credential stops by itself. null: it stops only when the agent is disconnected.

gateway
object
required

Where the agent reaches the gateway. Build the proxy URL from this and decide nothing yourself.

id
string
required
name
string
required
provider
string | null
required

The agent's provider: a short lowercase label. It never decides access. null: not known.

Pattern: ^[a-z0-9][a-z0-9._-]{0,31}$
Example:

"boat"

runtime
string | null
required

What the agent runs on. null: not known yet.

vaultId
string
required