Create API Key
POST {{endpoint}}/api-keys/
When you create a new API key, you must specify a name for the key, you can also specify custom properties for the key
Required properties:
-
namestring with a minimum length of 1 -
projectIdstring
Optional properties:
-
customAccountIdstring -
customUserIdstring -
customMetaDataan object with any attributes, useful for storing additional information -
keystring, use this if you want to use a custom key value -
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) -
rateLimitConfigsobject containing the rate limit options for this key-
rateLimitnumber of allowed requests per ttl -
rateLimitTtlnumber of seconds before consumed points are reset
-
Returns
-
201if the key was created successfully -
401if authentication fails -
403if user has insufficient roles (users withuser
andadmin
roles can create an API key, users withviewer
role cannot)
Request Body
{"name"=>"YOUR_API_KEY_NAME", "projectId"=>"{{projectId}}", "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: Created
{"key":"live_Jy6D4J7VDKMDiYU9u7ggKUxfJpOiH4ijVOpNdHvBLzhKNvXUpdINpe4arV9iZrbm","name":"Create API key with only required fields","customMetaData":{},"customAccountId":null,"customUserId":null,"env":"live","createdAt":"2022-08-23T15:26:33.088Z","updatedAt":"2022-08-23T15:26:33.088Z","isActive":true,"expiresAt":null,"rateLimitConfigs":null}