Soniox

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.

POST
https://api.soniox.com/v1/auth/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 for details.

Headers

AuthorizationRequiredBearer <SONIOX_API_KEY>

Request

application/jsonRequired
usage_typeRequiredstring

Intended usage of the temporary API key.

Value in: "transcribe_websocket" | "tts_rt"
expires_in_secondsRequiredinteger

Duration in seconds until the temporary API key expires.

Minimum: 1Maximum: 3600
client_reference_idstring

Optional tracking identifier string. Does not need to be unique.

Maximum length: 256
single_useboolean

If true, the temporary API key can be used only once.

max_session_duration_secondsinteger

Maximum 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.

Minimum: 1Maximum: 18000

Response

201

Created temporary API key.

api_keyRequiredstring

Created temporary API key.

expires_atRequiredstring

UTC timestamp indicating when generated temporary API key will expire.

Format: "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_seconds out of range, client_reference_id too long, max_session_duration_seconds out of range, etc.). Inspect validation_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. The message describes 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"
}