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

# Finish consultation

> Finishes the consultation and starts audio processing. The specialty can be specified to determine the report template.



## OpenAPI

````yaml docs/en/openapi.yaml post /consultations/v2/{DAAI_CONSULTATION_ID}/recordings/{DAAI_RECORDING_ID}/finish
openapi: 3.1.0
info:
  title: DAAI - APIS
  version: 1.0.0
servers:
  - url: https://apim.doctorassistant.ai/api/sandbox
security:
  - ApiKeyAuth: []
tags:
  - name: Consultations
  - name: Exams
  - name: Summaries
paths:
  /consultations/v2/{DAAI_CONSULTATION_ID}/recordings/{DAAI_RECORDING_ID}/finish:
    post:
      tags:
        - Consultations
      summary: Finish consultation
      description: >-
        Finishes the consultation and starts audio processing. The specialty can
        be specified to determine the report template.
      parameters:
        - name: DAAI_CONSULTATION_ID
          in: path
          schema:
            type: string
          required: true
        - name: DAAI_RECORDING_ID
          in: path
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                specialty:
                  type: string
                  description: >-
                    Consultation specialty. If not provided, will be considered
                    as 'generic'
                  default: generic
                  example: generic
                reportSchema:
                  type: object
                  description: >
                    Report schema. If not provided, will be considered the
                    default schema of the specialty or the globally configured
                    one.


                    - The `schema` field must be a **valid JSON Schema**,
                    according to the [official
                    specification](https://json-schema.org/specification). This
                    ensures that the generated report follows the expected
                    structure.

                    - The `fewShots` field must contain examples that **satisfy
                    the defined schema**.


                    > **Tip:** You can test and validate the custom report
                    configuration directly in the backoffice, in the
                    transformation tab in the application settings. This way,
                    you can experiment with different schemas and examples
                    before applying them in production.
                  properties:
                    instructions:
                      type: string
                      description: Instructions for report generation
                      example: >-
                        The report should be written in Brazilian Portuguese and
                        should contain patient information, consultation details
                        and diagnosis.
                    schema:
                      type: object
                      description: JSON Schema of the report content
                      properties:
                        type:
                          type: string
                          example: object
                        required:
                          type: array
                          items:
                            type: string
                        properties:
                          type: object
                          additionalProperties: true
                        additionalProperties:
                          type: boolean
                      required:
                        - type
                        - required
                        - properties
                        - additionalProperties
                    fewShots:
                      type: string
                      description: Examples of report filling in JSON string format
                      example: '[{"foo":1,"bar":"test"},{"foo":2,"bar":"test2"}]'
                  required:
                    - instructions
                    - schema
      responses:
        '201':
          description: Consultation finished successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Consultation ID
                    example: s0q0ud3fi1d9kcwjrt8vs50n
                  transcription:
                    type: string
                    description: Consultation transcription
                    example: ''
                  recording:
                    type: object
                    description: Recording information
                    example: {}
                  report:
                    type: object
                    description: Consultation report
                    properties:
                      specialty:
                        type: string
                        description: Consultation specialty
                        example: generic
                      content:
                        type: object
                        description: Report content
                        example: {}
                  metadata:
                    type: object
                    description: Consultation metadata
                    example: {}
                required:
                  - id
                  - transcription
                  - recording
                  - report
                  - metadata
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Unauthorized
                  statusCode:
                    type: integer
                    example: 401
                required:
                  - message
                  - statusCode
        '404':
          description: Consultation not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Consultation not found
                  error:
                    type: string
                    description: Error type
                    example: Not Found
                  statusCode:
                    type: integer
                    description: HTTP status code
                    example: 404
                required:
                  - message
                  - error
                  - statusCode
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: array
                    description: List of validation error messages
                    items:
                      type: string
                    example:
                      - specialty must be a string
                  error:
                    type: string
                    description: Error type
                    example: Unprocessable Entity
                  statusCode:
                    type: integer
                    description: HTTP status code
                    example: 422
                required:
                  - message
                  - error
                  - statusCode
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-daai-api-key
      description: API key for authentication

````