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:

  • name string with a minimum length of 1
  • projectId string

Optional properties:

  • customAccountId string
  • customUserId string
  • customMetaData an object with any attributes, useful for storing additional information
  • key string, use this if you want to use a custom key value
  • 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)
  • 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

  • 201 if the key was created successfully
  • 401 if authentication fails
  • 403 if user has insufficient roles (users with user and admin roles can create an API key, users with viewer 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

KeyDatatypeRequiredDescription
x-api-keystring

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}