Sarvam speechToTextJob API

The speechToTextJob API from Sarvam — 5 operation(s) for speechtotextjob.

OpenAPI Specification

sarvam-speechtotextjob-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Endpoints chat speechToTextJob API
  version: 1.0.0
servers:
- url: https://api.sarvam.ai
  description: Production
tags:
- name: speechToTextJob
paths:
  /speech-to-text/job/v1:
    post:
      operationId: initialise
      summary: Initiate Speech to Text Bulk Job V1
      description: Create a new speech to text bulk job and receive a job UUID and storage folder details for processing multiple audio files. Set `job_parameters.input_audio_codec` when uploads are raw PCM (`pcm_s16le`, `pcm_l16`, or `pcm_raw`); the API auto-detects other formats. PCM must be 16 kHz.
      tags:
      - speechToTextJob
      parameters:
      - name: api-subscription-key
        in: header
        required: true
        schema:
          type: string
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkJobInitResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '429':
          description: Quota Exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '503':
          description: Service Overloaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkJobInitRequestV1_SpeechToTextJobParameters_'
  /speech-to-text/job/v1/upload-files:
    post:
      operationId: get-upload-links
      summary: Upload Files for Speech to Text Bulk Job V1
      description: Generate presigned upload URLs for audio files that will be processed in a speech to text bulk job
      tags:
      - speechToTextJob
      parameters:
      - name: api-subscription-key
        in: header
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilesUploadResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '429':
          description: Quota Exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '503':
          description: Service Overloaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FilesRequest'
  /speech-to-text/job/v1/{job_id}/start:
    post:
      operationId: start
      summary: Start Speech to Text Bulk Job V1
      description: Start processing a speech to text bulk job after all audio files have been uploaded
      tags:
      - speechToTextJob
      parameters:
      - name: job_id
        in: path
        description: The unique identifier of the job
        required: true
        schema:
          type: string
      - name: ptu_id
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
      - name: api-subscription-key
        in: header
        required: true
        schema:
          type: string
      - name: api-subscription-key
        in: header
        description: 'Your unique subscription key for authenticating requests to the Sarvam AI Speech-to-Text API.

          [Here are the steps to get your api key](https://docs.sarvam.ai/api-reference-docs/authentication#obtaining-your-api-subscription-key)'
        required: false
        schema:
          type: string
          default: ''
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobStatusResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '429':
          description: Quota Exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '503':
          description: Service Overloaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /speech-to-text/job/v1/{job_id}/status:
    get:
      operationId: get-status
      summary: Get Speech to Text Bulk Job V1 Status
      description: 'Retrieve the current status and details of a speech to text bulk job, including progress and file-level information.


        **Rate Limiting Best Practice:** To prevent rate limit errors and ensure optimal server performance, we recommend implementing a minimum 5-millisecond delay between consecutive status polling requests. This helps maintain system stability while still providing timely status updates.'
      tags:
      - speechToTextJob
      parameters:
      - name: job_id
        in: path
        description: The unique identifier of the job
        required: true
        schema:
          type: string
      - name: api-subscription-key
        in: header
        required: true
        schema:
          type: string
      - name: api-subscription-key
        in: header
        description: 'Your unique subscription key for authenticating requests to the Sarvam AI Speech-to-Text API.

          [Here are the steps to get your api key](https://docs.sarvam.ai/api-reference-docs/authentication#obtaining-your-api-subscription-key)'
        required: false
        schema:
          type: string
          default: ''
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobStatusResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '429':
          description: Quota Exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '503':
          description: Service Overloaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /speech-to-text/job/v1/download-files:
    post:
      operationId: get-download-links
      summary: Download Files for Speech to Text Bulk Job V1
      description: 'Generate presigned download URLs for the transcription output files of a completed speech to text bulk job.


        **Required body fields:** `job_id` and `files` (array of output filenames such as `"0.json"`). Obtain filenames from the job status response (`job_details[].outputs[].file_name`) after the job reaches `Completed` or `PartiallyCompleted`.


        **Method:** POST only (GET returns 405).'
      tags:
      - speechToTextJob
      parameters:
      - name: api-subscription-key
        in: header
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilesDownloadResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '429':
          description: Quota Exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '503':
          description: Service Overloaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FilesRequest'
components:
  schemas:
    ErrorDetails:
      type: object
      properties:
        message:
          type: string
          description: Message describing the error
        code:
          $ref: '#/components/schemas/ErrorCode'
          description: Error code for the specific error that has occurred. Refer to the error code documentation for more details.
        request_id:
          type: string
          default: ''
          description: 'Unique identifier for the request. Format: date_UUID4'
      required:
      - message
      - code
      title: ErrorDetails
    Sarvam_Model_API_SpeechToTextLanguage:
      type: string
      enum:
      - unknown
      - hi-IN
      - bn-IN
      - kn-IN
      - ml-IN
      - mr-IN
      - od-IN
      - pa-IN
      - ta-IN
      - te-IN
      - en-IN
      - gu-IN
      - as-IN
      - ur-IN
      - ne-IN
      - kok-IN
      - ks-IN
      - sd-IN
      - sa-IN
      - sat-IN
      - mni-IN
      - brx-IN
      - mai-IN
      - doi-IN
      description: 'Languages supported for Speech-to-Text.


        **saarika:v2.5 supports (12 languages):** unknown, hi-IN, bn-IN, kn-IN, ml-IN, mr-IN, od-IN, pa-IN, ta-IN, te-IN, en-IN, gu-IN


        **saaras:v3 supports all 23 languages** including: as-IN, ur-IN, ne-IN, kok-IN, ks-IN, sd-IN, sa-IN, sat-IN, mni-IN, brx-IN, mai-IN, doi-IN'
      title: Sarvam_Model_API_SpeechToTextLanguage
    BaseJobParameters:
      type: object
      properties: {}
      title: BaseJobParameters
    ErrorMessage:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetails'
          description: Error details
      required:
      - error
      title: ErrorMessage
    Sarvam_Model_API_SpeechToTextModel:
      type: string
      enum:
      - saaras:v3
      - saarika:v2.5
      description: 'Model to be used for speech to text.


        - **saaras:v3** (default, recommended): State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.


        - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.'
      title: Sarvam_Model_API_SpeechToTextModel
    TaskDetail:
      type: object
      properties:
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/TaskFileDetails'
        outputs:
          type: array
          items:
            $ref: '#/components/schemas/TaskFileDetails'
        state:
          $ref: '#/components/schemas/TaskState'
        error_message:
          type:
          - string
          - 'null'
        exception_name:
          type:
          - string
          - 'null'
      title: TaskDetail
    JobState:
      type: string
      enum:
      - Accepted
      - Pending
      - Running
      - Completed
      - Failed
      title: JobState
    FilesDownloadResponse:
      type: object
      properties:
        job_id:
          type: string
        job_state:
          $ref: '#/components/schemas/JobState'
        download_urls:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FileSignedURLDetails'
        storage_container_type:
          $ref: '#/components/schemas/StorageContainerType'
      required:
      - job_id
      - job_state
      - download_urls
      - storage_container_type
      title: FilesDownloadResponse
    BulkJobCallback:
      type: object
      properties:
        url:
          type: string
          description: Webhook url to call upon job completion
        auth_token:
          type: string
          default: ''
          description: Authorization token required for the callback Url
      required:
      - url
      title: BulkJobCallback
    BulkJobInitResponse:
      type: object
      properties:
        job_id:
          type: string
          description: Job UUID.
        storage_container_type:
          $ref: '#/components/schemas/StorageContainerType'
          description: Storage Container Type
        job_parameters:
          $ref: '#/components/schemas/BaseJobParameters'
        job_state:
          $ref: '#/components/schemas/JobState'
      required:
      - job_id
      - storage_container_type
      - job_parameters
      - job_state
      title: BulkJobInitResponse
    TaskState:
      type: string
      enum:
      - Success
      - API Error
      - Internal Server Error
      title: TaskState
    BulkJobInitRequestV1_SpeechToTextJobParameters_:
      type: object
      properties:
        job_parameters:
          $ref: '#/components/schemas/SpeechToTextJobParameters'
          description: Job Parameters for the bulk job
        callback:
          oneOf:
          - $ref: '#/components/schemas/BulkJobCallback'
          - type: 'null'
          description: Parameters for callback URL
      required:
      - job_parameters
      title: BulkJobInitRequestV1_SpeechToTextJobParameters_
    StorageContainerType:
      type: string
      enum:
      - Azure
      - Local
      - Google
      - Azure_V1
      title: StorageContainerType
    FilesUploadResponse:
      type: object
      properties:
        job_id:
          type: string
        job_state:
          $ref: '#/components/schemas/JobState'
        upload_urls:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FileSignedURLDetails'
        storage_container_type:
          $ref: '#/components/schemas/StorageContainerType'
      required:
      - job_id
      - job_state
      - upload_urls
      - storage_container_type
      title: FilesUploadResponse
    TaskFileDetails:
      type: object
      properties:
        file_name:
          type: string
        file_id:
          type: string
      required:
      - file_name
      - file_id
      title: TaskFileDetails
    JobStatusResponse:
      type: object
      properties:
        job_state:
          $ref: '#/components/schemas/JobState'
          description: Job State
        created_at:
          type: string
          description: Created At
        updated_at:
          type: string
          description: Updated At
        job_id:
          type: string
          description: Job Id
        total_files:
          type: integer
          default: 0
          description: Total Files
        successful_files_count:
          type: integer
          default: 0
          description: Success Count
        failed_files_count:
          type: integer
          default: 0
          description: Failed Count
        storage_container_type:
          $ref: '#/components/schemas/StorageContainerType'
          description: Storage Container Type
        error_message:
          type: string
          default: ''
          description: Error Message
        job_details:
          type: array
          items:
            $ref: '#/components/schemas/TaskDetail'
          description: Job details at file level.
      required:
      - job_state
      - created_at
      - updated_at
      - job_id
      - storage_container_type
      title: JobStatusResponse
    FileSignedURLDetails:
      type: object
      properties:
        file_url:
          type: string
        file_metadata:
          type:
          - object
          - 'null'
          additionalProperties:
            description: Any type
      required:
      - file_url
      title: FileSignedURLDetails
    FilesRequest:
      type: object
      properties:
        job_id:
          type: string
          description: UUID of the bulk job returned from job initiation.
        files:
          type: array
          items:
            type: string
          description: 'Required. Output filenames to download (e.g. "0.json"). Get these from the job status response: job_details[].outputs[].file_name after the job completes.'
      required:
      - job_id
      - files
      description: Request body for bulk job upload/download URL generation. Both job_id and files are required for download.
      title: FilesRequest
    Sarvam_Model_API_Mode:
      type: string
      enum:
      - transcribe
      - translate
      - verbatim
      - translit
      - codemix
      description: "Mode of operation for saaras:v3 model.\n\nExample audio: 'मेरा फोन नंबर है 9840950950'\n\n- **transcribe** (default): Standard transcription in the original language with proper formatting and number normalization.\n  - Output: `मेरा फोन नंबर है 9840950950`\n\n- **translate**: Translates speech from any supported Indic language to English.\n  - Output: `My phone number is 9840950950`\n\n- **verbatim**: Exact word-for-word transcription without normalization, preserving filler words and spoken numbers as-is.\n  - Output: `मेरा फोन नंबर है नौ आठ चार zero नौ पांच zero नौ पांच zero`\n\n- **translit**: Romanization - Transliterates speech to Latin/Roman script only.\n  - Output: `mera phone number hai 9840950950`\n\n- **codemix**: Code-mixed text with English words in English and Indic words in native script.\n  - Output: `मेरा phone number है 9840950950`"
      title: Sarvam_Model_API_Mode
    Sarvam_Model_API_InputAudioCodec:
      type: string
      enum:
      - wav
      - x-wav
      - wave
      - mp3
      - mpeg
      - mpeg3
      - x-mp3
      - x-mpeg-3
      - aac
      - x-aac
      - aiff
      - x-aiff
      - ogg
      - opus
      - flac
      - x-flac
      - mp4
      - x-m4a
      - amr
      - x-ms-wma
      - webm
      - pcm_s16le
      - pcm_l16
      - pcm_raw
      description: Audio codec/format of the input file. Our API automatically detects all codec formats, but for PCM files specifically (pcm_s16le, pcm_l16, pcm_raw), you must pass this parameter. PCM files are supported only at 16kHz sample rate.
      title: Sarvam_Model_API_InputAudioCodec
    ErrorCode:
      type: string
      enum:
      - invalid_request_error
      - internal_server_error
      - unprocessable_entity_error
      - insufficient_quota_error
      - invalid_api_key_error
      - authentication_error
      - rate_limit_exceeded_error
      - not_found_error
      title: ErrorCode
    SpeechToTextJobParameters:
      type: object
      properties:
        language_code:
          oneOf:
          - $ref: '#/components/schemas/Sarvam_Model_API_SpeechToTextLanguage'
          - type: 'null'
          default: unknown
          description: 'Specifies the language of the input audio in BCP-47 format.


            **Available Options:**

            - `unknown` (default): Use when the language is not known; the API will auto-detect.

            - `hi-IN`: Hindi

            - `bn-IN`: Bengali

            - `kn-IN`: Kannada

            - `ml-IN`: Malayalam

            - `mr-IN`: Marathi

            - `od-IN`: Odia

            - `pa-IN`: Punjabi

            - `ta-IN`: Tamil

            - `te-IN`: Telugu

            - `en-IN`: English

            - `gu-IN`: Gujarati


            **Additional Options (saaras:v3 only):**

            - `as-IN`: Assamese

            - `ur-IN`: Urdu

            - `ne-IN`: Nepali

            - `kok-IN`: Konkani

            - `ks-IN`: Kashmiri

            - `sd-IN`: Sindhi

            - `sa-IN`: Sanskrit

            - `sat-IN`: Santali

            - `mni-IN`: Manipuri

            - `brx-IN`: Bodo

            - `mai-IN`: Maithili

            - `doi-IN`: Dogri'
        model:
          $ref: '#/components/schemas/Sarvam_Model_API_SpeechToTextModel'
          description: 'Model to be used for speech to text.


            - **saaras:v3** (default, recommended): State-of-the-art model with flexible output formats. Supports multiple modes via the `mode` parameter: transcribe, translate, verbatim, translit, codemix.


            - **saarika:v2.5** (legacy): Transcribes audio in the spoken language. Kept for backward compatibility.'
        mode:
          oneOf:
          - $ref: '#/components/schemas/Sarvam_Model_API_Mode'
          - type: 'null'
          default: transcribe
          description: "Mode of operation. **Only applicable when using saaras:v3 model.**\n\nExample audio: 'मेरा फोन नंबर है 9840950950'\n\n- **transcribe** (default): Standard transcription in the original language with proper formatting and number normalization.\n  - Output: `मेरा फोन नंबर है 9840950950`\n\n- **translate**: Translates speech from any supported Indic language to English.\n  - Output: `My phone number is 9840950950`\n\n- **verbatim**: Exact word-for-word transcription without normalization, preserving filler words and spoken numbers as-is.\n  - Output: `मेरा फोन नंबर है नौ आठ चार zero नौ पांच zero नौ पांच zero`\n\n- **translit**: Romanization - Transliterates speech to Latin/Roman script only.\n  - Output: `mera phone number hai 9840950950`\n\n- **codemix**: Code-mixed text with English words in English and Indic words in native script.\n  - Output: `मेरा phone number है 9840950950`"
        with_timestamps:
          type: boolean
          default: false
          description: Whether to include timestamps in the response
        with_diarization:
          type: boolean
          default: false
          description: Enables speaker diarization, which identifies and separates different speakers in the audio. In beta mode
        num_speakers:
          type:
          - integer
          - 'null'
          description: Number of speakers to be detected in the audio. This is used when with_diarization is true.
        input_audio_codec:
          $ref: '#/components/schemas/Sarvam_Model_API_InputAudioCodec'
          description: Audio codec/format of uploaded files. The API automatically detects most formats; for PCM files (pcm_s16le, pcm_l16, pcm_raw), you must specify this parameter. PCM files are supported only at 16kHz sample rate.
      title: SpeechToTextJobParameters
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api-subscription-key
    HTTPBearer:
      type: http
      scheme: bearer