POST /v1/vault/connections
Stores a credential. For a pack connection give `pack` and `key` (the connection key in the pack); the type and bound hosts come from the pack and `type`, if given, must match. For a credential used by your own HTTP steps give `type` and `hosts`. For a verification-only connection give `type` and no `hosts` (or `[]`): it is never injected into any request and holds a secret B3OS itself uses, such as a routine webhook's signing secret (`verify.secret`). `secret` holds the fields of the type: `api_key` {api_key}, `basic` {username, password}, `bearer` {token}, `oauth2` {access_token, refresh_token?, expires_at?, client_id?, client_secret?}, `none` {}. An `oauth2` pack connection with `refresh_token` and `expires_at` is refreshed in the background, always against the token endpoint (`tokenUrl`) its pack declared when the connection was created. A project holds at most 1,000 connections (limit `vault.connections`; more is 422 `limit_exceeded`).

Authentication

Bearer Token (b3os_sk_ API key or b3os_pat_ token) API Key (cookie: __Host-b3os_session)

Header Parameters

Idempotency-Key string optional header
A unique value (for example a UUID) that makes this request safe to retry. Scoped to your project for 24 hours: a retry with the same key, method, path and body returns the stored response with `Idempotent-Replayed: true`, and only to the same API key. Reusing the key for a different request returns `409 idempotency_key_conflict`.

Request Body required

application/json
pack string
The pack this credential is for (`io.b3os/github`).
key string
The pack's connection key (`connections.<key>` in its manifest). Required with `pack`.
type string
The credential kind, as in pack manifests.
Enum: api_key, basic, bearer, oauth2, none
label string
subject string
Your end user's ID, when you store one credential per user.
hosts string[]
Hosts that receive the credential (exact names or `*.` wildcards), taken from the pack for a pack connection. Without `pack`, list the hosts your own HTTP steps call, or omit it (or give `[]`) for a verification-only connection: a connection with no hosts is never injected anywhere, because egress injection matches on hosts. It only holds a secret B3OS itself uses, such as a routine webhook's `verify.secret`.
Array of: string
params object
Non-secret configuration the pack's connection declares (for example a Jira site name).
secret object REQUIRED
Secret fields for the connection's type. Write-only: accepted on create and update, never returned or logged.
api_key string
username string
password string
token string
access_token string
refresh_token string
expires_at string (date-time)
When `access_token` expires (oauth2).
client_id string
client_secret string
metadata object
Up to 16 string key-value pairs you attach to an object for your own use. Keys are 1 to 40 characters of `A-Z a-z 0-9 _ . : -`; values are at most 500 characters. B3OS never interprets them.

Responses

201 The connection (without secret values).
application/json
id string REQUIRED
object string REQUIRED
Enum: connection
pack string | null REQUIRED
key string | null REQUIRED
type string REQUIRED
The credential kind, as in pack manifests.
Enum: api_key, basic, bearer, oauth2, none
label string | null REQUIRED
subject string | null REQUIRED
hosts string[] REQUIRED
Hosts that receive the credential; `[]` for a verification-only connection (never injected).
Array of: string
params object REQUIRED
secret_fields string[] REQUIRED
Names of the stored secret fields.
Array of: string
status string REQUIRED
`expired` when an OAuth access token passed `expires_at` and could not be refreshed.
Enum: active, expired
expires_at string (date-time) | null REQUIRED
created_at string (date-time) REQUIRED
updated_at string (date-time) REQUIRED
last_used_at string (date-time) | null REQUIRED
metadata object REQUIRED
Up to 16 string key-value pairs you attach to an object for your own use. Keys are 1 to 40 characters of `A-Z a-z 0-9 _ . : -`; values are at most 500 characters. B3OS never interprets them.
400 The request failed validation (`invalid_request`, `invalid_url`).
401 Missing, malformed, expired or revoked credentials (`unauthorized`).
403 Authenticated but not allowed (`forbidden`, `egress_denied`).
404 The pack or its connection key does not exist (`pack_not_found`).
409 The object's state does not allow this operation, or the idempotency key conflicts.
413 The request body exceeds this operation's limit.
415 The Content-Type is not accepted by this operation.
422 The secret fields or hosts do not fit the type (`connection_invalid`), or the project already holds as many connections as it may (`limit_exceeded`, limit `vault.connections`).
429 A rate, concurrency or quota limit applies (`rate_limited`, `concurrency_limited`, `quota_exceeded`).
500 Something failed inside B3OS (`internal`). Retry with backoff.
503 The vault is not unlocked yet (`vault_unavailable`), or the node is not available.
curl -X POST 'https://beta-api.b3os.org/v1/vault/connections' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "pack": "string",  "key": "string",  "type": "api_key",  "label": "string",  "subject": "string",  "hosts": [    "string"  ],  "params": {},  "secret": {    "api_key": "string",    "username": "string",    "password": "string",    "token": "string",    "access_token": "string",    "refresh_token": "string",    "expires_at": "2024-01-01T00:00:00Z",    "client_id": "string",    "client_secret": "string"  },  "metadata": {    "customer": "acme",    "ticket": "ENG-1423"  }}'
const response = await fetch('https://beta-api.b3os.org/v1/vault/connections', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "pack": "string",    "key": "string",    "type": "api_key",    "label": "string",    "subject": "string",    "hosts": [      "string"    ],    "params": {},    "secret": {      "api_key": "string",      "username": "string",      "password": "string",      "token": "string",      "access_token": "string",      "refresh_token": "string",      "expires_at": "2024-01-01T00:00:00Z",      "client_id": "string",      "client_secret": "string"    },    "metadata": {      "customer": "acme",      "ticket": "ENG-1423"    }  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/vault/connections', headers=headers, json={  "pack": "string",  "key": "string",  "type": "api_key",  "label": "string",  "subject": "string",  "hosts": [    "string"  ],  "params": {},  "secret": {    "api_key": "string",    "username": "string",    "password": "string",    "token": "string",    "access_token": "string",    "refresh_token": "string",    "expires_at": "2024-01-01T00:00:00Z",    "client_id": "string",    "client_secret": "string"  },  "metadata": {    "customer": "acme",    "ticket": "ENG-1423"  }})print(response.json())
201 Response
{  "id": "conn_01m5t6cbgdjs1ketgcqwa2sne8",  "object": "connection",  "pack": "io.b3os/github",  "key": "api",  "type": "bearer",  "label": "CI bot token",  "subject": null,  "hosts": [    "api.github.com"  ],  "params": {},  "secret_fields": [    "token"  ],  "status": "active",  "expires_at": null,  "created_at": "2026-10-25T20:10:00.000Z",  "updated_at": "2026-10-25T20:10:00.000Z",  "last_used_at": null,  "metadata": {}}
Ask a question... ⌘I