# Send a test event

`POST https://api.fiscalisto.com/v1/webhook_endpoints/{id}/test`

Sends now, only once and without retries, an event of the type you choose with a sample object (its ids don't exist), signed like the real ones, even if the webhook doesn't listen for that type. The response carries what your server answered. The event doesn't show in GET /v1/events, but it does in the webhook's deliveries.

## Before you call

- **A key for the whole account**: not limited to some issuers or to a test environment.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | The object's id. |
| `Idempotency-Key` | header |  | Optional (the SDKs send it on their own). If the response is lost, repeat the request with the same value within 24 hours: it answers the same, with idempotent-replayed: true, and doesn't do it twice (it doesn't create, send emails or charge). |

## Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `invoice.stamped`, `invoice.failed`, `invoice.canceled`, `invoice.cancellation_pending`, `invoice.cancellation_rejected`, `invoice.cancellation_failed`, `invoice.paid`, `invoice.partially_paid`, `invoice.email_bounced`, `invoice.email_complained`, `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`, `rule.matched` |  | The event to send. invoice.stamped by default. (default "invoice.stamped") |

Example:

```json
{
  "type": "invoice.failed"
}
```

## With the TypeScript SDK

```ts
import { Fiscalisto } from "fiscalisto";

// La llave viene de FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const webhookTest = await fiscalisto.webhookEndpoints.test("id", { type: "invoice.failed" }, { idempotencyKey: "pedido-A-1042" });
```

## With the Python SDK

```python
from fiscalisto import Fiscalisto

# La llave viene de FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

webhook_test = fiscalisto.webhook_endpoints.test("id", {"type": "invoice.failed"}, idempotency_key="pedido-A-1042")
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$webhookTest = $fiscalisto->webhookEndpoints->test('id', ['type' => 'invoice.failed'], ['idempotency_key' => 'pedido-A-1042']);
```

## With the .NET SDK

```csharp
using Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var webhookTest = await fiscalisto.WebhookEndpoints.TestAsync("id", new TestWebhookEndpointParams { Type = "invoice.failed" }, new RequestOptions { IdempotencyKey = "pedido-A-1042" });
```

## With the Go SDK

```go
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// La llave viene de FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	webhookTest, err := client.WebhookEndpoints.Test(ctx, "id", &fiscalisto.TestWebhookEndpointParams{
		Type: fiscalisto.String("invoice.failed"),
	}, fiscalisto.WithIdempotencyKey("pedido-A-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *webhookTest)
}
```

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.TestWebhookEndpointParams;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var webhookTest = fiscalisto.webhookEndpoints().test("id", new TestWebhookEndpointParams().setType("invoice.failed"), RequestOptions.idempotencyKey("pedido-A-1042"));
System.out.println(webhookTest);
```

## Response 200

OK.

A `WebhookTest` object:

| 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) |

```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
  }
}
```

## Errors

- `key_restricted` (403): This key is limited to some issuers and the request touches another one (or creates one, or uses something of the whole account, like webhooks).
- `resource_missing` (404): There's no object with that id (or it belongs to another issuer or the other mode).

Plus those of any call (key, fields, limits): https://fiscalisto.com/en/docs/api/errores.md.
