# Sandbox (https://docs.getbeel.com/en/api/sandbox)

Test keys send to an SDI simulated by getbeel. Here is how to trigger every outcome.

With a test key (`gb_test_…`), `POST /invoices/{id}/send` contacts neither SDI nor the transmission channel: getbeel generates and validates the XML as for a real send, gives it a simulated 12-digit SDI identifier and a file name, and a few seconds later applies an outcome with the matching [webhooks](/en/api/webhooks). The sandbox is free and uses no SDI quota; only the [rate limit](/en/api/rate-limits) applies.

## How to trigger each outcome [#how-to-trigger-each-outcome]

The outcome depends on the customer data, checked in this order:

| Outcome       | How to trigger it                                                                   | Status          | `sdi`                                                                          | Webhook                 |
| ------------- | ----------------------------------------------------------------------------------- | --------------- | ------------------------------------------------------------------------------ | ----------------------- |
| Rejected      | Customer partita IVA `00000000000` (with or without a leading `IT`, spaces ignored) | `rejected`      | `error_codes: ["00305"]`, `errors: [{ "code": "00305", "description": null }]` | `invoice.rejected`      |
| Not delivered | Codice destinatario `MC00000` (any case) and any other partita IVA                  | `not_delivered` | `available_since: null`                                                        | `invoice.not_delivered` |
| Delivered     | Any other valid invoice                                                             | `delivered`     | —                                                                              | `invoice.delivered`     |

- The send answers `200` with `status: "sent"` and the `invoice.sent` webhook. The outcome follows about 3 seconds later; if it ever does not, a periodic job applies it within a few minutes. Read the invoice again with `GET /invoices/{id}`.
- **The simulated rejection uses code `00305`** (IdCodice of the cessionario not valid), with the message `00305 1.4.1.1.2 <IdCodice> non valido (sandbox: partita IVA 00000000000 is always rejected)`, and the invoice goes to `rejected` like a real rejection. `00404` is not simulated: on an invoice already sent it means it is **already issued**, see [SDI lifecycle](/en/api/sdi-lifecycle#duplicate-of-an-issued-invoice-00404-on-a-sent-invoice).
- **The simulated non-delivery has no date**: `sdi.available_since` is `null`. In real life an MC carries the date the invoice was made available in the cassetto fiscale; your code must handle both.
- An invoice that fails local validation is not sent: the request answers `422 invoice_invalid` and the invoice stays a draft.
- A rejected test invoice is reopened like a live one: `POST /invoices/{id}/reopen`, correct it with `PATCH /invoices/{id}` (for example a real partita IVA instead of `00000000000`) and send it again.

## Test and live compared [#test-and-live-compared]

|              | Test (`gb_test_`)            | Live (`gb_live_`)                                       |
| ------------ | ---------------------------- | ------------------------------------------------------- |
| Endpoints    | The same                     | The same                                                |
| Sending      | SDI simulated by getbeel     | Real SDI, through an accredited transmission provider   |
| Response     | `200`, `sent`                | `202`, `sending`                                        |
| Outcome      | Decided by the customer data | Decided by SDI, minutes up to 5 days                    |
| Legal effect | None                         | The invoice is issued (when delivered or not delivered) |
| Cost         | Free, no quota               | Per the [rate card](/en/api/pricing)                    |

## The transmission channel's sandbox [#the-transmission-channels-sandbox]

This is something else: the test environment of the transmission provider (openapi.com) that getbeel uses internally to test the channel. **A getbeel test key never reaches it.** We describe it because it explains which outcomes getbeel could test against a real channel (tested on 9 November 2026):

- outgoing invoices and autofatture go to SENT, then DONE/DELIVERED a few minutes apart, even with codice destinatario `0000000`;
- it never produces an MC: openapi.com documents a simulation only for incoming invoices (`POST /IT-invoices_supplier_simulate`, Invoice API 1.8.7);
- it has no duplicate check: the same file sent twice is delivered twice, so `00404` never comes from there.

That is why MC and `00404` are tested by replaying recorded receipts into getbeel's webhook.

## Test received invoices [#test-received-invoices]

`POST /sandbox/inbound-invoices` receives an invoice as if it came from SDI (your XML or a sample addressed to your company): it shows in `GET /received-invoices` with the test key (`source: "sdi"`) and sends `received_invoice.created` to test endpoints. See [Receiving from SDI](/en/api/sdi-receiving#sandbox).
