Create an API key
Creates an API key with the provided name, type, and expiration.
expires_at within 90 days or your organization’s shorter limit. For team and API key management keys, omit it or pass null only when your organization allows keys without an expiration.
To create a personal key, set BASETEN_API_KEY to your existing personal key and replace <expires-at> with a permitted ISO 8601 timestamp, such as 2027-01-15T00:00:00Z. Include Z for UTC or an explicit offset. Run the following request:
api_key immediately; you can’t retrieve it again. To change a key’s expiration, create a replacement and rotate the workload’s credentials.
For more information, see Manage API keys and Create a team API key.Authorizations
Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.
Body
Request to create an API key.
Type of the API key.
PERSONAL, GRID, WORKSPACE_MANAGE_ALL, WORKSPACE_EXPORT_METRICS, WORKSPACE_INVOKE, WORKSPACE_MANAGE_API_KEYS "PERSONAL"
"GRID"
"WORKSPACE_MANAGE_API_KEYS"
"WORKSPACE_EXPORT_METRICS"
"WORKSPACE_INVOKE"
"WORKSPACE_MANAGE_ALL"
Optional name for the API key
"my-api-key"
List of model IDs to scope the API key to, only present if type is 'WORKSPACE_EXPORT_METRICS' or 'WORKSPACE_INVOKE'
Expiration time in UTC. Must be in the future. Personal keys must expire within 90 days, or sooner if your organization sets a lower limit. Team and organization keys require an expiration within your organization's limit when one is set; otherwise they may omit it or use null. Organization lifetime limits do not apply to Grid keys.
"2027-01-01T00:00:00Z"
Team ID for a team-scoped key. When omitted, uses the team in the URL if present, otherwise your organization's default team. Must match the URL team when both are provided. Not supported for PERSONAL or WORKSPACE_MANAGE_API_KEYS keys.
1Response
Represents an API key.
The API key string