Estás integrando la API pública de Telepatia Synapse.
Endpoint: POST /v1/appointments
Base URL: https://scribe-api.telepatia.ai
Auth: Authorization: Bearer ${SYNAPSE_API_KEY}
Solicitud:
- consultationInternalId [body]: string (requerido, pattern=^[a-zA-Z0-9_-]{1,128}$, maxLength=128) — Your own consultation id. The booking join key: the consultation that fulfils this appointment carries the same id.
- name [body]: string (opcional, minLength=1, maxLength=500) — Patient full name. Part of the inline identity. Provide the full inline identity (name + idCountry + idType + idValue), or reference an existing patient with patientId or internalCode: exactly one of the three is required.
- 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) — Patient document number. Part of the inline identity (see `name`).
- patientId [body]: string (opcional, pattern=^sp_[a-z0-9]{16}$) — Public id of an existing patient (sp_...). One of the three patient references (exactly one required): patientId, internalCode, or the inline identity.
- internalCode [body]: string (opcional, minLength=1, maxLength=128) — Your own patient code, unique per institution. Looks up an existing patient; when none matches, the inline identity creates one. One of the three patient references (exactly one required).
- start [body]: string (requerido, maxLength=64) — ISO-8601 start. Required.
- end [body]: string (requerido, maxLength=64) — ISO-8601 end. Required.
- minutesDuration [body]: integer (opcional, min=1.0) — Duration in minutes.
- serviceType [body]: string (opcional, maxLength=256)
- appointmentType [body]: string (opcional, maxLength=256)
- reason [body]: string (opcional, maxLength=2000)
- description [body]: string (opcional, maxLength=2000)
- medicalRecordConfigurationId [body]: string (opcional, maxLength=128) — Public id of a medical record configuration (mrc_...). When present, the consultation context is seeded.
- scribeSessionModality [body]: string (opcional, enum: IN_PERSON, TELEMEDICINE, DICTATION) — Modalidades de sesión de scribe soportadas.
- notes [body]: string (opcional, maxLength=10000)
- pastMedicalHistory [body]: string (opcional, maxLength=10000)
Éxito 200:
- id: string
- consultationInternalId?: string
- status: string
- start?: string
- end?: string
- minutesDuration?: integer
- serviceType?: string
- appointmentType?: string
- reason?: string
- description?: string
- createdAt: string
Errores (envoltorio: { error: { type, code, message, param? } }):
- 400: parameter_missing, parameter_invalid, account_invalid
- 401: authentication_required
- 403: permission_denied, permission_denied_role
- 404: resource_not_found
- 409: resource_conflict
- 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.