Skip to content
Keptslot
Start free

Mint a workspace key

POST
/v1/account/workspaces/{id}/keys
curl --request POST \
--url https://api.keptslot.com/v1/account/workspaces/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "type": "sk", "name": "Production server" }'

This endpoint makes a new API key for a workspace the account owns. A workspace on another account gives a 404, and nothing is created.

CAUTION: key carries the full value, and this is the only response that shows it for a secret key. Store it now. A later read gives null.

id
required
string format: uuid

The workspace id.

Media type application/json
object
type
required

sk for a secret key, used from a server. pk for a publishable key, used from a browser.

string
Allowed values: sk pk
name

A label for the key. 100 characters at most.

string
Example
{
"type": "sk",
"name": "Production server"
}

The key is created.

Media type application/json
object
id
required
string format: uuid
type
required
string
Allowed values: sk pk
name

Null for a key made before names existed. “No name” and “made before names” are the same answer here.

string | null
key

The full key value. A create response carries it for both key types, because that is the only moment the value exists.

A read gives it for a publishable key only, and gives null for a secret key. It is also null for an old publishable key whose value was never stored.

string | null
display_prefix
required

The first characters, to tell keys apart in a list.

string
revoked
required
boolean
created_at
required
string format: date-time
last_used_at
string | null format: date-time
allowed_origins
required

The browser origins a publishable key works from. An empty list rejects every browser Origin.

Array<string>
Example
{
"type": "sk"
}

The key is missing, malformed or revoked.

Media type application/json
object
error
required
object
type
required

A stable machine-readable code. Match on this.

string
message
required

A sentence for a person. Do not match on this.

string
param

The field that caused the refusal, if one field did.

string
dimension

The plan limit that refused the request. It is present only on a 402, and only for a secret key or an account key. See the errors guide.

string
used

The current count for that dimension. It is present only on a 402, and only for an account key. It is absent when the refusal has no count to report. Absent and zero are different answers.

integer format: int64
limit

The cap for that dimension. It is present only on a 402, and only for an account key. A cap of zero is a real value.

integer format: int64
Example generated
{
"error": {
"type": "example",
"message": "example",
"param": "example",
"dimension": "example",
"used": 1,
"limit": 1
}
}

There is no such resource in this workspace.

Media type application/json
object
error
required
object
type
required

A stable machine-readable code. Match on this.

string
message
required

A sentence for a person. Do not match on this.

string
param

The field that caused the refusal, if one field did.

string
dimension

The plan limit that refused the request. It is present only on a 402, and only for a secret key or an account key. See the errors guide.

string
used

The current count for that dimension. It is present only on a 402, and only for an account key. It is absent when the refusal has no count to report. Absent and zero are different answers.

integer format: int64
limit

The cap for that dimension. It is present only on a 402, and only for an account key. A cap of zero is a real value.

integer format: int64
Example generated
{
"error": {
"type": "example",
"message": "example",
"param": "example",
"dimension": "example",
"used": 1,
"limit": 1
}
}

The request body or the query is not valid.

Media type application/json
object
error
required
object
type
required

A stable machine-readable code. Match on this.

string
message
required

A sentence for a person. Do not match on this.

string
param

The field that caused the refusal, if one field did.

string
dimension

The plan limit that refused the request. It is present only on a 402, and only for a secret key or an account key. See the errors guide.

string
used

The current count for that dimension. It is present only on a 402, and only for an account key. It is absent when the refusal has no count to report. Absent and zero are different answers.

integer format: int64
limit

The cap for that dimension. It is present only on a 402, and only for an account key. A cap of zero is a real value.

integer format: int64
Example generated
{
"error": {
"type": "example",
"message": "example",
"param": "example",
"dimension": "example",
"used": 1,
"limit": 1
}
}