API reference

Base URL, authentication, SDKs, conventions and every endpoint of the Wistfare Voice API.

The Wistfare Voice API is a REST API over HTTPS, plus one WebSocket for live transcription. Requests and responses are JSON, except audio uploads (multipart) and generated audio (bytes).

https://api.voice.wistfare.com

Authentication

Send your API key as a bearer token on every request, REST or WebSocket:

Authorization: Bearer wv_sk_…

That's all. See Authentication for keys, permissions and key safety.

SDKs

pip install wistfareai               # Python 3.9+
pip install "wistfareai[mic]"        # + live transcription from the microphone
pip install "wistfareai[numpy]"      # + numpy audio input for live streams
from wistfareai import WistfareAI, AsyncWistfareAI

client = WistfareAI(api_key="wv_sk_...")  # or set WISTFARE_API_KEY and call WistfareAI()
# AsyncWistfareAI has the same methods with `await`.

SDK preview

The wistfareai packages for Python (PyPI) and JavaScript (npm) publish soon. Every endpoint also has a cURL example, and any HTTP client works.

Both SDKs read WISTFARE_API_KEY and WISTFARE_BASE_URL from the environment, retry connection errors and 408/429/5xx responses twice with exponential backoff (a slow transcription is never sent twice), and use a 10-minute request timeout (timeout, in seconds in Python and milliseconds in JavaScript).

SDK and HTTP defaults

The SDKs and the HTTP API share the same defaults: wistfare-stt-v3-beta, language=auto, diarize off and word timestamps on. A few options are spelled differently:

OptionSDKsHTTP
Word timestampstimestamps="word" (or None / null)timestamps=true / false
Key termskey_terms / keyTerms (a list)boost (comma- or newline-separated)
Audio format (text to speech)output_format / outputFormatformat

SDK errors

Every SDK error is a WistfareError with status, code (the API's error.code) and request_id / requestId:

ClassWhen
BadRequestError400, 413, 422: e.g. unsupported_language, audio_too_long, file_too_large, validation_error
AuthenticationError401, or a refused live handshake (bad or revoked key, unknown or used token)
InsufficientCreditsError402: insufficient_credits, budget_exceeded
PermissionDeniedError403: read_only_key, account_suspended
NotFoundError / ConflictError / RateLimitError404 / 409 (e.g. idempotency_in_progress) / 429 (rate_limited, concurrency_limit)
InternalServerError5xx, after retries
APIConnectionError / APITimeoutErrorNetwork failure or timeout
RealtimeErrorA live session ended with an error; transcript has what was saved
WaitTimeoutErrorjobs.wait() or batches.wait() ran out of time
WebhookVerificationErrorverify_webhook / verifyWebhook rejected a delivery

Endpoints

EndpointDescription
POST /v1/sttTranscribe an audio or video file.
GET /v1/stt/transcriptions/{id}Retrieve a transcription.
WS /v1/stt/streamLive transcription over a WebSocket.
POST /v1/stt/stream/tokensSingle-use token for client-side streaming (optional).
POST /v1/stt/jobsCreate a batch transcription job.
GET /v1/stt/jobs/{id}Retrieve a job.
GET /v1/stt/jobsList recent jobs.
POST /v1/stt/jobs/{id}/cancelCancel a job's remaining files.
POST /v1/ttsConvert text to speech.
POST /v1/batchesGenerate up to 100 clips in one call.
GET /v1/batches/{id}Retrieve a batch.
GET /v1/batchesList recent batches.
GET /v1/batches/{id}/items/{ref}/audioDownload one batch item's audio.
GET /v1/voicesList voices.
GET /v1/voices/{id}/previewFetch a voice preview.
GET /v1/usageDaily usage and spend.

Idempotency

POST /v1/stt, POST /v1/stt/jobs, POST /v1/tts and POST /v1/batches accept an Idempotency-Key header (1 to 128 printable ASCII characters, no spaces), for example a UUID you generate per logical request. If a request times out or the connection drops, retry it with the same key and the same body: you get the original response back (status, body and billing headers) and are charged once.

curl https://api.voice.wistfare.com/v1/stt \
  -H "Authorization: Bearer $WISTFARE_API_KEY" \
  -H "Idempotency-Key: 6f1d0c4e-9a2b-4c7e-8f3a-2b5d7e9c1a04" \
  -F "file=@call.wav"
SituationResult
Same key, same endpoint and body, first request finishedThe stored response is replayed (with a new X-Request-Id).
Same key while the first request is still running409 idempotency_in_progress. Retry after a moment.
Same key with a different body or endpoint422 idempotency_mismatch.

Keys are scoped to the API key that sent them and kept for 24 hours. For multipart uploads, the file contents are compared, not the random multipart boundary.

Request IDs

Every response, including WebSocket handshakes, carries an X-Request-Id header, and every error body includes the same value as error.request_id. Send your own X-Request-Id (1 to 128 letters, digits, _, ., : or -) to correlate with your logs; it's echoed back, otherwise one is generated. Include it when you contact support. The SDKs expose it as request_id / requestId on results and errors.

Rate and concurrency limits

Each account has default limits on API requests (120 per minute, 5,000 per day), concurrent file transcriptions (4), concurrent live sessions (2), active batch jobs (1) and stream tokens (20 per minute). Over a limit, the API returns 429 with rate_limited or concurrency_limit and a Retry-After header (in seconds); live sessions are refused with close code 4429. Back off for at least Retry-After before retrying. Limits can be raised on request; see Account limits.

Conventions

  • Money is in integer US cents: cost_cents: 15 is $0.15.
  • Durations are float seconds; timestamps are ISO-8601 in UTC.
  • Ids are prefixed by type: tr_ transcriptions, sttjob_ / sttitem_ transcription jobs and their files, gen_ generations, batch_ batches, vc_ voices, key_ API keys.
  • Booleans in multipart forms are the strings true or false.
  • Errors always look like {"error": {"code": "…", "message": "…", "request_id": "…"}}. Branch on code; see Errors.

Cost headers

Billable endpoints report what each request cost:

HeaderExampleMeaning
X-Credits-Charged-Cents2What this request cost, in US cents.
X-Audio-Seconds4.62Seconds of audio billed (input for speech to text, output for text to speech).
X-Transcription-Idtr_7c31be92a1f04d2e8b9cPOST /v1/stt: the transcription id.
X-Generation-Idgen_7c31be92a1f04d2e8b9cPOST /v1/tts: the generation id.
X-Request-Id9b2f4c1e6a8d4e0fb3c7a5d2e1f09a64Every response: the request's correlation id.

Machine-readable docs

These docs are also available as plain Markdown for LLMs and tools: /docs/llms.txt is an index, /docs/llms-full.txt is everything in one file, and adding .md to any page URL returns that page as Markdown.

On this page