Create temporary API key
Creates a short-lived API key for specific temporary use cases. The key will automatically expire after the specified duration. Use `single_use` and `max_session_duration_seconds` to limit how the key can be used by a client. See the [Temporary API keys guide](https://soniox.com/docs/guides/temporary-api-keys) for details.
Creates a short-lived API key for specific temporary use cases. The key will automatically expire after the specified duration.
Use single_use and max_session_duration_seconds to limit how the key can be used by a client. See the Temporary API keys guide for details.
Headers
AuthorizationRequiredBearer <SONIOX_API_KEY>Request
application/jsonRequiredusage_typeRequiredstringIntended usage of the temporary API key.
"transcribe_websocket" | "tts_rt"expires_in_secondsRequiredintegerDuration in seconds until the temporary API key expires.
1Maximum: 3600client_reference_idstringOptional tracking identifier string. Does not need to be unique.
256single_usebooleanIf true, the temporary API key can be used only once.
max_session_duration_secondsintegerMaximum connection duration in seconds for WebSocket and TTS HTTP streaming endpoints. If exceeded, the connection will be dropped. If not set, no limit is applied.
1Maximum: 18000Response
201
Created temporary API key.
api_keyRequiredstringCreated temporary API key.
expires_atRequiredstringUTC timestamp indicating when generated temporary API key will expire.
"date-time"Errors
Created temporary API key.
{
"api_key": "temp:WYJ67RBEFUWQXXPKYPD2UGXKWB",
"expires_at": "2025-02-22T22:47:37.150Z"
}Invalid request.
Error types:
invalid_request: One or more body fields are missing or invalid (usage_type,expires_in_secondsout of range,client_reference_idtoo long,max_session_duration_secondsout of range, etc.). Inspectvalidation_errors.
{
"status_code": 400,
"error_type": "invalid_request",
"message": "Your request did not pass validation. One or more fields in the request body are missing or have invalid values. See `validation_errors` for the specific field and retry with corrected values.",
"validation_errors": [
{
"error_type": "less_than_equal",
"location": "body.payload.expires_in_seconds",
"message": "Input should be less than or equal to 3600"
}
],
"request_id": "3d37a3bd-5078-47ee-a369-b204e3bbedda",
"more_info": "https://soniox.com/docs/api-reference/errors#invalid-request"
}Authentication error.
{
"status_code": 401,
"error_type": "unauthenticated",
"message": "Incorrect API key provided. You can get an API key at https://console.soniox.com",
"validation_errors": [],
"request_id": "3d37a3bd-5078-47ee-a369-b204e3bbedda",
"more_info": "https://soniox.com/docs/api-reference/errors#unauthenticated"
}Rate / capacity limit exceeded.
Error types:
limit_exceeded: The caller hit a per-minute request rate or other capacity limit. Themessagedescribes which limit was hit.
{
"status_code": 429,
"error_type": "limit_exceeded",
"message": "Requests per minute limit for temporary API key creation has been exceeded for your organization.",
"validation_errors": [],
"request_id": "3d37a3bd-5078-47ee-a369-b204e3bbedda",
"more_info": "https://soniox.com/docs/api-reference/errors#limit-exceeded"
}Internal server error.
{
"status_code": 500,
"error_type": "internal_error",
"message": "The server encountered an error. Please try again. If the issue persists contact support@soniox.com.",
"validation_errors": [],
"request_id": "3d37a3bd-5078-47ee-a369-b204e3bbedda",
"more_info": "https://soniox.com/docs/api-reference/errors#internal-error"
}