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

# Webhook respuesta

> Recibe el resultado terminal de una consulta VIN por webhook

## Descripción General

El resultado de una consulta VIN se entrega por `POST` al **webhook del cliente**. La URL **no se envía en el request**: se configura manualmente y se coordina por correo.

El webhook se dispara **solo en estados terminales**: éxito (`success`) y error (`error`). Nunca para `pending`, y nunca para el `422` de validación (eso lo resuelve por completo el endpoint de [creación](/api-reference/vin/create-vin-query)).

## Body

El body es el mismo envelope del [GET de polling](/api-reference/vin/get-vin-query), con `task_id` a nivel raíz para correlación.

```json theme={null}
{
  "status": "success",
  "message": "Se ha encontrado la información correctamente.",
  "task_id": "a1b2c3d4-...",
  "data": {
    "vin": "1HGCM82633A004352",
    "placas": [
      { "placa": "ABC-123", "estado": "En Circulación" }
    ]
  }
}
```

## Headers

| Header         | Valor                                |
| -------------- | ------------------------------------ |
| `Content-Type` | `application/json`                   |
| `X-Signature`  | `sha256=<HMAC-SHA256(body, secret)>` |
| `X-Timestamp`  | ISO-8601 UTC del envío               |

## Verificación de Firma (lado cliente)

Recalcula la firma sobre el body crudo con tu `secret` y compárala en tiempo constante con el header `X-Signature`:

```text theme={null}
firma_esperada = "sha256=" + HMAC_SHA256(raw_body, SECRET)
válido = hmac.compare(firma_esperada, header["X-Signature"])
```

## Reintentos

Si el cliente no responde `2xx`, la entrega se reintenta con backoff `0s → 30s → 120s`.

## Seguridad

* **HMAC-SHA256** en el webhook (`X-Signature`) + `X-Timestamp` contra replay.
* **Token siempre en header** `Authorization: Bearer`, nunca en la URL.
* **TLS obligatorio** en todas las llamadas.
