Você está integrando a API pública da Telepatia Synapse.
Endpoint: POST /v1/patients
Base URL: https://scribe-api.telepatia.ai
Auth: Authorization: Bearer ${SYNAPSE_API_KEY}
Requisição:
- name [body]: string (obrigatório, minLength=1, maxLength=500)
- idCountry [body]: string (obrigatório, enum: 250 values) — ISO 3166-1 alpha-2 country codes. Mirrors tanjiro's CountryCodes enum.
- idType [body]: string (obrigatório, enum: 8 values) — Tipos de documento de identificação do paciente suportados.
- idValue [body]: string (obrigatório, minLength=1, maxLength=50)
- internalCode [body]: string (opcional, minLength=1, maxLength=128) — Caller-provided internal code, unique within your institution.
Sucesso 200:
- id: string
- name: string
- idCountry?: string
- idType?: string
- idValue?: string
- internalCode?: string
- createdAt: string
Erros (envelope: { error: { type, code, message, param? } }):
- 400: parameter_missing, parameter_invalid, account_invalid
- 401: authentication_required
- 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.