---
title: "Mint a short-lived Azure Speech token (STT/TTS)"
method: POST
path: "/api/lia/speech/token"
tags: ["Lia"]
---

# Mint a short-lived Azure Speech token (STT/TTS)

`POST /api/lia/speech/token`

## Request

- Base URL: `https://api.leapsurgebi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.leapsurgebi.com/api/lia/speech/token`
- Auth: OAuth 2
  - Password
  - Token URL: `/auth/token`
- TypeScript: <https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/docs/api/lia/speech/token/post.ts> (a function with typed inputs; its response is checked against the schema)

Returns a 10-minute authorization token for direct Azure STT/TTS calls.

Why this pattern:
- The raw AZURE_SPEECH_KEY never leaves the server.
- Tokens expire in 10 minutes — limited blast radius if leaked.
- The frontend connects directly to Azure via WebSocket using the token,
  so audio streaming is realtime (no round-trip through this backend).

Frontend usage with Microsoft Speech SDK:
    const config = sdk.SpeechConfig.fromAuthorizationToken(token, region);

## Response `200`

Successful Response

- SpeechTokenResponse
  - `token` string, required
  - `region` string, required
  - `expires_in` integer, required: Seconds until token expires (Azure default: 600)

## Changes

- **2026-09-24** `23b42df3193a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/changes/api/lia/speech/token/post.md)

---

[API](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi.md) - [All operations](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/llms.txt) - [OpenAPI document](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/revisions/13653cb8ee76?raw)
