Update API Key
PATCH {{endpoint}}/api-keys/:apiKey
Updates an API Key
To update an API key you must pass its key
as a query parameter and the new name
in the body, you can also update other key properties
Required properties:
-
name
string with a minimum length of 1
Optional properties:
-
customAccountId
string -
customUserId
string -
customMetaData
an object with any attributes, useful for storing additional information -
key
custom api key, provide this attribute if you want to change the API key's generatedkey
property to a custom one -
expiry
ISO 8601 string date (UTC timezone), represents the date the API key expire's at. After this date the API key will be deleted and you will not have access to it anymore (unless you reactivate it, check Reactivate API Key route for more info)- If your API key already has an expiration date and you wish to remove it, then provide
expiry: null
and the key will not expire
- If your API key already has an expiration date and you wish to remove it, then provide
-
rateLimitConfigs
object containing the rate limit options for this key-
rateLimit
number of allowed requests per ttl -
rateLimitTtl
number of seconds before consumed points are reset
-
Returns
-
200
if key updated successfully -
400
if payload validation fails -
401
if authentication fails -
403
if user has insufficient roles (users withuser
andadmin
roles can update an API key, users withviewer
role cannot) -
404
if key was not found
Request Body
{"name"=>"YOUR_NEW_API_KEY_NAME", "customUserId"=>"OPTIONAL_STRING", "customAccountId"=>"OPTIONAL_STRING", "key"=>"OPTIONAL_STRING", "expiry"=>"YYYY-MM-DD", "rateLimitConfigs"=>{"rateLimit"=>10, "rateLimitTtl"=>60}}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
x-api-key | string |
RESPONSES
status: OK
{"key":"basic_key_1","name":"Postman docs updated basic api key with all fields","customMetaData":{"type":"Basic","roles":["Viewer"]},"customAccountId":"BASIC_ACCOUNT_1","customUserId":"BASIC_USER_1","env":"live","createdAt":"2022-08-23T14:34:05.330Z","updatedAt":"2022-08-23T18:03:26.387Z","isActive":true,"expiresAt":"2022-12-12T00:00:00.000Z","rateLimitConfigs":{"rateLimit":200,"rateLimitTtl":60}}