> For the complete documentation index, see [llms.txt](https://docs.lid.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lid.pro/es/agents/webhooks.md).

# Webhooks y eventos

Los cinco eventos de webhook de Lid, los tres encabezados de firma, y cómo verificar una entrega con HMAC-SHA256.

Lid llama a una URL tuya cuando pasa algo. Registra la URL con `create_webhook` o en la app en **Configuración → Desarrollo → Nuevo webhook**. El secreto de firma se muestra una sola vez. Guárdalo. Desde un agente, `create_webhook` necesita el permiso **Catálogo** en la llave.

## Los eventos

| Evento                      | Se dispara cuando                                                         |
| --------------------------- | ------------------------------------------------------------------------- |
| `purchase.completed`        | Una venta se liquidó.                                                     |
| `conversion.approved`       | Una conversión de campaña pasó la revisión y quedó lista para pagarse.    |
| `prize.claimed`             | Un titular de premio reclamó el premio de un reto.                        |
| `subscription.created`      | Alguien se suscribió a una membresía. Se dispara solo con el primer pago. |
| `bounty.submission.created` | Alguien participó en uno de tus retos.                                    |

Un sexto tipo, `webhook.test`, es el evento de prueba que te envías tú.

{% hint style="info" %}
La venta de un producto con ventana de reembolso queda protegida hasta que la ventana pasa, y una venta así nunca dispara `purchase.completed`. Para seguirla, usa `my_sales`: cada venta muestra su `kind` (`purchase` o `hold`) y, si es `hold`, su `status` (`held`, `released`, `refunded` o `disputed`).
{% endhint %}

## Verificar una entrega

Cada entrega lleva tres encabezados:

```
x-lid-event      · el tipo de evento
x-lid-timestamp  · hora unix de la entrega
x-lid-signature  · sha256=HMAC_SHA256(secreto, timestamp + '.' + body)
```

Recalcula el HMAC sobre `timestamp + '.' + body crudo` con tu secreto y compara. Rechaza si no coincide o si el timestamp es viejo. El helper del SDK de Lid rechaza las entregas de más de 5 minutos.

## Cuando una entrega no llega

`webhook_deliveries` lista los intentos recientes de un endpoint con el código de estado y el error. Es el primer lugar donde mirar cuando Lid no te está llamando. Un endpoint se apaga solo después de 20 entregas fallidas seguidas. Para enviarte un evento de prueba, llama a la ruta REST `POST /api/v1/agent/webhooks/{id}/test`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lid.pro/es/agents/webhooks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
