Api-key

Update an existing API key by ID

post/api-key/update

Request body

{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:configId","oasType":"schema","type":"unknown","description":"The configuration ID to use for the API key lookup. If not provided, the default configuration will be used."}
keyIdstring required

The id of the Api Key

{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:userId","oasType":"schema","type":"unknown","description":"The id of the user which the api key belongs to. server-only. Eg: \"some-user-id\""}
{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:name","oasType":"schema","type":"unknown","description":"The name of the key"}
{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:enabled","oasType":"schema","type":"unknown","description":"Whether the Api Key is enabled or not"}
{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:remaining","oasType":"schema","type":"unknown","description":"The number of remaining requests"}
{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:refillAmount","oasType":"schema","type":"unknown","description":"The refill amount"}
{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:refillInterval","oasType":"schema","type":"unknown","description":"The refill interval"}
{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:metadata","oasType":"schema","type":"unknown"}
expiresInstring required
{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:rateLimitEnabled","oasType":"schema","type":"unknown","description":"Whether the key has rate limiting enabled."}
{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:rateLimitTimeWindow","oasType":"schema","type":"unknown","description":"The duration in milliseconds where each request is counted. server-only. Eg: 1000"}
{"stackTrail":"paths:/api-key/update:post:requestBody:content:application/json:schema:properties:rateLimitMax","oasType":"schema","type":"unknown","description":"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"}
permissionsstring required

Response

API key updated successfully

idstring required

ID

namestring nullable

The name of the key

startstring nullable

Shows the first few characters of the API key, including the prefix. This allows you to show those few characters in the UI to make it easier for users to identify the API key.

prefixstring nullable

The API Key prefix. Stored as plain text.

userIdstring required

The owner of the user id

refillIntervalnumber nullable

The interval in milliseconds between refills of the remaining count. Example: 3600000 // refill every hour (3600000ms = 1h)

refillAmountnumber nullable

The amount to refill

lastRefillAtstring date-time nullable

The last refill date

enabledboolean required

Sets if key is enabled or disabled

rateLimitEnabledboolean required

Whether the key has rate limiting enabled

rateLimitTimeWindownumber nullable

The duration in milliseconds

rateLimitMaxnumber nullable

Maximum amount of requests allowed within a window

requestCountnumber required

The number of requests made within the rate limit time window

remainingnumber nullable

Remaining requests (every time api key is used this should updated and should be updated on refill as well)

lastRequeststring date-time nullable

When last request occurred

expiresAtstring date-time nullable

Expiry date of a key

createdAtstring date-time required

created at

updatedAtstring date-time required

updated at

metadataobject nullable

Extra metadata about the apiKey

permissionsstring nullable

Permissions for the api key (stored as JSON string)

Changes