Skip to main content
POST
Create a new API key for a user

Authorizations

Authorization
string
header
required

Bearer token authentication

Body

application/json
configId
string

The configuration ID to use for the API key. If not provided, the default configuration will be used.

expiresIn
number | null

Expiration time of the Api Key in seconds

metadata
any
name
string

Name of the Api Key

organizationId
string

Organization Id of the organization that the Api Key belongs to. Eg: 'org-id'

permissions
object

Permissions of the Api Key.

prefix
string

Prefix of the Api Key

rateLimitEnabled
boolean

Whether the key has rate limiting enabled. server-only. Eg: true

rateLimitMax
number

Maximum amount of requests allowed within a window. Once the maxRequests is reached, the request will be rejected until the timeWindow has passed, at which point the timeWindow will be reset. server-only. Eg: 100

rateLimitTimeWindow
number

The duration in milliseconds where each request is counted. Once the maxRequests is reached, the request will be rejected until the timeWindow has passed, at which point the timeWindow will be reset. server-only. Eg: 1000

refillAmount
number

Amount to refill the remaining count of the Api Key. server-only. Eg: 100

refillInterval
number

Interval to refill the Api Key in milliseconds. server-only. Eg: 1000

remaining
number | null

Remaining number of requests. Server side only

userId
string

User Id of the user that the Api Key belongs to. server-only. Eg: "user-id"

Response

API key created successfully

createdAt
string<date-time>
required

Creation timestamp

enabled
boolean
required

Whether the key is enabled

id
string
required

Unique identifier of the API key

key
string
required

The full API key (only returned on creation)

rateLimitEnabled
boolean
required

Whether rate limiting is enabled

referenceId
string
required

ID of the reference owning the key

requestCount
number
required

Current request count in window

updatedAt
string<date-time>
required

Last update timestamp

expiresAt
string<date-time> | null

Expiration timestamp

lastRefillAt
string<date-time> | null

Last refill timestamp

lastRequest
string<date-time> | null

Last request timestamp

metadata
object | null

Metadata associated with the key

name
string | null

Name of the API key

permissions
object | null

Permissions associated with the key

prefix
string | null

Prefix of the API key

rateLimitMax
number | null

Maximum requests in time window

rateLimitTimeWindow
number | null

Rate limit time window in milliseconds

refillAmount
number | null

Amount to refill

refillInterval
number | null

Refill interval in milliseconds

remaining
number | null

Remaining requests

start
string | null

Starting characters of the key (if configured)