Skip to main content
POST
/
api
/
canary
/
authentication
/
api-key
/
create
Create API Key
curl --request POST \
  --url http://localhost:3000/api/canary/authentication/api-key/create \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "My API Key",
  "expiresIn": 3600,
  "prefix": "pk_live_",
  "metadata": {
    "env": "production"
  }
}
'
{
  "statusCode": 400,
  "message": [
    "Invalid input data"
  ],
  "error": "Bad Request"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string

The name of the API key

Example:

"My API Key"

expiresIn
number

Expiration time in seconds

Example:

3600

prefix
string

Prefix for the API key

Example:

"pk_live_"

metadata
object

Metadata for the API key

Example:
{ "env": "production" }

Response

API key created successfully