Skip to content

POST   /apikeys

Create a new apiKey

Create a new apikey for the current user's account. Only account administrators can create API keys.

Authentication Required

Authorization: Bearer {token}   header string

This header is required to access this endpoint

Required Parameters

x-account-id   header string

Account ID for the request

Request Body

{
"description": "string",
"flatPermissionsList": [
"string"
]
}

Try it out

Loading...

Output:

Responses

Description

ApiKey created successfully

{
"id": 0,
"description": "string",
"expiresAt": "string",
"permissions": [
{}
],
"apiKey": "string",
"lastFourOfSecret": "string",
"createdAt": "string",
"updatedAt": "string",
"apiSecret": "string"
}

References

#/components/parameters/xAccountIdHeader

in: header
name: x-account-id
schema:
type: string
description: Account ID for the request
required: true
example: "2311"

#/components/schemas/ApiKeyInput

type: object
required:
- description
- flatPermissionsList
properties:
description:
type: string
description: Description of the API key
expiresAt:
type: string
format: date-time
nullable: true
description: ISO date-time string when the API key expires, or null/empty for no
expiration
flatPermissionsList:
type: array
example:
- readApplications
- writeApplications
items:
type: string
description: List of permission IDs to assign to the API key

#/components/schemas/ApiKey

type: object
required:
- description
- apiKey
properties:
id:
type: integer
readOnly: true
description:
type: string
description: Description of the API key
expiresAt:
type: string
format: date-time
nullable: true
description: ISO date-time string when the API key expires, or null/empty for no
expiration
permissions:
type: array
items:
type: object
apiKey:
type: string
lastFourOfSecret:
type: string
createdAt:
type: string
format: date-time
readOnly: true
updatedAt:
type: string
format: date-time
readOnly: true

#/components/schemas/ApiKeyWithSecret

allOf:
- type: object
required:
- description
- apiKey
properties:
id:
type: integer
readOnly: true
description:
type: string
description: Description of the API key
expiresAt:
type: string
format: date-time
nullable: true
description: ISO date-time string when the API key expires, or null/empty for no
expiration
permissions:
type: array
items:
type: object
apiKey:
type: string
lastFourOfSecret:
type: string
createdAt:
type: string
format: date-time
readOnly: true
updatedAt:
type: string
format: date-time
readOnly: true
fromRef: "#/components/schemas/ApiKey"
- properties:
apiSecret:
type: string
description: The secret used to authenticate with the API key. This value is
only returned when initially creating the API key and cannot be
retrieved again.
required:
- apiSecret

Route Source Code

Check out the source code for this route entrypoint here: /apikeys/route.ts

Or the swagger.yaml spec this documentation was generated from: /apikeys/swagger.yaml