Create a connection
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`).
/v1/vault/connections
Authentication
Header Parameters
Idempotency-Key
string
optional
header
Request Body required
application/jsonpack
string
key
string
type
string
api_key, basic, bearer, oauth2, nonelabel
string
subject
string
hosts
string[]
params
object
secret
object
REQUIRED
api_key
string
username
string
password
string
token
string
access_token
string
refresh_token
string
expires_at
string (date-time)
client_id
string
client_secret
string
metadata
object
Responses
application/jsonid
string
REQUIRED
object
string
REQUIRED
connectionpack
string | null
REQUIRED
key
string | null
REQUIRED
type
string
REQUIRED
api_key, basic, bearer, oauth2, nonelabel
string | null
REQUIRED
subject
string | null
REQUIRED
hosts
string[]
REQUIRED
params
object
REQUIRED
secret_fields
string[]
REQUIRED
status
string
REQUIRED
active, expiredexpires_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
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())
{ "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": {}}
Try this endpoint
/v1/vault/connections