Você está integrando a API pública da Telepatia Synapse.
Endpoint: POST /v1/institutional/accounts
Base URL: https://scribe-api.telepatia.ai
Auth: Authorization: Bearer ${SYNAPSE_API_KEY}
Requisição:
- email [body]: string (obrigatório, maxLength=254)
- doctorSpecialties [body]: array<MedicalSpecialty> (obrigatório, minItems=1) — Accepts either the specialty key ('CARDIOLOGY') or value ('cardiology'); always persisted as the value.
- country [body]: string (opcional) — 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 (opcional) — Account UI/content language as ISO 639-1 (e.g. 'es', 'pt', 'en'). Omit to inherit the institution's language.
- timeZone [body]: string (opcional) — IANA time zone (e.g. 'America/Bogota', 'America/Sao_Paulo'). Omit to inherit the institution's time zone.
- nameFull [body]: string (opcional, maxLength=500)
- institutionalBranchName [body]: string (opcional, maxLength=255)
- internalCode [body]: string (opcional, 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 (opcional) — Configuration for the API key minted with the new account.
Sucesso 201:
- id: string
- email: string
- apiKey: string
- publishableApiKey?: string
- internalCode: string
- expiresAt?: string
- apiKeyExpiresInDays: integer
Erros (envelope: { error: { type, code, message, param? } }):
- 400: parameter_missing, parameter_invalid, account_invalid
- 401: authentication_required
- 403: permission_denied, permission_denied_role
- 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.