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

# Upload Transcript

> **Optional.** Use this only if you already have the transcript and do not want EkaScribe to transcribe audio for you. Instead of uploading audio files, create a session, POST your transcript here along with the `template_id` you want it structured into, then poll Get Session for the structured result.

The call is asynchronous: it returns `202` with a `document_id` and `status: in-progress`. Fetch the structured note with `GET /voice/v1/sessions/{session_id}` (optionally `?document_id=<document_id>`) or Get Document once its status is `success`.

You may also omit `template_id` and send `target_language` instead to translate the transcript (or the session's stored transcript) into another language.


**This API is optional.** Use it only when you already have the transcript and don't need EkaScribe to transcribe audio for you. Instead of uploading audio, you post the transcript text plus the `template_id` you want it structured into, and EkaScribe returns the structured note.

The flow is three calls — no audio upload, no [End Session](/ekascribe/api-reference/sessions/end-session):

```
1. Create Session     POST /voice/v1/sessions                                     → session_id
2. Upload Transcript  POST /voice/api/v1/transaction/{session_id}/convert-to-template
                      { "transcript": "...", "template_id": "..." }               → 202, document_id
3. Get Session        GET  /voice/v1/sessions/{session_id}                        (poll ~1s until ≠202)
                      → structured note for that template
```

```bash theme={null}
curl -X POST "https://api.eka.care/voice/api/v1/transaction/{session_id}/convert-to-template" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "transcript": "Doctor: What brings you in today?\nPatient: I have had a dry cough and mild fever for three days.",
    "template_id": "clinical_notes_template"
  }'
```

<Info>
  The call is asynchronous — it returns `202` with a `document_id`. Poll [Get Session](/ekascribe/api-reference/sessions/get-session) (optionally `?document_id=<id>`) or [Get Document](/ekascribe/api-reference/documents/get-document) until the document's status is `success`.
</Info>

<Note>
  If you omit `template_id`, the template requested in [Create Session](/ekascribe/api-reference/sessions/create-session) (`templates`) is used. To structure the same transcript into more templates later, call [Process Template](/ekascribe/api-reference/sessions/process-template) — each one creates its own document.
</Note>

Sending `target_language` instead of `template_id` translates the transcript into that language (`eng`, `hi`, `ta`, `te`, `bn`, `mr`, `gu`, `kn`, `ml`, `pa`, `as`) rather than structuring it into a template.


## OpenAPI

````yaml POST /voice/api/v1/transaction/{session_id}/convert-to-template
openapi: 3.0.1
info:
  title: EkaScribe Protocol API (MedScribeAlliance v0.1)
  version: '0.1'
  description: >
    Session-based medical voice capture API implementing the MedScribeAlliance
    Protocol v0.1. Discover service capabilities, create a session, stream audio
    chunks, then end the session to trigger asynchronous transcription and
    structured-template extraction.
servers:
  - url: https://api.eka.care
    description: Production server
  - url: https://api.dev.eka.care
    description: Development server
security: []
paths:
  /voice/api/v1/transaction/{session_id}/convert-to-template:
    post:
      tags:
        - sessions
      summary: Upload Transcript
      description: >
        **Optional.** Use this only if you already have the transcript and do
        not want EkaScribe to transcribe audio for you. Instead of uploading
        audio files, create a session, POST your transcript here along with the
        `template_id` you want it structured into, then poll Get Session for the
        structured result.


        The call is asynchronous: it returns `202` with a `document_id` and
        `status: in-progress`. Fetch the structured note with `GET
        /voice/v1/sessions/{session_id}` (optionally
        `?document_id=<document_id>`) or Get Document once its status is
        `success`.


        You may also omit `template_id` and send `target_language` instead to
        translate the transcript (or the session's stored transcript) into
        another language.
      parameters:
        - name: session_id
          in: path
          required: true
          description: Session ID returned by Create Session
          schema:
            type: string
            example: ses_abc123def456
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadTranscriptRequest'
            example:
              transcript: >
                Doctor: What brings you in today?

                Patient: I've had a dry cough and mild fever for the last three
                days.

                Doctor: Any breathlessness or chest pain?

                Patient: No, just the cough and I feel tired.
              template_id: clinical_notes_template
      responses:
        '202':
          description: Transcript accepted, template generation started
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadTranscriptResponse'
              example:
                status: in-progress
                message: Template generation started in background
                txn_id: ses_abc123def456
                b_id: '123456'
                template_id: clinical_notes_template
                document_id: doc_9f8e7d6c
                templates:
                  - template_id: clinical_notes_template
                    document_id: doc_9f8e7d6c
        '400':
          description: Neither `transcript` nor `target_language` was provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Session not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - auth: []
components:
  schemas:
    UploadTranscriptRequest:
      type: object
      description: >
        Send at least one of `transcript` or `target_language`. If both are
        omitted the request is rejected with `400`.
      properties:
        transcript:
          type: string
          description: >
            The plain-text transcript of the consultation. This replaces
            EkaScribe's own transcription — no audio upload is needed for the
            session.
          example: >
            Doctor: What brings you in today?

            Patient: I've had a dry cough and mild fever for the last three
            days.
        template_id:
          type: string
          description: >
            Template to structure the transcript into (from List Templates). If
            omitted, the template requested in Create Session (`templates`) is
            used.
          example: clinical_notes_template
        target_language:
          type: string
          description: >
            Translate the transcript into this language instead of structuring
            it into a template. One of `eng`, `hi`, `ta`, `te`, `bn`, `mr`,
            `gu`, `kn`, `ml`, `pa`, `as`.
          example: hi
    UploadTranscriptResponse:
      type: object
      properties:
        status:
          type: string
          example: in-progress
        message:
          type: string
          example: Template generation started in background
        txn_id:
          type: string
          description: The session ID the transcript was uploaded to.
          example: ses_abc123def456
        b_id:
          type: string
          description: Business ID resolved from your access token.
          example: '123456'
        template_id:
          type: string
          example: clinical_notes_template
        document_id:
          type: string
          description: >-
            ID of the document being generated. Poll Get Session or Get Document
            until its status is `success`.
          example: doc_9f8e7d6c
        templates:
          type: array
          description: Documents created for this request.
          items:
            type: object
            properties:
              template_id:
                type: string
              document_id:
                type: string
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code.
              example: invalid_audio_format
            message:
              type: string
              description: Human-readable error message.
              example: Audio format 'audio/mp3' is not supported
            details:
              type: object
              additionalProperties: true
              description: Additional error context.
  securitySchemes:
    auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````