You are integrating Telepatia Synapse Public API.
Endpoint: PATCH /v1/webhooks/{webhook_id}
Base URL: https://scribe-api.telepatia.ai
Auth: Authorization: Bearer ${SYNAPSE_API_KEY}
Request:
- webhook_id [path]: string (required)
- url [body]: string (optional, format=uri, minLength=1, maxLength=2083)
- name [body]: string (optional, maxLength=100) — Optional label. Send a non-empty value to set/replace it, or an empty string to clear it. Omit to leave it unchanged.
- events [body]: array<WebhookEventName> (optional) — Replace the subscribed event types (at least one). Preferred over `event`.
- event [body]: string (optional, enum: scribe_session.created, scribe_session.completed, scribe_session.error, scribe_session.updated, scribe_session.cancelled, scribe_session.deleted) — Webhook event types exposed to API clients.
Mirrors `SynapseWebhookEventType` enum in datalayer (camelCase) but
rendered to clients as snake_case dotted strings (closer to Stripe
convention and easier to grep in caller logs).
- isActive [body]: boolean (optional) — Pause/resume delivery without deleting the subscription.
Success 200:
- id: string
- url: string
- name?: string
- events: array<WebhookEventName>
- event?: string
- isActive: boolean
- signingSecretPrefix?: string
- signingSecretVersion?: integer
- createdAt?: string
- updatedAt?: string
- deletedAt?: string
Errors (envelope: { error: { type, code, message, param? } }):
- 400: parameter_missing, parameter_invalid, account_invalid
- 401: authentication_required
- 403: permission_denied
- 404: resource_not_found
- 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.