Estás integrando la API pública de Telepatia Synapse.
Endpoint: POST /v1/set-consultation-context
Base URL: https://scribe-api.telepatia.ai
Auth: Authorization: Bearer ${SYNAPSE_API_KEY}
Solicitud:
- name [body]: string (opcional, minLength=1, maxLength=500)
- idCountry [body]: string (opcional, enum: 250 values) — ISO 3166-1 alpha-2 country codes. Mirrors tanjiro's CountryCodes enum.
- idType [body]: string (opcional, enum: 8 values) — Tipos de documento de identificación de paciente soportados.
- idValue [body]: string (opcional, minLength=1, maxLength=50)
- patientId [body]: string (opcional, pattern=^sp_[a-z0-9]{16}$) — 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.
- internalCode [body]: string (opcional, minLength=1, maxLength=128) — 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.
- notes [body]: string (opcional, maxLength=10000)
- pastMedicalHistory [body]: string (opcional, maxLength=10000)
- consultationInternalId [body]: string (opcional, pattern=^[a-zA-Z0-9_-]{1,128}$, maxLength=128)
- scribeSessionModality [body]: string (opcional, enum: IN_PERSON, TELEMEDICINE, DICTATION) — Modalidades de sesión de scribe soportadas.
- institutionalBranchId [body]: string (opcional, maxLength=128) — 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.
- institutionalBranch [body]: string (opcional, maxLength=256) — Name of the institution branch for this consultation. Resolved when institutionalBranchId is not provided. Provide the id or the name.
- scribeSessionConfigurationId [body]: string (opcional, maxLength=128) — Public id of a scribe session configuration (`ssc_` + 16 chars `[a-z0-9]`). Mutually exclusive with `medicalRecordConfigurationId` and `medicalRecordConfiguration`.
- medicalRecordConfigurationId [body]: string (opcional, maxLength=128) — Public id of a medical record configuration (`mrc_` + 16 chars `[a-z0-9]`). Mutually exclusive with `scribeSessionConfigurationId` and `medicalRecordConfiguration`.
- medicalRecordConfiguration [body]: object (opcional) — 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`.
Éxito 200:
- success: boolean
- consultationInternalId: string
Errores (envoltorio: { error: { type, code, message, param? } }):
- 400: parameter_missing, parameter_invalid, account_invalid
- 401: authentication_required
- 404: resource_not_found
- 409: resource_conflict, resource_not_active
- 503: service_unavailable
Genera código en el lenguaje del archivo actual que:
1. Lea SYNAPSE_API_KEY desde el entorno (no lo escribas de forma fija).
2. Llame al endpoint con solicitud y respuesta tipadas.
3. Asigne el envoltorio de errores a excepciones tipadas por código de estado.
4. Agregue una prueba de flujo exitoso usando el token Bearer.