API Documentation for Legal Text to Speech

By VerbaLaw editorial team · Updated 2026-11-19

This documentation provides the technical specifications for integrating VerbaLaw’s text-to-speech API into legal technology workflows. It covers authentication, endpoint structures, and parameter handling for generating auditable audio from regulatory texts. The guide is designed for engineering teams building compliance tools, requiring precise integration with existing systems.

Readers will find concrete integration steps for Python and cURL, including rate limit constraints and error handling. The API supports standard formats and multiple voices, optimized for accurate pronunciation of complex legal terminology. This page serves as the primary reference for developers deploying speech synthesis for corporate or startup environments.

API Documentation for Legal Text to Speech

Frequently asked questions

What is the base URL for the API?

The API base URL is https://api.winpk.cc/v1. You send POST requests to https://api.winpk.cc/v1/audio/speech for synthesis. Use GET /v1/voices and GET /v1/models for metadata. This endpoint structure mirrors the OpenAI speech endpoint, allowing standard integration patterns for legal tech workflows.

How do I generate an API key?

Generate a key by signing in at https://winpk.cc/get-api-key/ using Google or email. Accounts receive one active key. You can issue a new key at any time; the old one stops immediately. The dashboard displays your key, balance, and usage statistics for compliance tracking.

Can I use the OpenAI Python SDK?

Yes. The API accepts the same request shape as the OpenAI speech endpoint. Configure the OpenAI Python SDK by setting the base_url to https://api.winpk.cc/v1 and providing your VerbaLaw API key. This allows you to use official SDKs without writing custom HTTP clients for integration.

What is the maximum input length?

The maximum input length is 4096 characters per request. If your legal document exceeds this limit, split the text into chunks of up to 4096 characters. Generate audio for each chunk and join the resulting files to create the complete audio output for your compliance documentation.

How do I handle rate limits?

The rate limit is 60 requests per minute per key. New accounts start with 10 requests per minute until the first top-up. Process requests sequentially; under load, requests may queue. Implement retry logic with exponential backoff to handle temporary throttling during high-volume document synthesis.

What formats are supported?

Supported response formats are mp3, wav, opus, flac, and pcm. Specify the format in the request body. MP3 and WAV are standard formats. FLAC offers lossless quality. PCM provides raw audio data. Choose the format that fits your storage and playback infrastructure requirements.

Is there an SSML endpoint?

No. The API does not support SSML (Speech Synthesis Markup Language). You cannot use SSML tags for pronunciation or pauses. Control speech characteristics using the speed parameter (0.25–4.0) and voice selection. For complex timing, split your text into separate requests and manage playback externally.

How do I rotate my key?

Rotate your key by issuing a new one from the dashboard at https://winpk.cc/get-api-key/. The new key becomes active immediately. The previous key stops working at once. Update your application configuration to use the new key. This ensures secure access control for your legal tech environment.

What happens on error?

If synthesis fails, the request is free, and the charge is returned in full. Failed requests do not consume your balance. Check the response status code and message for details. Common errors include invalid input length or unsupported voice. Retry failed requests after addressing the error condition.

Do I need to install extra libraries?

No. You can use the official OpenAI SDK or plain HTTP libraries. No proprietary VerbaLaw SDK is required. The API is RESTful and standard. Use any HTTP client capable of sending JSON payloads. This minimizes dependencies in your legal tech stack and simplifies deployment.

Is the API RESTful?

Yes. The API is RESTful. Use POST for audio generation and GET for metadata retrieval. Endpoints are standardized: /v1/audio/speech, /v1/voices, and /v1/models. Requests are JSON, and responses return audio data or JSON metadata. This structure aligns with standard web service conventions for easy integration.

How do I test the endpoint?

Use the curl example provided on the dashboard at https://winpk.cc/get-api-key/. Send a POST request to https://api.winpk.cc/v1/audio/speech with your key. Verify the response contains audio data. Test with short texts first to confirm authentication and format settings before processing larger legal documents.

Can I stream the audio?

No. The API does not support streaming or WebSocket connections. Audio is returned as a complete file in the response. For real-time playback, download the full file first. This synchronous model ensures reliable delivery of audio assets.

What is the response schema?

The response contains the audio file in the requested format. Headers include content-type and content-length. The body is binary audio data. For errors, the response includes a JSON object with error details. Use the OpenAI SDK or parse the binary stream directly in your application.

First request

curl

curl https://api.winpk.cc/v1/audio/speech \
  -H "Authorization: Bearer $TTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"tts-1","voice":"aria","input":"Hello from the API.","response_format":"mp3"}' \
  --output hello.mp3

Python (openai)

from openai import OpenAI

client = OpenAI(base_url="https://api.winpk.cc/v1", api_key="tts-...")

with client.audio.speech.with_streaming_response.create(
    model="tts-1", voice="nova", input="Hello from Python.", response_format="mp3"
) as response:
    response.stream_to_file("hello.mp3")

Node.js (openai)

import OpenAI from "openai";
import fs from "node:fs";

const client = new OpenAI({ baseURL: "https://api.winpk.cc/v1", apiKey: process.env.TTS_API_KEY });
const res = await client.audio.speech.create({ model: "tts-1", voice: "milo", input: "Hello from Node.js." });
fs.writeFileSync("hello.mp3", Buffer.from(await res.arrayBuffer()));
voice
ariafemale
novafemale
lunafemale
sagefemale
felixmale
milomale
atlasmale
orionmale
language
arالعربية
zh中文
daDansk
nlNederlands
enEnglish
fiSuomi
frFrançais
deDeutsch
elΕλληνικά
heעברית
hiहिन्दी
itItaliano
ja日本語
ko한국어
msBahasa Melayu
noNorsk
plPolski
ptPortuguês
ruРусский
esEspañol
swKiswahili
svSvenska
trTürkçe

Authentication

Sound wave illustration for: Authentication

Secure access to the VerbaLaw TTS API requires a Bearer Token passed in the HTTP header. Each account holds one active key; include Authorization: Bearer tts-... with every request to authenticate your legal tech startup’s usage.

Bearer Token

Bearer Token

Generate your key via the /get-api-key/ dashboard. The token identifies your account and tracks character consumption against your balance. Ensure the header format matches standard OAuth 2.0 conventions for seamless integration with your compliance systems.

Key Rotation

Key Rotation

Issue a new key at any time via the dashboard. The previous key terminates immediately, ensuring no overlap in active credentials. This instant invalidation is critical for audit trails in regulated environments where access history must be precise.

  • Old key stops instantly.
  • No grace period.
  • Single active key per account.

Security

Keys are tied to your account balance and rate limits. Store them securely in your environment variables, not in client-side code. Failed requests do not consume credits, but authenticated requests count toward your 60 requests-per-minute limit.

  • One key per account.
  • Instant invalidation on rotation.
  • No shared keys.

Endpoints

Sound wave illustration for: Endpoints

The API provides three primary endpoints to manage speech synthesis and resource discovery. The speech endpoint processes text into audio, while the voices and models endpoints expose available configurations without consuming credits.

Speech Endpoint

Send text to generate audio via POST https://api.winpk.cc/v1/audio/speech. This is the core endpoint for converting legal documents, compliance notes, or regulatory text into audible formats. It accepts JSON payloads with model, voice, and format specifications.

Voices List

Retrieve available voice presets and their metadata using GET https://api.winpk.cc/v1/voices. This endpoint returns the eight available voices (e.g., aria, atlas, milo) along with supported languages and formats, allowing your application to dynamically select the appropriate tone for different document types.

  • Returns voice ID, name, gender, and description.
  • Lists supported languages and output formats.
  • Includes pricing for tts-1 and tts-1-hd models.

Models List

Check available models via GET https://api.winpk.cc/v1/models. This endpoint confirms the two engine options: tts-1 and tts-1-hd. Both models use the same engine and pricing structure, allowing you to standardize your integration logic while offering quality variations if needed.

Request Parameters

Sound wave illustration for: Request Parameters

Configure the request body to synthesize legal text. The API accepts up to 4,096 characters per request, counting spaces and punctuation. For longer compliance documents, split the input into chunks and join the resulting audio files sequentially.

Input Text

The input field accepts a string of up to 4,096 characters. Spaces and punctuation count toward this limit. If your regulatory text exceeds this length, send multiple requests and concatenate the returned audio files to reconstruct the full document.

Voice Selection

Select one of eight preset voices using the voice parameter. Each voice has a distinct tone suitable for different legal contexts, from neutral news delivery to warm narration. The language field is optional; if omitted, the system guesses the language, but setting it explicitly ensures accuracy for non-English Latin-script text.

  • aria: warm, clear narrator
  • nova: bright, upbeat
  • luna: soft, storytelling
  • sage: calm, instructional
  • felix: energetic, promo
  • milo: friendly, conversational
  • atlas: neutral, news
  • orion: deep, documentary

Response Format

Specify the output format using the response_format field. Available options include mp3, wav, opus, flac, and pcm. Choose mp3 for standard compatibility or flac/wav for lossless quality during archival. The speed parameter allows adjustment from 0.25 to 4.0, enabling faster playback for review or detailed listening for compliance checks.

Response Handling

Sound wave illustration for: Response Handling

Upon successful synthesis, the API returns the generated audio file directly in the response body as binary data. The format matches the response_format parameter specified in the request, allowing legal tech systems to pipe the output directly into storage or playback pipelines without intermediate conversion steps.

Audio Binary

The response body contains the raw audio bytes. For formats like MP3 or WAV, the file is immediately playable. For PCM, the data is raw audio bytes, which may require specific handling by your audio processing library before playback or storage.

Error Codes

Standard HTTP status codes indicate the request outcome. A 200 OK signifies successful synthesis. Common errors include 400 Bad Request for invalid parameters, 401 Unauthorized for invalid API keys, and 429 Too Many Requests if you exceed the 60 requests per minute limit.

  • 400: Invalid JSON or missing required fields like input or voice.
  • 401: Invalid or expired Bearer token.
  • 429: Rate limit exceeded (60 req/min).
  • 500: Internal server error during synthesis.

Headers

Response headers provide metadata about the request and the generated asset. The Content-Type header specifies the MIME type of the audio file (e.g., audio/mpeg, audio/wav). The X-Request-ID header allows you to trace specific synthesis jobs in logs for debugging purposes.

  • Content-Type: Specifies the audio format (e.g., audio/mpeg).
  • X-Request-ID: Unique identifier for the request, useful for debugging and auditing.
  • Content-Length: Size of the audio file in bytes.

SDK Integration

Sound wave illustration for: SDK Integration

The VerbaLaw API is fully compatible with the official OpenAI SDK, allowing legal tech teams to leverage familiar code structures for speech synthesis. By simply adjusting the base URL, developers can integrate text-to-audio capabilities directly into their compliance document pipelines without learning a new library.

OpenAI SDK Setup

Install the standard OpenAI Python library. Ensure your environment variables or configuration object include your unique Bearer token starting with tts-.

Base URL Change

Point the SDK client to the VerbaLaw endpoint by setting base_url to https://api.winpk.cc/v1. This redirects all requests to the correct synthesis engine while maintaining standard request shapes.

Python Example

Use the OpenAI client to generate audio. Pass your text, selected voice (e.g., atlas for neutral news tone), and desired format. The response contains the binary audio data ready for storage or playback in your legal application.

  • Initialize client with base_url='https://api.winpk.cc/v1'
  • Use client.audio.speech.create()
  • Specify model='tts-1' or tts-1-hd
SDK Integration

Curl Example

Sound wave illustration for: Curl Example

Use cURL for direct HTTP verification of the VerbaLaw API. This method confirms that your key and payload structure are correct before integrating with your application.

The following examples demonstrate the standard request shape required for generating audio from legal texts. Adjust the parameters to match your specific compliance document needs.

Basic Request

Send a POST request to the speech endpoint. The API returns the audio file directly in the response body, allowing immediate playback or storage.

Headers

Include your Bearer token in the Authorization header. Specify the content type as application/json to ensure proper parsing of the request body.

  • Authorization: Bearer tts-your-api-key-here
  • Content-Type: application/json

Payload

The JSON body contains the text input, model selection, voice preset, and desired output format. Ensure the text does not exceed 4096 characters.

  • model: "tts-1"
  • input: "The defendant shall pay the sum of..."
  • voice: "sage"
  • response_format: "mp3"

Limits and Errors

Sound wave illustration for: Limits and Errors

Ensure input text does not exceed 4096 characters per request. For longer compliance documents, split the text into smaller parts and join the resulting audio files.

Your API key is limited to 60 requests per minute. If you have not topped up, the limit is 10 requests per minute. Exceeding these limits will trigger a rate limit error.

4096 Character Limit

Each API call accepts a maximum of 4096 characters. Spaces and punctuation count toward this limit. If your legal text exceeds this length, divide it into segments and concatenate the output audio files.

Short phrases may take a few seconds to generate, while longer texts process at roughly real-time speed (25 characters per second). Requests are processed sequentially, so under load, a request may wait in a queue.

Rate Limiting

The standard rate limit is 60 requests per minute per key. New accounts without a top-up are restricted to 10 requests per minute. Exceeding these limits results in a 429 Too Many Requests error.

Monitor your usage via the dashboard. If you require higher throughput, consider implementing exponential backoff in your integration to handle temporary rate limit errors gracefully.

  • 60 requests/minute after top-up
  • 10 requests/minute for new accounts
  • Requests processed sequentially

Common Errors

400 Bad Request: Invalid parameters or missing required fields. 401 Unauthorized: Invalid or expired API key. 429 Too Many Requests: Rate limit exceeded. 500 Internal Server Error: Temporary service issue.

Failed synthesis requests are free. If a request fails, the charge is returned in full. Check the response body for detailed error messages to identify the cause.

Formats

Sound wave illustration for: Formats

The API supports five audio formats to suit different compliance and storage needs. MP3 provides efficient compression for standard playback, while WAV offers uncompressed linear PCM for maximum compatibility with legacy legal systems.

FLAC delivers lossless compression, preserving exact audio fidelity without the file size overhead of WAV. PCM is also available for raw data processing. All formats include the synthetic watermark for audit trails.

MP3 Compatibility

MP3 is the default format, offering broad compatibility with most legal case management software and document review platforms. It balances file size and quality effectively for standard archival purposes.

WAV Quality

WAV provides uncompressed audio, ensuring no data loss during transmission. This format is ideal for high-precision audio analysis or when integrating with systems that require raw audio streams for immediate playback.

FLAC Lossless

FLAC offers lossless compression, reducing file size compared to WAV while retaining identical audio quality. This is optimal for long regulatory documents where storage efficiency matters without sacrificing fidelity.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Managing this key is straightforward, with one active key per account that can be rotated instantly if needed.

Avatar of the voice aria
ariafemale
Avatar of the voice nova
novafemale
Avatar of the voice luna
lunafemale
Avatar of the voice sage
sagefemale
Avatar of the voice felix
felixmale
Avatar of the voice milo
milomale
Avatar of the voice atlas
atlasmale
Avatar of the voice orion
orionmale

23 languages

Any voice speaks any of these languages.

Sources and further reading

  1. Wikipedia
  2. IETF RFC 7845: Ogg Opus
  3. Python documentation
  4. W3C WAI: making audio and video accessible
  5. openai-python on GitHub
  6. Node.js documentation
  7. FFmpeg documentation
  8. LibriVox public-domain audiobooks
  9. LibriTTS-R paper (arXiv 2305.18802)
  10. OpenAI API reference: create speech
  11. curl documentation
  12. LibriTTS-R corpus (OpenSLR 141)

More on this site