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

# Atualizar endpoint de webhook

> Atualiza nome, URL, eventos ou estado

Atualiza somente os campos enviados. O array `events` substitui a inscrição anterior.

## Autenticação

Todas as rotas exigem uma API Key no header `X-API-Key`. A chave deve começar com `zeriq_`.

```http theme={null}
X-API-Key: zeriq_sua_chave
```

```bash cURL theme={null}
curl -X PATCH "https://api.zeriqpay.com.br/v1/webhooks/update/cmid_webhook" \
  -H "X-API-Key: zeriq_sua_chave" \
  -H "Content-Type: application/json" \
  -d '{"events":["payment.paid","refund.completed"],"active":true}'
```

### Body

Todos os campos são opcionais: `name`, `url`, `events` e `active`. A URL deve ser HTTPS e `events` deve conter ao menos um evento quando enviado.

## Referência

* **Método:** `PATCH`
* **Rota:** `/v1/webhooks/update/{id}`
* **Escopo:** `webhooks.update`
* **Resposta de sucesso:** `200 OK`

Para pausar temporariamente, use `active: false`. Para remover definitivamente, use a rota de revogação.

### Exemplo de resposta

```json theme={null}
{"success":true,"message":"Endpoint de webhook atualizado com sucesso.","data":{"id":"cmid_webhook","name":"Pagamentos","url":"https://app.exemplo.com/webhooks/zeriqpay","events":["payment.paid","refund.completed"],"active":true,"lastDeliveryAt":null,"createdAt":"2026-10-28T12:00:00.000Z","updatedAt":"2026-10-28T12:00:00.000Z"}}
```

### Erros comuns

* `400`: URL, eventos ou body inválidos.
* `401`: API Key ausente ou inválida.
* `403`: a chave não possui o escopo `webhooks.update`.
* `404`: endpoint não encontrado ou não pertence à conta.


## OpenAPI

````yaml PATCH /v1/webhooks/update/{id}
openapi: 3.1.0
info:
  title: ZeriqPay API
  description: >-
    Referência da API v1 da ZeriqPay. As rotas de gerenciamento de webhooks não
    fazem parte desta documentação.
  version: 1.0.0
  contact:
    name: ZeriqPay
    url: https://api.zeriqpay.com.br
servers:
  - url: https://api.zeriqpay.com.br
    description: Produção
security:
  - apiKeyAuth: []
tags:
  - name: Conta
    description: Dados, taxas e limites da conta
  - name: Pagamentos PIX
    description: Cobranças PIX
  - name: Transações
    description: Consulta de transações
  - name: Transferências
    description: Saídas PIX, cripto e internas
  - name: Reembolsos
    description: Reembolsos de cobranças
  - name: Disputas MED
    description: Consulta e envio de evidências MED
  - name: Webhooks
    description: Cadastro e configuração dos endpoints de webhook
paths:
  /v1/webhooks/update/{id}:
    patch:
      tags:
        - Webhooks
      summary: Atualizar endpoint de webhook
      description: |-
        Atualiza nome, URL, eventos inscritos ou o estado ativo do endpoint.

        **Escopo necessário:** `webhooks.update`.
      operationId: updateWebhookEndpoint
      parameters:
        - name: id
          in: path
          required: true
          description: ID do endpoint.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWebhookRequest'
            examples:
              default:
                summary: Atualizar eventos
                value:
                  events:
                    - payment.paid
                    - refund.completed
                  active: true
      responses:
        '200':
          description: Endpoint atualizado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookEndpointResponse'
              example:
                success: true
                message: Endpoint de webhook atualizado com sucesso.
                data:
                  id: cmid_webhook
                  name: Pagamentos
                  url: https://app.exemplo.com/webhooks/zeriqpay
                  events:
                    - payment.paid
                    - payment.failed
                  active: true
                  lastDeliveryAt: null
                  createdAt: '2026-10-28T12:00:00.000Z'
                  updatedAt: '2026-10-28T12:00:00.000Z'
        '400':
          description: Corpo ou parâmetros inválidos.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponse'
              example:
                success: false
                message: Dados inválidos.
        '401':
          description: API Key ausente ou inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponse'
        '403':
          description: Conta bloqueada ou escopo insuficiente
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponse'
        '404':
          description: Webhook não encontrado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponse'
        '429':
          description: Limite específico da rota excedido
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    UpdateWebhookRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
        url:
          type: string
          format: uri
          pattern: ^https://
          maxLength: 2048
        events:
          type: array
          minItems: 1
          uniqueItems: true
          items:
            type: string
            enum:
              - payment.created
              - payment.paid
              - payment.failed
              - payment.pix.expired
              - refund.requested
              - refund.completed
              - refund.failed
              - transfer.created
              - transfer.completed
              - transfer.failed
              - transfer.internal.completed
              - transfer.internal.received
              - med.created
              - med.evidence_sent
              - med.updated
              - webhook.test
        active:
          type: boolean
    WebhookEndpointResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          example: true
        data:
          $ref: '#/components/schemas/WebhookEndpoint'
    GenericResponse:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          type: object
          additionalProperties: true
      required:
        - success
    WebhookEndpoint:
      type: object
      required:
        - id
        - url
        - events
        - active
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          example: cmid_webhook
        name:
          type:
            - string
            - 'null'
          example: Pagamentos
        url:
          type: string
          format: uri
          example: https://app.exemplo.com/webhooks/zeriqpay
        events:
          type: array
          items:
            type: string
            enum:
              - payment.created
              - payment.paid
              - payment.failed
              - payment.pix.expired
              - refund.requested
              - refund.completed
              - refund.failed
              - transfer.created
              - transfer.completed
              - transfer.failed
              - transfer.internal.completed
              - transfer.internal.received
              - med.created
              - med.evidence_sent
              - med.updated
              - webhook.test
          example:
            - payment.paid
            - payment.failed
        active:
          type: boolean
          example: true
        lastDeliveryAt:
          type:
            - string
            - 'null'
          format: date-time
          example: null
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API Key ZeriqPay iniciada por `zeriq_`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.