You are integrating Telepatia Synapse Public API.
Endpoint: POST /v1/institutional/accounts
Base URL: https://synapse.telepatia.ai
Auth: Authorization: Bearer ${SYNAPSE_API_KEY}
Request:
- email [body]: string (required, maxLength=254)
- doctorSpecialties [body]: array<string> (required, minItems=1)
- accountRole [body]: string (optional)
- country [body]: string (optional)
- language [body]: string (optional)
- timeZone [body]: string (optional)
- 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.
Success 200:
_(empty response)_
Errors (envelope: { error: { type, code, message, param? } }):
- 201: —
- 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.
Institutional
Create a doctor account
Copy into Cursor/Claude/Copilot to scaffold a POST /v1/institutional/accounts integration.
Drop this prompt into your AI coding assistant. It already includes the contract, auth, and error envelope so the generated code matches the production API.