# Webhooks

Addresses on your server that receive the events, signed.

The guide, step by step: https://fiscalisto.com/en/docs/api/webhooks.md

## Endpoints

- [Create a webhook](https://fiscalisto.com/en/docs/api/referencia/webhooks/create-webhook-endpoint.md): `POST /v1/webhook_endpoints`
- [List webhooks](https://fiscalisto.com/en/docs/api/referencia/webhooks/list-webhook-endpoints.md): `GET /v1/webhook_endpoints`
- [Get a webhook](https://fiscalisto.com/en/docs/api/referencia/webhooks/get-webhook-endpoint.md): `GET /v1/webhook_endpoints/{id}`
- [Update a webhook](https://fiscalisto.com/en/docs/api/referencia/webhooks/update-webhook-endpoint.md): `POST /v1/webhook_endpoints/{id}`
- [Delete a webhook](https://fiscalisto.com/en/docs/api/referencia/webhooks/delete-webhook-endpoint.md): `DELETE /v1/webhook_endpoints/{id}`
- [Rotate the secret](https://fiscalisto.com/en/docs/api/referencia/webhooks/roll-webhook-secret.md): `POST /v1/webhook_endpoints/{id}/roll_secret`
- [Send a test event](https://fiscalisto.com/en/docs/api/referencia/webhooks/test-webhook-endpoint.md): `POST /v1/webhook_endpoints/{id}/test`
- [List deliveries](https://fiscalisto.com/en/docs/api/referencia/webhooks/list-webhook-deliveries.md): `GET /v1/webhook_endpoints/{id}/deliveries`
- [Recover failed events](https://fiscalisto.com/en/docs/api/referencia/webhooks/recover-webhook-endpoint.md): `POST /v1/webhook_endpoints/{id}/recover`

## The WebhookEndpoint object

An address on your server that receives events.

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_). |
| `livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `object` | `"webhook_endpoint"` | yes | What kind of object it is («invoice», «customer»…). |
| `sandbox` | string or null | yes | The sandbox (sbx_…) it belongs to, or null if it belongs to the account. See /v1/sandboxes. |
| `url` | string | yes | https address on your server that receives the notices. |
| `description` | string or null | yes | What it is for, for you. |
| `events` | array of string | yes | Events you want to receive, or ["*"] for all (the default). The list with when each one arrives: [Event types](https://fiscalisto.com/en/docs/api/webhooks#tipos-de-evento). |
| `status` | `enabled`, `failing`, `disabled` | yes | enabled: delivering. failing: its deliveries fail (it turns off after 5 days like that). disabled: off. |
| `disabled_reason` | string or null |  | Why it turned off: failing (its deliveries failed 5 days in a row), gone (your server answered 410 Gone) or manual (you turned it off). |
| `failing_since` | string (date-time) or null |  | Since when deliveries have been failing, or null. |
| `previous_secret_expires_at` | string (date-time) or null | yes | Until when the previous secret also signs (after rotating it), or null. |
| `api_version` | string or null | yes | The API version of its events; null: the account's. |
| `created_at` | string (date-time) or null | yes | When it was created, ISO 8601 with Mexico City time (-06:00). |
| `secret` | string |  | Signing secret (whsec_…). It only comes when it is created or rotated: save it to verify signatures. |

Example:

```json
{
  "id": "whe_0q1Vmmw52sbDpmtsKD1E",
  "object": "webhook_endpoint",
  "livemode": false,
  "sandbox": null,
  "url": "https://mi-plataforma.mx/webhooks/fiscalisto",
  "description": null,
  "events": [
    "invoice.stamped"
  ],
  "status": "enabled",
  "disabled_reason": null,
  "failing_since": null,
  "previous_secret_expires_at": null,
  "api_version": null,
  "created_at": "2026-10-24T10:15:42-06:00",
  "secret": "whsec_MfKQ9r7Cq1ZzR0nN3xY2bW8eT5uV6sA4"
}
```

## The WebhookTest object

A test event sent to your webhook, and what your server answered.

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"webhook_test"` | yes | What kind of object it is («invoice», «customer»…). |
| `event` | object | yes | Something that happened in your account: the whole object as it ended up. It is sent to your webhooks signed (Standard Webhooks). |
| `event.id` | string | yes | Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_). |
| `event.object` | `"event"` | yes | What kind of object it is («invoice», «customer»…). |
| `event.type` | string | yes | What happened: invoice.stamped, invoice.failed, invoice.canceled, invoice.cancellation_pending, invoice.cancellation_rejected, invoice.cancellation_failed, invoice.paid, invoice.partially_paid, retention.stamped, retention.failed, retention.canceled, invoice_batch.completed, payroll_batch.completed, customer_data_request.completed, sat_download.completed, sat_download.failed, sat_declaration.created, sat_declaration.updated, sat_refresh.completed, sat_refresh.failed, ticket.invoiced, ticket.included_in_global, recurring_invoice.failed, quote.viewed, quote.accepted, quote.changes_requested, quote.rejected, quote.withdrawn, sales_order.confirmed, sales_order.customer_confirmed, sales_order.delivered, sales_order.paid, sales_order.canceled, supplier_invoice.received, supplier_invoice.approved, supplier_invoice.rejected, supplier_invoice.scheduled, supplier_invoice.paid, portal_supplier.approved, payout.approved, payout.paid, payout.partially_paid, payout.failed, payout.canceled, payout_transfer.succeeded, payout_transfer.failed, payout_transfer.returned, issuer.ready, balance.low, usage.high, test_clock.ready or rule.matched. |
| `event.api_version` | string | yes | The API version the object was built with. |
| `event.livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `event.created_at` | string (date-time) | yes | When it was created, ISO 8601 with Mexico City time (-06:00). |
| `event.data` | object | yes | What changed, in data.object: the whole receipt (or batch), as its GET returns it. |
| `event.data.object` | object | yes | The object as it ended up: an invoice, a certificate or a batch. |
| `delivery` | object | yes | How it went: ok if it answered 2xx, the code, the error and the start of its response. |
| `delivery.ok` | boolean | yes | true if your server answered 2xx. |
| `delivery.status` | integer or null | yes | The HTTP code it answered; null if it couldn't connect. |
| `delivery.error` | string or null | yes | What failed (no response, couldn't connect, another code), or null. |
| `delivery.response_body` | string or null | yes | The start of what your server answered (up to 2,000 characters). |
| `delivery.duration_ms` | integer | yes | How long your server took, in milliseconds. (from -9007199254740991 to 9007199254740991) |

Example:

```json
{
  "object": "webhook_test",
  "event": {
    "id": "evt_0PKhIdhYuAGwzmMQYfkc",
    "object": "event",
    "type": "invoice.stamped",
    "api_version": "2026-10-24",
    "livemode": false,
    "created_at": "2026-10-24T10:15:42-06:00",
    "data": {
      "object": {
        "id": "inv_OufpKqnrvx9p28SINJVjjWKYRhojBTJb8P",
        "object": "invoice",
        "livemode": false,
        "issuer": "iss_OufpKqnrvx9p",
        "branch": null,
        "cost_center": null,
        "type": "I",
        "status": "valid",
        "uuid": "5F1E8C2A-3B7D-4C9E-A1B2-C3D4E5F60718",
        "series": null,
        "folio": "1",
        "date": "2026-10-24T10:15:42",
        "customer": {
          "tax_id": "ICV060329BY0",
          "legal_name": "INMOBILIARIA CVA",
          "tax_system": "601",
          "zip": "33826"
        },
        "use": "G03",
        "payment_form": "03",
        "payment_method": "PUE",
        "currency": "MXN",
        "exchange_rate": null,
        "items": [
          {
            "description": "Consultoría",
            "product_key": "80101500",
            "unit_key": "E48",
            "unit_name": "Unidad de servicio",
            "quantity": 1,
            "unit_price": 1000,
            "taxability": "02",
            "iva": "0.16"
          }
        ],
        "subtotal": 1000,
        "discount": 0,
        "taxes": {
          "iva": 160,
          "ieps": 0,
          "iva_withheld": 0,
          "isr_withheld": 0,
          "local_transferred": 0,
          "local_withheld": 0
        },
        "total": 1160,
        "payment_status": "paid",
        "amount_due": 0,
        "amount_paid": 1160,
        "related": null,
        "cancellation": null,
        "email": null,
        "error": null,
        "recurring_invoice": null,
        "tickets": [],
        "origin": {
          "type": "api",
          "name": "Tienda en línea"
        },
        "created_at": "2026-10-24T10:15:42-06:00",
        "metadata": {}
      }
    }
  },
  "delivery": {
    "ok": true,
    "status": 200,
    "error": null,
    "response_body": "{\"received\":true}",
    "duration_ms": 182
  }
}
```

## The WebhookDelivery object

What happened with an event on a webhook: its last attempt, how many it has had and when the next one goes.

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"webhook_delivery"` | yes | What kind of object it is («invoice», «customer»…). |
| `id` | string | yes | The last attempt (whd_…). Use it in starting_after for the next page. |
| `webhook_endpoint` | string | yes | The webhook (whe_…). |
| `event` | string | yes | The event (evt_…). Resend it with POST /v1/events/{id}/resend. |
| `event_type` | string or null | yes | The event type (invoice.stamped…). |
| `succeeded` | boolean | yes | true if your server answered 2xx on the last attempt. |
| `status` | integer or null | yes | The HTTP code your server answered; null if it couldn't connect. |
| `error` | string or null | yes | What failed (timeout, DNS, or the start of its response); null if it arrived. |
| `duration_ms` | integer | yes | How long your server took to answer the last attempt. (from -9007199254740991 to 9007199254740991) |
| `attempts` | integer | yes | How many times it has been sent to this webhook, resends included. (from -9007199254740991 to 9007199254740991) |
| `resent` | boolean | yes | true if the last attempt was a resend (POST /v1/events/{id}/resend). |
| `test` | boolean | yes | true if it is a test event (POST /v1/webhook_endpoints/{id}/test); it isn't retried. |
| `created_at` | string (date-time) | yes | When the last attempt was. |
| `next_retry_at` | string (date-time) or null | yes | When the next automatic retry goes; null if it arrived or there are no more. |

Example:

```json
{
  "object": "webhook_delivery",
  "id": "whd_48213",
  "webhook_endpoint": "whe_0q1Vmmw52sbDpmtsKD1E",
  "event": "evt_0PKhIdhYuAGwzmMQYfkc",
  "event_type": "invoice.stamped",
  "succeeded": false,
  "status": 503,
  "error": "Respondió 503.",
  "duration_ms": 1840,
  "attempts": 3,
  "resent": false,
  "test": false,
  "created_at": "2026-11-14T10:40:12-06:00",
  "next_retry_at": "2026-11-14T12:40:12-06:00"
}
```

## The WebhookRecovery object

The events a webhook didn't receive, sent again: since when they were looked for, how many went out and, if more than 1,000 were left, where to continue from.

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"webhook_recovery"` | yes | What kind of object it is («invoice», «customer»…). |
| `endpoint` | string | yes | The webhook (whe_…) they were sent to. |
| `since` | string | yes | Since when they were looked for: the `since` you sent, or when the webhook was created if that's later. |
| `events` | integer | yes | How many events went out again. 0: none were missing. (from -9007199254740991 to 9007199254740991) |
| `next_since` | string or null | yes | If more than 1,000 were left: call again with this `since`. null: all of them went out. |

Example:

```json
{
  "object": "webhook_recovery",
  "endpoint": "whe_8Kq2ZtR4mNw1Lp0sXc7V",
  "since": "2026-11-20T09:00:00-06:00",
  "events": 42,
  "next_since": null
}
```
