You are integrating Telepatia Synapse Public API.
Endpoint: POST /v1/patients
Base URL: https://scribe-api.telepatia.ai
Auth: Authorization: Bearer ${SYNAPSE_API_KEY}
Request:
- name [body]: string (required, minLength=1, maxLength=500)
- idCountry [body]: string (required, enum: 250 values) — ISO 3166-1 alpha-2 country codes. Mirrors tanjiro's CountryCodes enum.
- idType [body]: string (required, enum: 8 values) — Supported patient identification document types.
- idValue [body]: string (required, minLength=1, maxLength=50)
Success 200:
- id: string
- name: string
- idCountry?: string
- idType?: string
- idValue?: string
- createdAt: string
Errors (envelope: { error: { type, code, message, param? } }):
- 400: parameter_missing, parameter_invalid, account_invalid
- 401: authentication_required
- 409: resource_conflict
- 503: service_unavailable
Generate code in the language of the current file that:
1. Reads SYNAPSE_API_KEY from env (do not hardcode it).
2. Calls the endpoint with typed request and response.
3. Maps the error envelope to typed exceptions per status code.
4. Adds one happy-path test using the Bearer token.