Create a new API key for an organization
POST/v1/organizations/:orgId/api-keys
Generates a new API key with the specified scope and environment. The full API key is only returned once at creation - store it securely.
Request
Path Parameters
Organization ID
- application/json
Body
required
Possible values: non-empty and <= 100 characters
Human-readable label for the API key
Possible values: [admin, manager, generator]
Scope determines the permissions of the API key (admin, manager, or generator)
Default value: 0
Initial credits allocated to the API key
Responses
- 201
- 400
- 401
- 403
- 404
- 429
- 500
API key created successfully. The apiKey field contains the full key and will only be shown once.
- application/json
- Schema
- Example (from schema)
Schema
Unique identifier for the API key
The full API key - ONLY shown once at creation. Store this securely.
First 10 characters of the API key for identification
Human-readable label for the API key
Possible values: [admin, manager, generator]
Permission scope of the API key
Possible values: [live, test]
Environment the key is valid for
Available credits for this API key
Possible values: [active, revoked, expired]
Current status of the API key
Number of times the key has been used
Last time the key was used (ISO 8601 format)
Expiration date of the key (ISO 8601 format)
Creation date of the key (ISO 8601 format)
{
"keyId": "string",
"apiKey": "string",
"keyPrefix": "string",
"label": "string",
"scope": "admin",
"environment": "live",
"credits": 0,
"status": "active",
"usageCount": 0,
"lastUsedAt": "2024-07-29T15:51:28.071Z",
"expiresAt": "2024-07-29T15:51:28.071Z",
"createdAt": "2024-07-29T15:51:28.071Z"
}
Invalid request data
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}
Unauthorized
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}
Forbidden
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}
Organization not found
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}
Too Many Requests
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}
Internal Server Error
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}