Você está integrando a API pública da Telepatia Synapse.
Endpoint: POST /v1/appointments
Base URL: https://scribe-api.telepatia.ai
Auth: Authorization: Bearer ${SYNAPSE_API_KEY}
Requisição:
- consultationInternalId [body]: string (obrigatório, 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 identificação do paciente suportados.
- 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 (obrigatório, maxLength=64) — ISO-8601 start. Required.
- end [body]: string (obrigatório, 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 sessão de scribe suportadas.
- notes [body]: string (opcional, maxLength=10000)
- pastMedicalHistory [body]: string (opcional, maxLength=10000)
Sucesso 200:
- id: string
- consultationInternalId?: string
- status: string
- start?: string
- end?: string
- minutesDuration?: integer
- serviceType?: string
- appointmentType?: string
- reason?: string
- description?: string
- createdAt: string
Erros (envelope: { 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
Gere código na linguagem do arquivo atual que:
1. Leia SYNAPSE_API_KEY do ambiente (não fixe o valor no código).
2. Chame o endpoint com requisição e resposta tipadas.
3. Mapeie o envelope de erros para exceções tipadas por código de status.
4. Adicione um teste de caminho feliz usando o token Bearer.