Speechify Audio API

The Audio API from Speechify — 2 operation(s) for audio.

OpenAPI Specification

speechify-audio-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Speechify Voice Audio API
  description: Specification of the Speechify Voice API (Text-to-Speech). The API synthesizes lifelike speech from plain text or SSML in 30+ languages, supports non-streaming and streaming audio, lists available voices, and creates and deletes instant voice clones. All requests authenticate with a Bearer API key.
  termsOfService: https://speechify.com/terms/
  contact:
    name: Speechify Support
    url: https://docs.sws.speechify.com
  version: '1.0'
servers:
- url: https://api.sws.speechify.com
security:
- bearerAuth: []
tags:
- name: Audio
paths:
  /v1/audio/speech:
    post:
      operationId: createSpeech
      tags:
      - Audio
      summary: Convert text to speech
      description: Synthesizes speech for the given input and returns a JSON object with base64-encoded audio data, the audio format, the billable character count, and speech marks describing word-level timing.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetSpeechRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSpeechResponse'
        '401':
          description: Unauthorized - missing or invalid API key.
        '422':
          description: Unprocessable entity - invalid request parameters.
  /v1/audio/stream:
    post:
      operationId: streamSpeech
      tags:
      - Audio
      summary: Stream text to speech
      description: Synthesizes speech for the given input and returns the raw audio as a chunked HTTP stream for low-latency playback. The response content type is selected with the Accept header. WAV is not available for streaming; use /v1/audio/speech for WAV output.
      parameters:
      - name: Accept
        in: header
        required: false
        description: Desired audio container for the streamed response. Allowed values are audio/mpeg, audio/ogg, audio/aac, or audio/pcm.
        schema:
          type: string
          enum:
          - audio/mpeg
          - audio/ogg
          - audio/aac
          - audio/pcm
          default: audio/mpeg
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetStreamRequest'
      responses:
        '200':
          description: A chunked stream of synthesized audio bytes.
          headers:
            Transfer-Encoding:
              schema:
                type: string
              description: chunked
          content:
            audio/mpeg:
              schema:
                type: string
                format: binary
            audio/ogg:
              schema:
                type: string
                format: binary
            audio/aac:
              schema:
                type: string
                format: binary
            audio/pcm:
              schema:
                type: string
                format: binary
        '401':
          description: Unauthorized - missing or invalid API key.
        '422':
          description: Unprocessable entity - invalid request parameters.
components:
  schemas:
    GetStreamRequest:
      type: object
      required:
      - input
      - voice_id
      properties:
        input:
          type: string
          description: Plain text or SSML to be synthesized to speech.
        voice_id:
          type: string
          description: Id of the voice to be used for synthesizing speech.
        language:
          type: string
          description: ISO 639-1 language code and ISO 3166-1 region code separated by a hyphen, e.g. en-US.
          example: en-US
        model:
          type: string
          enum:
          - simba-english
          - simba-multilingual
          default: simba-english
        options:
          $ref: '#/components/schemas/SpeechOptions'
    GetSpeechResponse:
      type: object
      properties:
        audio_data:
          type: string
          format: byte
          description: Base64-encoded synthesized audio.
        audio_format:
          type: string
          description: The format of the returned audio.
          enum:
          - wav
          - mp3
          - ogg
          - aac
          - pcm
        billable_characters_count:
          type: integer
          description: The number of billable characters processed in the request.
        speech_marks:
          $ref: '#/components/schemas/SpeechMarks'
    SpeechOptions:
      type: object
      description: Optional synthesis controls.
      properties:
        loudness_normalization:
          type: boolean
          description: Whether to normalize the loudness of the output audio.
        text_normalization:
          type: boolean
          description: Whether to apply text normalization (e.g. expanding numbers and abbreviations) before synthesis.
    SpeechMarks:
      type: object
      description: A nested chunk structure mapping spans of text to start and end times in the synthesized audio, informing the client when each word is spoken.
      properties:
        type:
          type: string
          example: sentence
        start:
          type: integer
          description: Character offset of the start of the chunk in the input.
        end:
          type: integer
          description: Character offset of the end of the chunk in the input.
        start_time:
          type: number
          description: Start time of the chunk in the audio, in milliseconds.
        end_time:
          type: number
          description: End time of the chunk in the audio, in milliseconds.
        value:
          type: string
          description: The text value of the chunk.
        chunks:
          type: array
          description: Nested speech marks, e.g. words within a sentence.
          items:
            $ref: '#/components/schemas/SpeechMarks'
    GetSpeechRequest:
      type: object
      required:
      - input
      - voice_id
      properties:
        input:
          type: string
          description: Plain text or SSML to be synthesized to speech.
        voice_id:
          type: string
          description: Id of the voice to be used for synthesizing speech.
        language:
          type: string
          description: ISO 639-1 language code and ISO 3166-1 region code separated by a hyphen, e.g. en-US.
          example: en-US
        model:
          type: string
          description: Synthesis model to use.
          enum:
          - simba-english
          - simba-multilingual
          default: simba-english
        audio_format:
          type: string
          description: Output audio container.
          enum:
          - wav
          - mp3
          - ogg
          - aac
          - pcm
          default: wav
        options:
          $ref: '#/components/schemas/SpeechOptions'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Pass your Speechify API key as a Bearer token in the Authorization header, e.g. "Authorization: Bearer $SPEECHIFY_API_KEY".'