> ## 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.

# Process Template

> After a session ends, generate another document from it for the given template. Every template processed — via Create Session `templates` or this API — creates a document, listed in the session's documents. The call is asynchronous: it returns `202` with a new `document_id`; fetch it with Get Session `?document_id=...` or Get Document once its status is `success`.


After a session ends, generate another document from it for any `template_id`. Returns `202` with a new `document_id`.

<Info>
  **Every template processed creates a document** — whether passed in [Create Session](/ekascribe/api-reference/sessions/create-session) `templates` or via this API. All of them appear in [List Session Documents](/ekascribe/api-reference/documents/list-session-documents), and each can be fetched with [Get Session](/ekascribe/api-reference/sessions/get-session) `?document_id=<id>` or [Get Document](/ekascribe/api-reference/documents/get-document).
</Info>


## OpenAPI

````yaml POST /voice/v1/sessions/{session_id}/process/template/{template_id}
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/v1/sessions/{session_id}/process/template/{template_id}:
    post:
      tags:
        - sessions
      summary: Process Template
      description: >
        After a session ends, generate another document from it for the given
        template. Every template processed — via Create Session `templates` or
        this API — creates a document, listed in the session's documents. The
        call is asynchronous: it returns `202` with a new `document_id`; fetch
        it with Get Session `?document_id=...` or Get Document once its status
        is `success`.
      parameters:
        - name: session_id
          in: path
          required: true
          description: Session ID returned by Create Session
          schema:
            type: string
            example: ses_abc123def456
        - name: template_id
          in: path
          required: true
          description: Template ID to generate notes with (from List Templates)
          schema:
            type: string
            example: clinical_notes_template
      responses:
        '202':
          description: Note generation started
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProcessTemplateResponse'
              example:
                session_id: ses_abc123def456
                template_id: clinical_notes_template
                document_id: doc_9f8e7d6c
                status: in-progress
                message: Template generation in progress
        '404':
          description: Session not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - auth: []
components:
  schemas:
    ProcessTemplateResponse:
      type: object
      properties:
        session_id:
          type: string
        template_id:
          type: string
        document_id:
          type: string
          nullable: true
          description: >-
            ID of the document being generated. Poll Get Document until its
            status is `success`.
        status:
          type: string
          example: in-progress
        message:
          type: string
          example: Template generation in progress
    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.

````