---
title: "Registrar un webhook de autorización"
method: POST
path: "/webhooks"
tags: ["Webhooks"]
---

# Registrar un webhook de autorización

`POST /webhooks`

## Request

- Base URL: `https://facturacobra.com/api/v1`
- URL: `https://facturacobra.com/api/v1/webhooks`
- Auth: API key in header `X-API-Key`

Cuando un comprobante llega a estado terminal (authorized/rejected) —típicamente por el path asíncrono de contingencia/retry— Cobra hace POST a esta url. El cuerpo va firmado: header `X-Cobra-Signature: sha256=<hex>` = HMAC-SHA256(secret, `${X-Cobra-Timestamp}.${body}`). El `secret` se devuelve UNA sola vez al registrar. Evento: `{ event, document_id, tipo_comprobante, numero, clave_acceso, estado, numero_autorizacion, timestamp }`.

## Request body

- object
  - `url` string, uri, required: https:// (o http://127.0.0.1 para pruebas).

## Response `201`

Creado (incluye el secret una sola vez)

## Other responses

- `400`: url inválida
- `403`: Falta el scope 'webhooks:write'

---

[API](https://skmtc.dev/facturacobra/apis/cobra-api-de-facturacion-electronica-sri.md) · [All operations](https://skmtc.dev/facturacobra/apis/cobra-api-de-facturacion-electronica-sri/llms.txt) · [OpenAPI document](https://skmtc.dev/facturacobra/apis/cobra-api-de-facturacion-electronica-sri/revisions/ca7de81e465d?raw)
