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

Authorizations

Authorization
string
header
required

Bearer token authentication

Body

application/json
expiresIn
string
required
remaining
string
required
configId
string | null

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

metadata
string | null
name
string | null

Name of the Api Key

organizationId
string | null

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

permissions
string | null

Permissions of the Api Key.

prefix
string | null

Prefix of the Api Key

rateLimitEnabled
boolean | null

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

rateLimitMax
number | null

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 | null

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 | null

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

refillInterval
number | null

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

userId
string | null

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)