Skip to main content
POST
Make a key
Takes a signed-in session only. A managing key is refused with 403. See the API overview for the kinds of credential. Makes a managing key and returns it once. Needs a signed-in session that confirmed it’s you in the last 10 minutes (403 with reauthentication_required otherwise). A key can never make a key.
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

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

Required string length: 1 - 255

Body

application/json
name
string
required
Required string length: 1 - 64
expiresInDays
integer | null

1 to 365. Unset: 90 days. null: no expiry.

Required range: 1 <= x <= 365
permissions
enum<string>[]

Default: manage only.

Minimum array length: 1

manage: every call a signed-in person can make, except answering an approval. approve: answering an approval only.

Available options:
manage,
approve

Response

The new key, with the key itself shown once.

createdAt
string
required

ISO 8601.

createdVia
enum<string>
required
Available options:
dashboard,
api,
cli_login,
migrated
expiresAt
string | null
required

ISO 8601. null: no expiry.

id
string
required
lastUsedAt
string | null
required

ISO 8601, to the minute. null: never used.

name
string
required
permissions
enum<string>[]
required

manage: every call a signed-in person can make, except answering an approval. approve: answering an approval only.

Available options:
manage,
approve
key
string
required

The key itself (oc_key_...). Shown here once. Store it now: it cannot be read again.

Example:

"oc_key_exampleexampl_example"