You are integrating Telepatia Synapse Public API.
Endpoint: POST /v1/institutional/accounts
Base URL: https://scribe-api.telepatia.ai
Auth: Authorization: Bearer ${SYNAPSE_API_KEY}
Request:
- email [body]: string (required, maxLength=254)
- doctorSpecialties [body]: array<MedicalSpecialty> (required, minItems=1) — Accepts either the specialty key ('CARDIOLOGY') or value ('cardiology'); always persisted as the value.
- country [body]: string (optional) — Country as ISO 3166-1 alpha-2 (e.g. 'CO', 'BR'). Also accepts alpha-3 ('COL') or the English country name ('COLOMBIA'); all are normalized to the alpha-2 code Telepatia stores. Omit to inherit the institution's country.
- language [body]: string (optional) — Account UI/content language as ISO 639-1 (e.g. 'es', 'pt', 'en'). Omit to inherit the institution's language.
- timeZone [body]: string (optional) — IANA time zone (e.g. 'America/Bogota', 'America/Sao_Paulo'). Omit to inherit the institution's time zone.
- nameFull [body]: string (optional, maxLength=500)
- institutionalBranchName [body]: string (optional, maxLength=255)
- internalCode [body]: string (optional, maxLength=128) — Idempotency key scoped to the institution. Re-submitting the same value returns 409 if the account already exists. Omit to have the server generate a UUID v7 (no idempotency when generated); the value is returned in the response.
- apiKeyConfig [body]: object (optional) — Configuration for the API key minted with the new account.
Success 201:
- id: string
- email: string
- apiKey: string
- publishableApiKey?: string
- internalCode: string
- expiresAt?: string
- apiKeyExpiresInDays: integer
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.