> ## Documentation Index
> Fetch the complete documentation index at: https://docs.telepatia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Atualizar uma assinatura de webhook

> Copie para o Cursor/Claude/Copilot para gerar uma integração PATCH /v1/webhooks/{webhook_id}.

Cole este prompt no seu assistente de programação com IA. Ele já inclui o contrato, a autenticação e o envelope de erros, para que o código gerado corresponda à API de produção.

<CodeGroup>
  ```text Prompt theme={null}
  Você está integrando a API pública da Telepatia Synapse.

  Endpoint: PATCH /v1/webhooks/{webhook_id}
  Base URL: https://scribe-api.telepatia.ai
  Auth: Authorization: Bearer ${SYNAPSE_API_KEY}

  Requisição:
  - webhook_id [path]: string (obrigatório)
  - url [body]: string (opcional, format=uri, minLength=1, maxLength=2083)
  - name [body]: string (opcional, 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> (opcional) — Replace the subscribed event types (at least one). Preferred over `event`.
  - event [body]: string (opcional, enum: 8 values) — 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 (opcional) — Pause/resume delivery without deleting the subscription.

  Sucesso 200:
  - id: string
  - url: string
  - name?: string
  - events: array<WebhookEventName>
  - event?: string
  - isActive: boolean
  - signingSecretPrefix?: string
  - signingSecretVersion?: integer
  - createdAt?: string
  - updatedAt?: string
  - deletedAt?: string

  Erros (envelope: { error: { type, code, message, param? } }):
  - 400: parameter_missing, parameter_invalid, account_invalid
  - 401: authentication_required
  - 403: permission_denied, permission_denied_role
  - 404: resource_not_found
  - 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.
  ```

  ```bash curl theme={null}
  curl -X PATCH https://scribe-api.telepatia.ai/v1/webhooks/{webhook_id} \
    -H "Authorization: Bearer $SYNAPSE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "events": [
      "scribe_session.completed",
      "scribe_session.error"
    ],
    "isActive": true
  }'
  ```
</CodeGroup>
