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:
-
namestring with a minimum length of 1
Optional properties:
-
customAccountIdstring -
customUserIdstring -
customMetaDataan object with any attributes, useful for storing additional information -
keycustom api key, provide this attribute if you want to change the API key's generatedkeyproperty to a custom one -
expiryISO 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: nulland the key will not expire
- If your API key already has an expiration date and you wish to remove it, then provide
-
rateLimitConfigsobject containing the rate limit options for this key-
rateLimitnumber of allowed requests per ttl -
rateLimitTtlnumber of seconds before consumed points are reset
-
Returns
-
200if key updated successfully -
400if payload validation fails -
401if authentication fails -
403if user has insufficient roles (users withuser
andadmin
roles can update an API key, users withviewer
role cannot) -
404if 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}}