> ## Documentation Index
> Fetch the complete documentation index at: https://docs.miraiminds.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a transcription

> Upload a recording (up to 45 MB, up to two hours, any common audio format) and get a job back straight away with `202`. Then read it with [Get a transcription](/api-reference/transcriptions/get-a-transcription) until `status` is `completed` or `failed`.

Pick the file in the `file` field before you send. `context` and `vocabulary` are optional but help a lot with names and brand terms.

Prefer to send a link? Switch the body to raw JSON with an `https` `url` (up to 200 MB) instead of `file`; every other field is the same.

The `Idempotency-Key` makes a retry safe: the same key returns the job it already created, with no second charge.



## OpenAPI

````yaml /api-reference/openapi.json post /v2/transcriptions
openapi: 3.1.0
info:
  title: Mirai Voice API
  version: 2026-10-15.analysis-templates
  description: >-
    The v2 API for voice agents, calls, campaigns, phone numbers and speech.
    Every request carries `Authorization: Bearer sk_live_…`. Generated from the
    API's own contract and its Postman collection.
servers:
  - url: https://sandbox.voice.miraiminds.co
    description: 'Sandbox: trial workspaces, before your company goes live'
  - url: https://prod.voice.miraiminds.co
    description: 'Production: workspaces that have gone live'
security:
  - bearerAuth: []
tags:
  - name: Agents
    description: >-
      An agent is what a call runs: its prompt (or a node flow, see the Flows
      section), voice, language and limits. Write it once and dial it as often
      as you like; each call fills in its own `variables`.


      Every save creates a new revision. You can read old revisions, roll back
      to one, and publish a draft when it is ready. None of the requests here
      place a call or charge your wallet.
  - name: Calls
    description: >-
      Place a call, follow it while it runs, then read what happened: the
      transcript, the recording, the post-call analysis.


      `POST /v2/calls` answers before the phone rings, with an id. Everything
      after that is about that id. Live control and the live event stream work
      on browser calls (`channel: "web"`) and realtime sessions only; a phone
      call answers them with `400 unsupported_channel`.
  - name: Flows
    description: >-
      A node-based agent runs the call as a graph of steps. Each node has its
      own instructions, and the agent moves to the next node when a transition's
      condition is met, so a call with branches (wrong person, not now,
      reschedule) stays easy to follow and to change.


      The usual path: draft a graph from a brief or from recordings of your real
      calls, check it, test it with simulated calls, then save it on an agent.
      Drafting, transcribing and testing use AI models and charge your wallet;
      checking, saving and reading are free.


      Full guide: https://docs.miraiminds.co/v2/node-agents
  - name: Tools and secrets
    description: >-
      Connect your own APIs to an agent. A tool runs at one of three moments:


      * `pre_call`, before dialling: fetch context for the greeting, or skip the
      call.

      * `on_call`, when the agent decides to use it mid-conversation: look
      something up, book something.

      * `post_call`, after the call has settled: send the outcome to your CRM,
      schedule a call back.


      The order here is the order you'd use them in: see what's available, store
      your credential as a secret, add a tool, test it against your endpoint,
      then read each call's tool runs. Tools themselves cost nothing extra.


      Tool definitions use Mirai's own templates, like `{{ args.date }}` and `{{
      secrets.crm_key }}`.


      A definition that doesn't validate comes back as a list, so you can fix
      everything at once: `{"error": "invalid_tools", "details": [{"path",
      "message"}]}`. Everything else uses the usual `{"error": {"code",
      "message"}}`.
  - name: Campaigns
    description: >-
      Call a whole list with one agent. Upload contacts, say which days and
      hours the campaign may ring, and start it. From then on it dials by
      itself: it paces itself, waits overnight, retries calls that didn't
      connect, skips numbers on your do-not-call list, and pauses itself when
      its budget or your wallet runs out.


      Campaign calls are ordinary calls. They show up in `GET /v2/calls`, send
      the same `call.*` webhooks and bill the same per-minute rate. In a sandbox
      workspace every campaign runs and bills at T5 (₹5 a minute), whatever tier
      you ask for.


      Money on a campaign is in **paise**: `"budget_paise": 50000` is ₹500.


      The requests run top to bottom: create saves `campaign_id`, and the rest
      use it. Starting a campaign rings every contact on it, so put numbers
      you're allowed to call in the bodies first.
  - name: Do-not-call list
    description: >-
      Numbers your campaigns will never dial. The list covers every campaign in
      the workspace, including ones that are already running: it's checked at
      the moment a contact is about to be called, so a number added mid-campaign
      is skipped from then on. A skipped contact stays in its campaign as
      `suppressed` and costs nothing.


      It doesn't apply to single calls placed with `POST /v2/calls`; check the
      list yourself before those if you need to. It's your own list, not the
      national DND register, and adding a number here doesn't meet your DND
      obligations.
  - name: Phone numbers
    description: >-
      The numbers your agents answer. Each one comes from the **Telephony**
      section:


      * **Rented from Mirai.** Once the rental is active, the number shows up
      here by itself (`ownership: managed`).

      * **From your own Plivo account.** Connect the account in Telephony, list
      its numbers, then bring one here with [Import a Plivo
      number](/api-reference/phone-numbers/import-a-plivo-number) (`ownership:
      customer`). Plivo keeps billing you for it.


      After that it's two steps, in this order: [Assign an
      agent](/api-reference/phone-numbers/assign-an-agent) (who answers), then
      [Turn on incoming
      calls](/api-reference/phone-numbers/turn-on-incoming-calls). `state` is
      `imported` until calls are on and `ready` after; `error` means the last
      attempt to turn calls on failed, and `setup_error` says why.


      Every change sends the number's current `version`, and each change raises
      it by one. If you're not sure what it is, read the number first; a stale
      version is a 409 `conflict` and changes nothing.


      To call out from one of your numbers, place a call with `phone_number_id`
      set to its id once it is `ready` (Indian destinations only). Calls on your
      numbers are billed like any other call.


      Every number also says how it is doing in `health`: `state` is `active`,
      `warming` (its first week, at half its pool's pace), `resting`, `cooling`
      (rested three times in a day; waits for you) or `retired`, with this
      hour's attempts and seven days of answers. You can rest, resume and retire
      your own numbers; a resting or retired number still answers calls to it.
  - name: Phone pools
    description: >-
      A pool is a group of your own phone numbers that a campaign, an agent or a
      single call can ring from. Each call takes the number best placed for it:
      a number a contact has already been rung from stays theirs on a retry,
      numbers in the contact's own circle come first, and the pool's pace
      (`max_per_hour`, per number) is held across every campaign and API call at
      once. A number whose answers drop well below its pool-mates' rests on its
      own for 45 minutes.


      Point a campaign at a pool with `pool_id` on [Create a
      campaign](/api-reference/campaigns/create-a-campaign), an agent with
      `calls_from: {"pool_id": …}`, or one call with `pool_id` on [Place a
      call](/api-reference/calls/place-a-call). `pool_id` and `phone_number_id`
      never go together. With nothing chosen, calls come from the agent's
      setting, then the pool marked `default_for_campaigns`, then the Mirai
      shared line. A call's `calls_from_source` is `pool` (with `pool_id`) when
      a pool picked its number.


      A single call on a pool whose numbers are all resting or at their pace
      this hour answers 409 `pool_busy` with `Retry-After`; one with no number
      that can call, 409 `pool_unavailable`. A campaign doesn't fail: it waits
      and carries on.


      `purpose` is what the calls are for: `outreach` (promotional),
      `reminders`, `support` or `other`. It sets the starting pace: 40 an hour
      for support, 60 otherwise. Pools are free; numbers are billed as numbers.
  - name: Telephony
    description: >-
      Getting a phone number for your agent. There are two ways, and a workspace
      can use both.


      **1. Rent a number from Mirai.** ₹500 a month, paid as ₹1,500 from your
      wallet every three months, renewing until you turn it off. Indian numbers
      need a business verification that Plivo approves once: read the
      requirements, submit your details and documents, then refresh until it's
      `accepted`. After that: search, quote, rent. The rented number appears in
      **Phone numbers** by itself.


      **2. Connect your own Plivo account.** Plivo keeps billing you directly.
      Connect it with your Auth ID and Auth Token, list the numbers it owns, and
      bring one over with [Import a Plivo
      number](/api-reference/phone-numbers/import-a-plivo-number). A Plivo main
      account can also rent new numbers through the same search → quote → rent
      requests, with its connection id as `account`.


      Either way you finish in **Phone numbers**: assign the agent that answers,
      then turn on incoming calls.


      The last two requests verify your own phone, so the workspace can ring it
      from Mirai's shared test number (test calls are placed from the Numbers
      page in the console).


      Indian (+91) numbers only for now. If phone numbers aren't available on
      the host you're calling, every request here answers 503
      `telephony_unavailable`.
  - name: Transcriptions
    description: >-
      Turn a recorded call (or any recording) into a transcript with speakers
      and timestamps. Hindi, English, Gujarati and mixed speech are written the
      way they were spoken, never translated. ₹18 per hour of audio; failed and
      degraded jobs are free.
  - name: Speech to text
    description: >-
      Speech to text in ten languages, two ways: send one recording and get its
      text back in the same request ([Transcribe a
      recording](/api-reference/speech-to-text/transcribe-a-recording)), or
      stream live audio over one WebSocket per call and read partial transcripts
      while people speak, then one final transcript per utterance. Language
      codes: hi-IN, en-IN, gu-IN, mr-IN, pa-IN, bn-IN, ta-IN, te-IN, kn-IN or
      ml-IN.


      `wss://sandbox.voice.miraiminds.co/v1/audio/transcriptions/stream?language_code=hi-IN&encoding=mulaw&sample_rate=8000&endpointing=manual`


      (`wss://prod.voice.miraiminds.co` once your company has gone live), with
      the header `Authorization: Bearer sk_live_YOUR_API_KEY`. 8 or 16 kHz,
      16-bit PCM, μ-law or A-law. A browser uses `?token=` from [Mint stream
      tokens](/api-reference/speech-to-text/mint-stream-tokens) instead, because
      it cannot set headers on a WebSocket.


      Send JSON text frames: `{"event": "speech_start"}`, then `{"event":
      "audio_input", "audio": "<base64 audio>"}` as the audio arrives, then
      `{"event": "speech_end"}`; `{"event": "end"}` closes the session. You
      receive `session.begin` first, `transcript.partial` while an utterance is
      open, exactly one `transcript.final` per utterance, and `session.end` with
      `audio_seconds_billed` and `cost_paise`.


      Every event, both endpointing modes, limits and errors:
      https://docs.miraiminds.co/v2/stt-quickstart
  - name: Text to speech
    description: >-
      Turn text into speech in one request, and read back what each request
      cost.
  - name: Wallet
    description: >-
      Your prepaid balance and every line that moved it. Calls, text to speech,
      flow drafts, transcriptions and number rentals all debit the same wallet.
  - name: Reference
    description: The voice catalogue, and the API contract as a machine-readable document.
paths:
  /v2/transcriptions:
    post:
      tags:
        - Transcriptions
      summary: Create a transcription
      description: >-
        Upload a recording (up to 45 MB, up to two hours, any common audio
        format) and get a job back straight away with `202`. Then read it with
        [Get a transcription](/api-reference/transcriptions/get-a-transcription)
        until `status` is `completed` or `failed`.


        Pick the file in the `file` field before you send. `context` and
        `vocabulary` are optional but help a lot with names and brand terms.


        Prefer to send a link? Switch the body to raw JSON with an `https` `url`
        (up to 200 MB) instead of `file`; every other field is the same.


        The `Idempotency-Key` makes a retry safe: the same key returns the job
        it already created, with no second charge.
      operationId: create_transcription
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Up to 255 characters. The same key within 24 hours replays the first
            answer and creates nothing new. Build it from your own record, such
            as `order-8842-reminder-1`.
          schema:
            maxLength: 255
            type: string
          example: order-8842-reminder-1
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: The recording. One file per request.
                context:
                  type: string
                  example: >-
                    A call to a university admissions desk about a course and
                    its fees
                  description: Who is calling whom and why. Up to 2,000 characters.
                vocabulary:
                  type: string
                  example: Mira University, BBA, Aadhaar
                  description: Names and terms to spell right, comma or newline separated.
                language:
                  type: string
                  description: auto (default), hi, gu, en, mr, pa, bn or ur.
                diarize:
                  type: string
                  description: Speaker separation. Default true.
                words:
                  type: string
                  description: Word timings on each segment. Default false.
              required:
                - file
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transcription'
              examples:
                Accepted:
                  summary: 202 — accepted
                  value:
                    id: trn_01M3XRSFXW77RHEQ85979AJXAF
                    object: transcription
                    status: queued
                    created_at: '2026-10-02T07:38:20Z'
                    finished_at: null
                    duration_s: null
                    degraded: null
                    model: null
                    source: upload
                    file_name: call.wav
                    bytes: 370308
                    language: null
                    diarize: true
                    words: false
                    error: null
                    cost:
                      status: pending
                      amount_inr: null
                      rate_inr_per_hour: 18
        '402':
          description: The wallet is empty
          content:
            application/json:
              examples:
                The wallet is empty:
                  summary: 402 — the wallet is empty
                  value:
                    error:
                      code: insufficient_balance
                      message: >-
                        wallet balance 0.00 INR is empty; transcribing a
                        recording needs a positive balance
        '429':
          description: 20 jobs already running
          content:
            application/json:
              examples:
                20 jobs already running:
                  summary: 429 — 20 jobs already running
                  value:
                    error:
                      code: at_capacity
                      message: >-
                        this workspace already has 20 transcriptions in progress
                        (the limit is 20); retry when one finishes
components:
  schemas:
    Transcription:
      description: >-
        An offline transcription job. Lists carry the job without text,
        segments, draft or diarization; GET /v2/transcriptions/{id} adds them.
      properties:
        bytes:
          minimum: 0
          type: integer
        cost:
          description: >-
            Billing: pending until the job finishes; then charged once (₹18 per
            hour of audio, rounded up to a paisa) or free (degraded or failed).
            amount_inr is the job's charge at the rate frozen when it was
            accepted; the wallet transaction (kind transcription, reference =
            the job id) records what the balance moved.
          properties:
            amount_inr:
              minimum: 0
              type:
                - number
                - 'null'
            rate_inr_per_hour:
              type: number
            status:
              enum:
                - pending
                - charged
                - free
              type: string
          required:
            - status
            - amount_inr
            - rate_inr_per_hour
          type: object
        created_at:
          format: date-time
          type: string
        degraded:
          description: >-
            Once completed: true when the merge step was unavailable, so text is
            a single decoding pass without speaker roles; a degraded job is
            free. null until completed.
          type:
            - boolean
            - 'null'
        diarization:
          description: Completed jobs, GET by id only.
          properties:
            applied:
              type: boolean
            enabled:
              type: boolean
            non_speech:
              description: >-
                Parts of the recording that were not speech, such as ringing or
                a caller tune, and were left out of the transcript. Absent when
                nothing was left out.
              items:
                properties:
                  end:
                    minimum: 0
                    type: number
                  start:
                    description: Seconds from the start of the recording.
                    minimum: 0
                    type: number
                required:
                  - start
                  - end
                type: object
              type: array
            speakers:
              description: >-
                One entry per voice, in speaker_id order (spk0 first): the agent
                is spk0 and the customer spk1 on a call between them.
              items:
                properties:
                  id:
                    description: The speaker_id its segments carry.
                    type: string
                  role:
                    description: Agent, Customer or Other.
                    type: string
                  talk_s:
                    description: Seconds this voice talked.
                    type: number
                type: object
              type: array
            words:
              properties:
                applied:
                  type: boolean
              type: object
          type: object
        diarize:
          type: boolean
        draft:
          description: >-
            While merging, GET by id only: the strongest single decoding pass,
            readable seconds after decoding and before the merge finishes.
            Speaker is empty. Replaced by segments once completed.
          items:
            $ref: '#/components/schemas/TranscriptionSegment'
          type: array
        duration_s:
          description: The recording's length in seconds, known once decoding has started.
          minimum: 0
          type:
            - number
            - 'null'
        error:
          description: >-
            Why a failed job failed. transcription_failed and audio_too_long are
            the recording's fault (not audio, damaged, empty, or too long);
            every other code is a fault on our side, and the same recording can
            be submitted again. A failed job is free.
          properties:
            code:
              enum:
                - transcription_failed
                - audio_too_long
                - upstream_unavailable
                - engine_restarted
                - job_lost
                - timed_out
                - submit_interrupted
              type: string
            message:
              type: string
          type:
            - object
            - 'null'
        file_name:
          type: string
        finished_at:
          format: date-time
          type:
            - string
            - 'null'
        id:
          description: >-
            The job id; also the reference of its wallet transaction (kind
            transcription).
          pattern: ^trn_[0-9A-Z]{26}$
          type: string
        language:
          description: The language you forced, or null for automatic detection.
          type:
            - string
            - 'null'
        model:
          description: >-
            The model that produced the transcript, once completed
            (mira-transcribe-offline-1).
          type:
            - string
            - 'null'
        object:
          const: transcription
        segments:
          description: Completed jobs, GET by id only.
          items:
            $ref: '#/components/schemas/TranscriptionSegment'
          type: array
        source:
          enum:
            - upload
            - url
          type: string
        status:
          description: >-
            queued → decoding → merging → completed | failed; there is no
            progress figure. A job typically completes in about 10 seconds plus
            15% of the recording's length; diarization adds about a second.
          enum:
            - queued
            - decoding
            - merging
            - completed
            - failed
          type: string
        text:
          description: The whole transcript; completed jobs, GET by id only.
          type: string
        words:
          type: boolean
      required:
        - id
        - object
        - status
        - created_at
        - finished_at
        - duration_s
        - degraded
        - model
        - source
        - file_name
        - bytes
        - language
        - diarize
        - words
        - error
        - cost
      type: object
    TranscriptionSegment:
      properties:
        end:
          minimum: 0
          type: number
        speaker:
          description: >-
            The party: Agent, Customer or Other; empty when it could not be told
            (a degraded job, or the draft).
          type: string
        speaker_id:
          description: >-
            The voice, per recording (spk0, spk1, …). Agent voices are numbered
            first, then Customer voices, then any others, each in order of first
            appearance, so on a call between an agent and a customer the agent
            is spk0 and the customer spk1. Present when diarization was applied.
          type: string
        start:
          description: Seconds from the start of the recording.
          minimum: 0
          type: number
        text:
          type: string
        words:
          description: Present when words was requested and the call aligned.
          items:
            properties:
              end:
                type: number
              start:
                type: number
              w:
                type: string
            required:
              - w
              - start
              - end
            type: object
          type: array
      required:
        - speaker
        - start
        - end
        - text
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your workspace secret key, `sk_live_` followed by 32 hex characters.
        Create one in the console under **Developers**.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.