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

# Definir contexto da consulta

> Define o contexto da consulta para uma sessão do paciente.



## OpenAPI

````yaml /pt-BR/scribe-api/openapi.json post /v1/set-consultation-context
openapi: 3.1.0
info:
  title: Scribe Public API
  description: >-
    API REST externa para integração com a plataforma Telepatia. Autentique-se
    com chaves de API, defina o contexto da consulta e busque sessões de scribe.
  version: 0.1.0
servers:
  - url: https://scribe-api.telepatia.ai
    description: Production
security:
  - BearerAuth: []
paths:
  /v1/set-consultation-context:
    post:
      tags:
        - Consultation
      summary: Definir contexto da consulta
      description: Define o contexto da consulta para uma sessão do paciente.
      operationId: api_consultation_context_set_post_v1_set_consultation_context_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetConsultationContextRequest'
            example:
              clinicalContext:
                allergies:
                  - code:
                      system: ATC
                      value: J01CE01
                    id: ALG-881
                    name: Penicillin
                    note: Hives and facial swelling
                conditions:
                  - code:
                      system: ICD10
                      value: I10
                    id: CD-120
                    name: Essential hypertension
                  - code:
                      system: ICD10
                      value: E11
                    id: CD-121
                    name: Type 2 diabetes mellitus
                currentEncounter:
                  chiefComplaint: Severe headache for 2 days, worse in the morning
                  class: EMERGENCY
                  diagnoses:
                    - code:
                        system: ICD10
                        value: R51
                      id: DG-9001-1
                      name: Headache
                  id: ATD-9001
                  note: >-
                    08:50 triage: alert and oriented, no focal deficit. 09:20 ER
                    physician: head CT ordered.
                  procedures:
                    - id: PX-9001-1
                      name: Head CT without contrast
                  startedAt: '2026-10-15T08:40:00-05:00'
                  triagePriority: Yellow - urgent
                  vitals:
                    diastolicBloodPressure: 102
                    heartRate: 92
                    measuredAt: '2026-10-15T08:55:00-05:00'
                    oxygenSaturation: 97
                    painScore: 8
                    respiratoryRate: 18
                    systolicBloodPressure: 168
                    temperature: 36.8
                medications:
                  - code:
                      system: ATC
                      value: C09CA01
                    id: RX-4410
                    name: Losartan 50 mg, 1 tablet daily
                  - code:
                      system: ATC
                      value: A10BA02
                    id: RX-4411
                    name: Metformin 850 mg, 1 tablet every 12 hours
                  - code:
                      system: ATC
                      value: C07AA05
                    id: RX-4412
                    name: Propranolol 40 mg, 1 tablet every 12 hours
                  - id: RX-3982
                    name: Captopril 25 mg
                    status: INACTIVE
                previousEncounters:
                  - diagnoses:
                      - code:
                          system: ICD10
                          value: G43.0
                        id: DG-7120-1
                        name: Migraine without aura
                    id: ATD-7120
                    note: >-
                      Neurology visit. Started propranolol 40 mg every 12 hours.
                      Follow-up in 3 months.
                    startedAt: '2025-05-02'
                  - class: EMERGENCY
                    diagnoses:
                      - code:
                          system: ICD10
                          value: N39.0
                        id: DG-6044-1
                        name: Urinary tract infection
                    id: ATD-6044
                    note: >-
                      Emergency room. Dysuria for 3 days, no fever.
                      Nitrofurantoin for 7 days.
                    startedAt: '2024-11-18'
              consultationInternalId: CONSULT-12345
              idCountry: COLOMBIA
              idType: PASSPORT
              idValue: A12345678
              institutionalBranchId: b1f2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d
              internalCode: MRN-000123
              medicalRecordConfigurationId: mrc_a1b2c3d4e5f6g7h8
              name: John Doe
              notes: Patient prefers morning appointments. Allergic to penicillin.
              pastMedicalHistory: >-
                Hypertension diagnosed 2020. Diabetes Type 2 controlled with
                metformin.
              scribeSessionModality: IN_PERSON
        required: true
      responses:
        '200':
          description: Resposta bem-sucedida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SetConsultationContextResponse'
              example:
                consultationInternalId: CONSULT-12345
                success: true
        '400':
          description: >-
            Requisição inválida — parâmetros inválidos, falhas de validação ou
            campos ausentes.
          content:
            application/json:
              examples:
                parameter_missing:
                  summary: Missing required field
                  value:
                    error:
                      type: invalid_request_error
                      code: parameter_missing
                      message: name is required.
                      param: name
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
                parameter_invalid:
                  summary: Invalid field value
                  value:
                    error:
                      type: invalid_request_error
                      code: parameter_invalid
                      message: >-
                        idCountry must be a valid country name, ISO alpha-2, or
                        ISO alpha-3 code.
                      param: idCountry
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
                account_invalid:
                  summary: Invalid account
                  value:
                    error:
                      type: invalid_request_error
                      code: account_invalid
                      message: Account has no valid authId.
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Não autorizado — chave de API ausente ou inválida.
          content:
            application/json:
              examples:
                authentication_required:
                  summary: Invalid or missing API key
                  value:
                    error:
                      type: authentication_error
                      code: authentication_required
                      message: Invalid API key.
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Proibido — a chave de API não pode executar esta operação.
          content:
            application/json:
              examples:
                permission_denied:
                  summary: Caller lacks permission for this resource
                  value:
                    error:
                      type: permission_error
                      code: permission_denied
                      message: You do not have permission to access this resource.
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
                permission_denied_role:
                  summary: API key's account role is not allowed this operation
                  value:
                    error:
                      type: permission_error
                      code: permission_denied
                      message: >-
                        Your API key is not allowed to create accounts. Account
                        creation requires an institutional API key; this key is
                        scoped to a doctor account.
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Não encontrado — o recurso solicitado não existe.
          content:
            application/json:
              examples:
                resource_not_found:
                  summary: Medical record configuration not found
                  value:
                    error:
                      type: invalid_request_error
                      code: resource_not_found
                      message: Medical record configuration not found.
                      param: medicalRecordConfigurationId
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Conflito — o recurso já existe ou está em estado conflitante.
          content:
            application/json:
              examples:
                resource_conflict:
                  summary: consultationInternalId already in use
                  value:
                    error:
                      type: invalid_request_error
                      code: resource_conflict
                      message: >-
                        consultationInternalId is already in use by a different
                        consultation.
                      param: consultationInternalId
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
                resource_not_active:
                  summary: Medical record configuration exists but is not active
                  value:
                    error:
                      type: invalid_request_error
                      code: resource_not_active
                      message: >-
                        Medical record configuration 'mrc_a1b2c3d4e5f6g7h8' is
                        not active yet.
                      param: medicalRecordConfigurationId
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          description: Conteúdo muito grande — o corpo excede o tamanho máximo suportado.
          content:
            application/json:
              examples:
                request_too_large:
                  summary: clinicalContext above the maximum supported size
                  value:
                    error:
                      type: invalid_request_error
                      code: request_too_large
                      message: >-
                        clinicalContext exceeds the maximum supported size
                        (1032192 bytes).
                      param: clinicalContext
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Serviço indisponível — uma dependência externa está indisponível.
          content:
            application/json:
              examples:
                service_unavailable:
                  summary: Failed to set consultation context
                  value:
                    error:
                      type: api_error
                      code: service_unavailable
                      message: >-
                        Failed to set consultation context. Please try again
                        later.
                      requestId: 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    SetConsultationContextRequest:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 500
              minLength: 1
            - type: 'null'
          title: Name
          examples:
            - John Doe
        idCountry:
          anyOf:
            - $ref: '#/components/schemas/IdCountry'
            - type: 'null'
          examples:
            - CO
        idType:
          anyOf:
            - $ref: '#/components/schemas/IdType'
            - type: 'null'
          examples:
            - CC
        idValue:
          anyOf:
            - type: string
              maxLength: 50
              minLength: 1
            - type: 'null'
          title: Idvalue
          examples:
            - '123456789'
        patientId:
          anyOf:
            - type: string
              pattern: ^sp_[a-z0-9]{16}$
            - type: 'null'
          title: Patientid
          description: >-
            Public id of an existing patient (sp_...). When provided, the
            patient's stored identity is used and the inline identity fields
            (name, idCountry, idType, idValue) must be omitted. Mutually
            exclusive with the inline identity.
          examples:
            - sp_a1b2c3d4e5f6g7h8
        internalCode:
          anyOf:
            - type: string
              maxLength: 128
              minLength: 1
            - type: 'null'
          title: Internalcode
          description: >-
            Your own patient code, unique per institution. Looks up an existing
            patient by this code; when none matches, the inline identity (name,
            idCountry, idType, idValue) creates and tags the patient at session
            start. Mutually exclusive with patientId.
          examples:
            - MRN-000123
        clinicalContext:
          anyOf:
            - $ref: '#/components/schemas/ClinicalContext'
            - type: 'null'
          description: >-
            Structured clinical data of the patient and the encounter:
            allergies, medications, conditions, the current encounter and
            previous encounters. See /scribe-api/consultations#clinical-context.
            `currentEncounter.id` is the `Encounter.id` of the visit; the scribe
            session attaches to that visit. The other fields need an API key
            that carries `scribe:write` and is bound to your institution;
            otherwise the call returns `403 permission_denied` and writes
            nothing. Field names are camelCase; an unknown field inside the
            block returns `400`. There is one current patient per doctor key, so
            the last call wins.
        notes:
          anyOf:
            - type: string
              maxLength: 10000
            - type: 'null'
          title: Notes
          examples:
            - Patient reports headache
        pastMedicalHistory:
          anyOf:
            - type: string
              maxLength: 10000
            - type: 'null'
          title: Pastmedicalhistory
          examples:
            - Hypertension, Diabetes Type 2
        consultationInternalId:
          anyOf:
            - type: string
              maxLength: 128
              pattern: ^[A-Za-z0-9_-]{1,128}$
            - type: 'null'
          title: Consultationinternalid
          examples:
            - CONSULT-12345
        scribeSessionModality:
          anyOf:
            - $ref: '#/components/schemas/ScribeSessionModality'
            - type: 'null'
          examples:
            - IN_PERSON
        institutionalBranchId:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: Institutionalbranchid
          description: >-
            Id of the institution branch for this consultation, returned by the
            create-branch endpoint. Stamped onto the scribe session at creation.
            Provide the id or the name.
          examples:
            - b1f2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d
        institutionalBranch:
          anyOf:
            - type: string
              maxLength: 256
            - type: 'null'
          title: Institutionalbranch
          description: >-
            Name of the institution branch for this consultation. Resolved when
            institutionalBranchId is not provided. Provide the id or the name.
          examples:
            - Sede Norte
        scribeSessionConfigurationId:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: Scribesessionconfigurationid
          description: >-
            Public id of a scribe session configuration (`ssc_` + 16 chars
            `[a-z0-9]`). Mutually exclusive with `medicalRecordConfigurationId`
            and `medicalRecordConfiguration`.
          examples:
            - ssc_a1b2c3d4e5f6g7h8
        medicalRecordConfigurationId:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: Medicalrecordconfigurationid
          description: >-
            Public id of a medical record configuration (`mrc_` + 16 chars
            `[a-z0-9]`). Mutually exclusive with `scribeSessionConfigurationId`
            and `medicalRecordConfiguration`.
          examples:
            - mrc_a1b2c3d4e5f6g7h8
        medicalRecordConfiguration:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Medicalrecordconfiguration
          description: >-
            Inline medical record configuration JSON keyed by section name (e.g.
            'chiefComplaint'). Auto-persisted and deduplicated by content hash;
            the resolved configuration id is attached to the doctor context
            buffer. Mutually exclusive with `medicalRecordConfigurationId` and
            `scribeSessionConfigurationId`.
      type: object
      title: SetConsultationContextRequest
      description: Corpo da requisição para definir o contexto da consulta.
      examples:
        - clinicalContext:
            allergies:
              - code:
                  system: ATC
                  value: J01CE01
                id: ALG-881
                name: Penicillin
                note: Hives and facial swelling
            conditions:
              - code:
                  system: ICD10
                  value: I10
                id: CD-120
                name: Essential hypertension
              - code:
                  system: ICD10
                  value: E11
                id: CD-121
                name: Type 2 diabetes mellitus
            currentEncounter:
              chiefComplaint: Severe headache for 2 days, worse in the morning
              class: EMERGENCY
              diagnoses:
                - code:
                    system: ICD10
                    value: R51
                  id: DG-9001-1
                  name: Headache
              id: ATD-9001
              note: >-
                08:50 triage: alert and oriented, no focal deficit. 09:20 ER
                physician: head CT ordered.
              procedures:
                - id: PX-9001-1
                  name: Head CT without contrast
              startedAt: '2026-10-15T08:40:00-05:00'
              triagePriority: Yellow - urgent
              vitals:
                diastolicBloodPressure: 102
                heartRate: 92
                measuredAt: '2026-10-15T08:55:00-05:00'
                oxygenSaturation: 97
                painScore: 8
                respiratoryRate: 18
                systolicBloodPressure: 168
                temperature: 36.8
            medications:
              - code:
                  system: ATC
                  value: C09CA01
                id: RX-4410
                name: Losartan 50 mg, 1 tablet daily
              - code:
                  system: ATC
                  value: A10BA02
                id: RX-4411
                name: Metformin 850 mg, 1 tablet every 12 hours
              - code:
                  system: ATC
                  value: C07AA05
                id: RX-4412
                name: Propranolol 40 mg, 1 tablet every 12 hours
              - id: RX-3982
                name: Captopril 25 mg
                status: INACTIVE
            previousEncounters:
              - diagnoses:
                  - code:
                      system: ICD10
                      value: G43.0
                    id: DG-7120-1
                    name: Migraine without aura
                id: ATD-7120
                note: >-
                  Neurology visit. Started propranolol 40 mg every 12 hours.
                  Follow-up in 3 months.
                startedAt: '2025-05-02'
              - class: EMERGENCY
                diagnoses:
                  - code:
                      system: ICD10
                      value: N39.0
                    id: DG-6044-1
                    name: Urinary tract infection
                id: ATD-6044
                note: >-
                  Emergency room. Dysuria for 3 days, no fever. Nitrofurantoin
                  for 7 days.
                startedAt: '2024-11-18'
          consultationInternalId: CONSULT-12345
          idCountry: COLOMBIA
          idType: PASSPORT
          idValue: A12345678
          institutionalBranchId: b1f2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d
          internalCode: MRN-000123
          medicalRecordConfigurationId: mrc_a1b2c3d4e5f6g7h8
          name: John Doe
          notes: Patient prefers morning appointments. Allergic to penicillin.
          pastMedicalHistory: >-
            Hypertension diagnosed 2020. Diabetes Type 2 controlled with
            metformin.
          scribeSessionModality: IN_PERSON
        - consultationInternalId: CONSULT-12345
          idCountry: COLOMBIA
          idType: PASSPORT
          idValue: A12345678
          medicalRecordConfiguration:
            chiefComplaint:
              instructionSet:
                telepatiaPromptId: CHIEF_COMPLAINT
              schema:
                instructions: Chief complaint
                properties:
                  chiefComplaint:
                    instructions: Patient's own words
                    type: string
                type: object
          name: John Doe
          scribeSessionModality: IN_PERSON
        - consultationInternalId: CONSULT-12345
          idCountry: COLOMBIA
          idType: PASSPORT
          idValue: A12345678
          name: John Doe
          scribeSessionConfigurationId: ssc_a1b2c3d4e5f6g7h8
          scribeSessionModality: IN_PERSON
        - consultationInternalId: CONSULT-12345
          patientId: sp_a1b2c3d4e5f6g7h8
          scribeSessionConfigurationId: ssc_a1b2c3d4e5f6g7h8
          scribeSessionModality: IN_PERSON
        - consultationInternalId: CONSULT-12345
          institutionalBranchId: b1f2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d
          internalCode: MRN-000123
          scribeSessionConfigurationId: ssc_a1b2c3d4e5f6g7h8
          scribeSessionModality: IN_PERSON
    SetConsultationContextResponse:
      properties:
        success:
          type: boolean
          title: Success
          examples:
            - true
        consultationInternalId:
          type: string
          title: Consultationinternalid
          examples:
            - CONSULT-12345
      type: object
      required:
        - success
        - consultationInternalId
      title: SetConsultationContextResponse
      description: Corpo da resposta para definição do contexto da consulta.
      examples:
        - consultationInternalId: CONSULT-12345
          success: true
    ErrorResponse:
      description: Envelope padronizado de resposta de erro.
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetailWithRequestId'
      required:
        - error
      title: ErrorResponse
      type: object
    IdCountry:
      type: string
      enum:
        - AF
        - AX
        - AL
        - DZ
        - AS
        - AD
        - AO
        - AI
        - AQ
        - AG
        - AR
        - AM
        - AW
        - AU
        - AT
        - AZ
        - BS
        - BH
        - BD
        - BB
        - BY
        - BE
        - BZ
        - BJ
        - BM
        - BT
        - BO
        - BQ
        - BA
        - BW
        - BV
        - BR
        - IO
        - BN
        - BG
        - BF
        - BI
        - KH
        - CM
        - CA
        - CV
        - KY
        - CF
        - TD
        - CL
        - CX
        - CC
        - CO
        - KM
        - CK
        - CR
        - CI
        - HR
        - CU
        - CW
        - CY
        - CZ
        - CD
        - DK
        - DJ
        - DM
        - DO
        - EC
        - EG
        - SV
        - GQ
        - ER
        - EE
        - SZ
        - ET
        - FK
        - FO
        - FJ
        - FI
        - FR
        - GF
        - PF
        - TF
        - GA
        - GE
        - DE
        - GH
        - GI
        - GR
        - GL
        - GD
        - GP
        - GU
        - GT
        - GG
        - GN
        - GW
        - GY
        - HT
        - HM
        - VA
        - HN
        - HK
        - HU
        - IS
        - IN
        - ID
        - IQ
        - IE
        - IR
        - IM
        - IL
        - IT
        - JM
        - JP
        - JE
        - JO
        - KZ
        - KE
        - KI
        - XK
        - KW
        - KG
        - LA
        - LV
        - LB
        - LS
        - LR
        - LY
        - LI
        - LT
        - LU
        - MO
        - MG
        - MW
        - MY
        - MV
        - ML
        - MT
        - MH
        - MQ
        - MR
        - MU
        - YT
        - MX
        - FM
        - MD
        - MC
        - MN
        - ME
        - MS
        - MA
        - MZ
        - MM
        - NA
        - NR
        - NP
        - NL
        - NC
        - NZ
        - NI
        - NE
        - NG
        - NU
        - NF
        - KP
        - MP
        - 'NO'
        - OM
        - PK
        - PW
        - PA
        - PG
        - PY
        - CN
        - PE
        - PH
        - PN
        - PL
        - PT
        - PR
        - QA
        - CG
        - GM
        - RE
        - RO
        - RU
        - RW
        - BL
        - SH
        - KN
        - LC
        - MF
        - PM
        - VC
        - WS
        - SM
        - ST
        - SA
        - SN
        - RS
        - SC
        - SL
        - SG
        - SX
        - SK
        - SI
        - SB
        - SO
        - ZA
        - GS
        - KR
        - SS
        - ES
        - LK
        - PS
        - SD
        - SR
        - SJ
        - SE
        - CH
        - SY
        - TW
        - TJ
        - TH
        - MK
        - TL
        - TG
        - TK
        - TO
        - TT
        - TN
        - TR
        - TM
        - TC
        - TV
        - UG
        - UA
        - AE
        - GB
        - TZ
        - UM
        - US
        - UY
        - UZ
        - VU
        - VE
        - VN
        - VG
        - VI
        - WF
        - EH
        - YE
        - ZM
        - ZW
      title: IdCountry
      description: ISO 3166-1 alpha-2 country codes. Mirrors tanjiro's CountryCodes enum.
    IdType:
      type: string
      enum:
        - CC
        - TI
        - CE
        - RC
        - PASSPORT
        - RG
        - CPF
        - OTHER_DOC
      title: IdType
      description: Tipos de documento de identificação do paciente suportados.
    ClinicalContext:
      properties:
        allergies:
          items:
            $ref: '#/components/schemas/ClinicalContextItem'
          type: array
          maxItems: 100
          title: Allergies
        medications:
          items:
            $ref: '#/components/schemas/ClinicalContextItem'
          type: array
          maxItems: 100
          title: Medications
        conditions:
          items:
            $ref: '#/components/schemas/ClinicalContextItem'
          type: array
          maxItems: 100
          title: Conditions
        noKnownAllergies:
          type: boolean
          title: Noknownallergies
          description: >-
            An explicit "no known allergies". Permitted only when `allergies`
            has no `ACTIVE` item.
          default: false
        noKnownMedications:
          type: boolean
          title: Noknownmedications
          description: >-
            An explicit "no known medications". Permitted only when
            `medications` has no `ACTIVE` item.
          default: false
        currentEncounter:
          anyOf:
            - $ref: '#/components/schemas/CurrentEncounter'
            - type: 'null'
          description: >-
            The visit the clinician takes this patient into. The scribe session
            attaches to it and reads its clinical context. Required when the
            block has any other field.
        previousEncounters:
          items:
            $ref: '#/components/schemas/PreviousEncounter'
          type: array
          maxItems: 50
          title: Previousencounters
      additionalProperties: false
      type: object
      title: ClinicalContext
      description: >-
        Dados clínicos estruturados do paciente e do atendimento: alergias,
        medicamentos, condições, o atendimento atual e os atendimentos
        anteriores. Veja /pt-BR/scribe-api/consultations#contexto-clínico.
    ScribeSessionModality:
      type: string
      enum:
        - IN_PERSON
        - TELEMEDICINE
        - DICTATION
      title: ScribeSessionModality
      description: Modalidades de sessão de scribe suportadas.
    ErrorDetailWithRequestId:
      description: >-
        Top-level error object: :class:`ErrorDetail` plus the request
        correlation id.


        Kept as a subclass rather than a field on ``ErrorDetail`` because
        ``ErrorDetail`` is

        also the per-item error shape inside the batch account-creation response

        (``BatchAccountResult.error``), which is serialized with nulls included.
        Adding the

        field there would publish ``"requestId": null`` on an HTTP 200, and
        there is only

        ever one request id per batch anyway -- batch callers read the
        ``X-Request-ID``

        response header.
      properties:
        type:
          description: Broad error category for high-level handling.
          examples:
            - invalid_request_error
          title: Type
          type: string
        code:
          description: Machine-readable error code. Clients should switch on this value.
          examples:
            - parameter_invalid
          title: Code
          type: string
        message:
          description: Human-readable error message ending with a period.
          examples:
            - >-
              idCountry must be a valid country name, ISO alpha-2, or ISO
              alpha-3 code.
          title: Message
          type: string
        param:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: The request field that caused the error, if applicable.
          examples:
            - idCountry
          title: Param
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          description: Optional structured, machine-readable context for the error.
          examples:
            - pendingConsultations:
                - sessionId: abc123
                  url: https://...
          title: Details
        requestId:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Unique id for this request, identical to the X-Request-ID response
            header. Quote it when contacting support.
          examples:
            - 3f9a1c2e-5b7d-4a21-9f0c-8e6d4b2a1c30
          title: Requestid
      required:
        - type
        - code
        - message
      title: ErrorDetailWithRequestId
      type: object
    ClinicalContextItem:
      properties:
        id:
          type: string
          maxLength: 128
          minLength: 1
          title: Id
          description: >-
            Your internal id of the item. It does not change between calls and
            it is unique in one list of one patient. Each call writes the item
            by this id.
          examples:
            - ALG-881
        name:
          type: string
          maxLength: 500
          minLength: 1
          title: Name
          description: >-
            The text the AI shows. For a medication, put the dose and the
            frequency here.
          examples:
            - Losartana 50 mg, 1 comprimido ao dia
        code:
          anyOf:
            - $ref: '#/components/schemas/ClinicalContextCode'
            - type: 'null'
        status:
          type: string
          enum:
            - ACTIVE
            - INACTIVE
            - ENTERED_IN_ERROR
          title: Status
          description: >-
            `ACTIVE` (default): the AI shows the item. `INACTIVE`: stopped or
            resolved; the AI does not show it. `ENTERED_IN_ERROR`: sent by
            mistake; removes the item.
          default: ACTIVE
        note:
          anyOf:
            - type: string
              maxLength: 1000
            - type: 'null'
          title: Note
          description: A short note the AI shows after the name.
      additionalProperties: false
      type: object
      required:
        - id
        - name
      title: ClinicalContextItem
      description: Uma alergia, um medicamento, uma condição ou um diagnóstico.
    CurrentEncounter:
      properties:
        id:
          type: string
          maxLength: 128
          minLength: 1
          title: Id
          description: >-
            Your encounter id, for example the atendimento number. Unique in
            your institution. For the current encounter, the `Encounter.id` of
            the visit you pushed for this patient.
          examples:
            - ATD-9001
        class:
          anyOf:
            - type: string
              enum:
                - EMERGENCY
                - AMBULATORY
                - INPATIENT
            - type: 'null'
          title: Class
          description: >-
            `EMERGENCY`, `AMBULATORY` or `INPATIENT`. Use `AMBULATORY` for
            telemedicine. Default, on the first write of the encounter:
            `AMBULATORY`.
        diagnoses:
          items:
            $ref: '#/components/schemas/ClinicalContextItem'
          type: array
          maxItems: 50
          title: Diagnoses
        procedures:
          items:
            $ref: '#/components/schemas/ClinicalContextProcedure'
          type: array
          maxItems: 50
          title: Procedures
        note:
          anyOf:
            - type: string
              maxLength: 10000
            - type: 'null'
          title: Note
          description: >-
            All notes of the encounter, in time order. `null` clears the stored
            note; an absent `note` keeps it.
        startedAt:
          anyOf:
            - type: string
            - type: 'null'
          title: Startedat
          description: >-
            `YYYY-MM-DD`, or an ISO 8601 date-time with its UTC offset. Default,
            on the first write of the encounter: the time of the call.
          examples:
            - '2026-10-15T08:40:00-03:00'
        chiefComplaint:
          anyOf:
            - type: string
              maxLength: 1000
            - type: 'null'
          title: Chiefcomplaint
        triagePriority:
          anyOf:
            - type: string
              maxLength: 100
            - type: 'null'
          title: Triagepriority
          description: In the words of your triage scale.
          examples:
            - Amarelo - urgente
        vitals:
          anyOf:
            - $ref: '#/components/schemas/EncounterVitals'
            - type: 'null'
      additionalProperties: false
      type: object
      required:
        - id
      title: CurrentEncounter
      description: A visita em que o médico atende este paciente.
    PreviousEncounter:
      properties:
        id:
          type: string
          maxLength: 128
          minLength: 1
          title: Id
          description: >-
            Your encounter id, for example the atendimento number. Unique in
            your institution. For the current encounter, the `Encounter.id` of
            the visit you pushed for this patient.
          examples:
            - ATD-9001
        class:
          anyOf:
            - type: string
              enum:
                - EMERGENCY
                - AMBULATORY
                - INPATIENT
            - type: 'null'
          title: Class
          description: >-
            `EMERGENCY`, `AMBULATORY` or `INPATIENT`. Use `AMBULATORY` for
            telemedicine. Default, on the first write of the encounter:
            `AMBULATORY`.
        diagnoses:
          items:
            $ref: '#/components/schemas/ClinicalContextItem'
          type: array
          maxItems: 50
          title: Diagnoses
        procedures:
          items:
            $ref: '#/components/schemas/ClinicalContextProcedure'
          type: array
          maxItems: 50
          title: Procedures
        note:
          anyOf:
            - type: string
              maxLength: 10000
            - type: 'null'
          title: Note
          description: >-
            All notes of the encounter, in time order. `null` clears the stored
            note; an absent `note` keeps it.
        startedAt:
          type: string
          title: Startedat
          description: '`YYYY-MM-DD`, or an ISO 8601 date-time with its UTC offset.'
          examples:
            - '2025-05-02'
      additionalProperties: false
      type: object
      required:
        - id
        - startedAt
      title: PreviousEncounter
      description: Um atendimento anterior deste paciente. É armazenado como finalizado.
    ClinicalContextCode:
      properties:
        system:
          type: string
          enum:
            - ICD10
            - ICD11
            - SNOMED
            - ATC
            - RXNORM
          title: System
          description: >-
            `ICD10` (conditions and diagnoses), `ICD11`, `SNOMED` (any list),
            `ATC` (medications and drug allergies) or `RXNORM` (medications).
          examples:
            - ICD10
        value:
          type: string
          maxLength: 64
          minLength: 1
          title: Value
          examples:
            - I10
      additionalProperties: false
      type: object
      required:
        - system
        - value
      title: ClinicalContextCode
      description: Um código de um dos sistemas de codificação suportados.
    ClinicalContextProcedure:
      properties:
        id:
          type: string
          maxLength: 128
          minLength: 1
          title: Id
          examples:
            - PX-9001-1
        name:
          type: string
          maxLength: 500
          minLength: 1
          title: Name
          examples:
            - Tomografia de crânio sem contraste
        code:
          anyOf:
            - $ref: '#/components/schemas/ClinicalContextCode'
            - type: 'null'
        status:
          anyOf:
            - type: string
              const: ENTERED_IN_ERROR
            - type: 'null'
          title: Status
          description: Only `ENTERED_IN_ERROR`, to remove a procedure sent by mistake.
      additionalProperties: false
      type: object
      required:
        - id
        - name
      title: ClinicalContextProcedure
      description: Um procedimento de um atendimento. Recebe a data do seu atendimento.
    EncounterVitals:
      properties:
        measuredAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Measuredat
          description: >-
            ISO 8601 date-time with its UTC offset. Default: the time of the
            call.
          examples:
            - '2026-10-15T08:55:00-03:00'
        systolicBloodPressure:
          anyOf:
            - type: number
              maximum: 300
              minimum: 20
            - type: 'null'
          title: Systolicbloodpressure
          description: mmHg.
        diastolicBloodPressure:
          anyOf:
            - type: number
              maximum: 300
              minimum: 20
            - type: 'null'
          title: Diastolicbloodpressure
          description: mmHg.
        heartRate:
          anyOf:
            - type: number
              maximum: 300
              minimum: 20
            - type: 'null'
          title: Heartrate
          description: Beats per minute.
        respiratoryRate:
          anyOf:
            - type: number
              maximum: 100
              minimum: 1
            - type: 'null'
          title: Respiratoryrate
          description: Breaths per minute.
        temperature:
          anyOf:
            - type: number
              maximum: 45
              minimum: 25
            - type: 'null'
          title: Temperature
          description: Degrees Celsius.
        oxygenSaturation:
          anyOf:
            - type: number
              maximum: 100
              minimum: 0
            - type: 'null'
          title: Oxygensaturation
          description: Percent.
        weight:
          anyOf:
            - type: number
              maximum: 500
              minimum: 0.2
            - type: 'null'
          title: Weight
          description: Kilograms.
        height:
          anyOf:
            - type: number
              maximum: 260
              minimum: 20
            - type: 'null'
          title: Height
          description: Centimeters.
        bloodGlucose:
          anyOf:
            - type: number
              maximum: 2000
              minimum: 10
            - type: 'null'
          title: Bloodglucose
          description: mg/dL.
        painScore:
          anyOf:
            - type: number
              maximum: 10
              minimum: 0
            - type: 'null'
          title: Painscore
          description: A 0 to 10 scale.
      additionalProperties: false
      type: object
      title: EncounterVitals
      description: O conjunto mais recente de sinais vitais do atendimento atual.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Chave de API enviada como token Bearer

````

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