Skip to main content
POST
Add a key to a vault
Takes a managing key (oc_key_...) or a signed-in session. See Custom connections for how a key is sent. Adds an API key or an LLM key. Agents on the vault may use it at once (allow). The answer never carries the value.
Availability: OneCLI Cloud and self-hosted.

Authorizations

Authorization
string
header
required

A managing key (oc_key_...), an older API key (oc_...), or a signed-in session.

Headers

Idempotency-Key
string

Optional. 1 to 255 visible characters. A retry with the same key, path and body returns the first answer (with Idempotent-Replayed: true) for 24 hours. The same key with another path or body is 422 idempotency_conflict.

Required string length: 1 - 255

Path Parameters

id
string
required

The vault's id.

Required string length: 1 - 64

Body

application/json
hostPattern
string
required
Required string length: 1 - 1000
kind
enum<string>
required
Available options:
api_key
name
string
required
Required string length: 1 - 255
value
string
required

The key itself. Stored encrypted. No answer ever carries it back.

Required string length: 1 - 10000
injectionConfig
object
pathPattern
string
Maximum string length: 1000

Response

The new item.

allowPlainHttp
boolean
required

The gateway may send this item over plain http://. Off unless a person turns it on.

createdAt
string
required

ISO 8601.

deletedAt
string | null
required

ISO 8601. When it was deleted. null: a live item. A deleted item is listed only with deleted=true.

enabled
boolean
required

Off: the gateway does not use the item for any agent, whatever its permissions say. Requests to its hosts go out with no credential.

hosts
string[]
required

The hosts the gateway uses this item for.

id
string
required
kind
enum<string>
required
Available options:
app,
api_key,
llm_key
lastUsedAt
string | null
required

ISO 8601. When the gateway last used it for a request, to the hour. null: never used.

name
string
required
permissionSummary
object
required
purgeAt
string | null
required

ISO 8601. When a deleted item is destroyed for good, unless restored first. null: a live item.

rotatedAt
string
required

ISO 8601. When the value was last set: made, given a new value, or refreshed by the gateway.

service
string | null
required

The app or LLM provider, for example github or anthropic. null for a plain API key.

state
enum<string>
required

ready, reauth_required (the app must be signed in again) or disconnected.

Available options:
ready,
reauth_required,
disconnected
vaultId
string
required
version
integer
required

A key's current version, for If-Match on a change. 0 for an app, which has no versions.