Your API key must be used with any interaction with the Speechmatics API to authenticate to the service. Any interaction without this key will receive a `HTTP 401 - Unauthorized` response. It is recommended that you store and provide access to the API key on the principle of least privilege. If you believe that your key has been compromised, please reach out to Support. To create an API key, first navigate to the Portal and sign in or create an account, if you don't have one already. Then, navigate to Settings > API Keys page to create an API key. Enter a name for your API key and then store it somewhere safe when you have generated it. Your API key needs to be included in the header of all requests to the Speechmatics Jobs API. For example: ``` curl -X GET "https://eu1.asr.api.speechmatics.com/v2/jobs/" \ -H "Authorization: Bearer $API_KEY" ``` For server-side calls, your API key must be provided in the header of the WebSocket connection request. For example: ``` GET /v2/ HTTP/1.1 Host: eu.rt.speechmatics.com Upgrade: websocket Connection: Upgrade Authorization: Bearer YOUR_API_KEY User-Agent: Python/3.8 websockets/8.1 ``` For client-side calls, we recommend using temporary keys (JWTs) to authenticate your requests. These can be passed as a query param to the WebSocket connection request URL. For example: ``` wss://eu.rt.speechmatics.com/v2?jwt=$TEMP_KEY ``` For server-side calls, your API key must be provided in the header of the WebSocket connection request to the `/v2/agent` path. For example: ``` GET /v2/agent HTTP/1.1 Host: eu.rt.speechmatics.com Upgrade: websocket Connection: Upgrade Authorization: Bearer YOUR_API_KEY User-Agent: Python/3.12 websockets/15.0 ``` For client-side calls, we recommend using temporary keys (JWTs) to authenticate your requests. Agent STT uses Realtime (`type=rt`) temporary keys. These can be passed as a query param to the WebSocket connection request URL. For example: ``` wss://global.rt.speechmatics.com/v2/agent?jwt=$TEMP_KEY ``` All production endpoints are active and highly available. You can use multiple regions to balance requests or provide a failover in the event of disruption to one region. If you are an enterprise customer and would like to use a different region than the one specified in your contract, please contact your account manager or support. Speechmatics Batch SaaS supports the following endpoints for production use: | Customer type | Region | Endpoint | |---|---|---| | All | EU1 (Europe) | eu1.asr.api.speechmatics.com | | Enterprise | EU2 (Europe) | eu2.asr.api.speechmatics.com | | All | US1 (USA) | us1.asr.api.speechmatics.com | | Enterprise | US2 (USA) | us2.asr.api.speechmatics.com | | All | AU1 (Australia) | au1.asr.api.speechmatics.com | Jobs are created in the region corresponding to the endpoint used. You must use the same endpoint for all requests relating to a specific job. The Melia 1 and Oak 1 models are available on the EU1, US1, and AU1 endpoints only. For details, refer to Models. The EU2 and US2 Batch SaaS endpoints are provided for enterprise customer high availability and failover purposes only. Jobs created in these environments will not be visible in the Portal. Speechmatics Realtime SaaS supports the following endpoints for production use: | Region | Endpoint | |---|---| | Global (auto-routed) | global.rt.speechmatics.com | | EU1 (Europe) | eu.rt.speechmatics.com | | US1 (USA) | us.rt.speechmatics.com | | AU1 (Australia) | au.rt.speechmatics.com | `global.rt.speechmatics.com` automatically routes each connection to the nearest region for lowest latency, so you don't have to select one. The regional endpoints remain available if you want to pin to a specific region. `global.rt.speechmatics.com` may route a connection to any region. If you have data residency or compliance requirements, use a regional endpoint (`eu.rt.speechmatics.com`, `us.rt.speechmatics.com`, or `au.rt.speechmatics.com`) instead. Speechmatics Agent STT supports the following endpoints for production use: Connect to the `/v2/agent` path, for example `wss://eu.rt.speechmatics.com/v2/agent`. See the Agent STT Reference. Speechmatics allows you to generate temporary keys to authenticate your requests instead of your long-lived API key. This can improve end-user experience by reducing latency, and can also reduce development effort and complexity. If you are an enterprise customer and would like to use temporary keys, reach out to support or speak to your account manager. For Batch jobs, using temporary keys allows your end-users to upload their audio to Speechmatics directly, without exposing your long-lived API key. This approach can reduce development effort, storage and bandwidth costs. When you generate a temporary key with a `client_ref`, that temporary key will only be able to create and retrieve jobs associated with that `client_ref`. `client_ref` should be a `string` that uniquely identifies an end-user. A Batch temporary key is valid in one region only. Set `region` to the region of the Batch endpoint you will call, or the temporary key will be rejected. If you omit `region`, the temporary key is created for `eu`. Note that temporary keys generated with a `client_ref` can't access the Usage Batch API endpoint and will receive a `HTTP 403 - Forbidden`. If your Batch temporary key will be exposed to end-users, for example in the browser, then you must use the `client_ref` parameter. This will prevent one user from viewing or deleting the jobs of another user. The example request below creates a temporary key which can be used to create and retrieve Batch jobs for 60 seconds. These jobs will be associated with the reference 'USER123': ``` curl -L -X POST "https://mp.speechmatics.com/v1/jwts?type=batch" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{"ttl": 60, "client_ref": "USER123"}' ``` The response JSON looks like this: ``` { "key_value": "eyJhbG..." } ``` To authorize a request using a temporary key, simply use it in place of the API key in the authorization header. For example, if you created a temporary key associated with a given `client_ref` you can retrieve those jobs as follows: ``` curl -X GET "https://eu1.asr.api.speechmatics.com/v2/jobs/" \ -H "Authorization: Bearer $TEMP_KEY" ``` For Realtime transcription, temporary keys allow the end-user to start a WebSocket connection with Speechmatics directly, without exposing your long-lived API key. This will reduce the latency of transcription, as well as development effort. A Realtime temporary key is not tied to a region. The same key works with any Realtime endpoint, including `global.rt.speechmatics.com`. The example request below will create a temporary key which can be used to start any number of Realtime transcription settings for 60 seconds: ``` curl -L -X POST "https://mp.speechmatics.com/v1/jwts?type=rt" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{"ttl": 60 }' ``` Agent STT uses Realtime temporary keys. Request a key with `type=rt` and use it on the `/v2/agent` path — there is no separate Agent STT key type. Temporary keys allow the end-user to start a WebSocket connection with Speechmatics directly, without exposing your long-lived API key. This reduces the latency of transcription, as well as development effort. An Agent STT temporary key is not tied to a region. The same key works with any Agent STT endpoint, including `global.rt.speechmatics.com`. The example request below will create a temporary key which can be used to start any number of Agent STT sessions for 60 seconds: ``` curl -L -X POST "https://mp.speechmatics.com/v1/jwts?type=rt" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{"ttl": 60 }' ``` `POST /v1/jwts` replaces the deprecated `POST /v1/api_keys` endpoint. If you still use `/v1/api_keys`, migrate to `/v1/jwts`. The `type` parameter, `ttl`, `client_ref` and `region` work the same way. The response contains only `key_value`, and the key is always issued for the project that owns the API key you authenticate with. | URL query parameter | Required | Description | |---|---|---| | `type` | No | String: `batch`(default),`rt`. Whether the token should be able to use the Batch API, or the Realtime and Agent STT APIs. | | Request Body Parameters | Required | Description | |---|---|---| | `ttl` | Yes | Integer: 60-86400. The temporary key's time to live in seconds. NoteWe suggest using the shortest TTL possible to minimise security risks. | | `client_ref` | No | String. When provided, `batch`tokens can only create and retrieve jobs with that reference; without it, they can access any job.Mustbe set when temporary keys are exposed to end-users to prevent accessing another user's data.`client_ref`is ignored when requesting`rt`tokens. | | `region` | No | String: `eu`(default),`usa`, or`au`. Set this for`batch`temporary keys used outside Europe. A`batch`temporary key is valid only in this region, so it must match the Batch endpoint you call. If omitted, the temporary key is created for`eu`. Not needed for`rt`temporary keys, which work in every region and ignore this parameter. | Get started with the API by trying out the "Hello World" example in the Speechmatics Academy.