Skip to main content

Simulate invoices massive download

In the sandbox environment the invoices massive download does not reach the "Cassetto Fiscale": you can simulate it with POST /simulate/jobs/invoice-download, which takes the same payload as POST /jobs/invoice-download.

The simulation runs straight away, inside the request:

  • it imports 10 made-up invoices for the company, 5 issued (customer invoices) and 5 received (supplier invoices), dated within the requested period and valid against the FatturaPA schema;
  • it creates a job that you can read with GET /jobs, already in status completed;
  • it sends the usual job webhook to your configured endpoints.

The "Cassetto Fiscale" credentials and the download subscription are not needed.

Example:

curl -X POST
https://api-sandbox.acubeapi.com/simulate/jobs/invoice-download
-H 'Authorization: Bearer <Your Bearer token here>'
-H 'Content-Type: application/json'
-d '{
"from_date": "2026-03-01",
"to_date": "2026-03-31",
"fiscal_id": "12345678901"
}'

The API returns a 201 Created response with the job and the imported invoices:

{
"job": "0199f3a2-7c1e-7a4b-9d2e-3f5a6b7c8d9e",
"invoices": [
"0199f3a2-7c20-7e11-8a3b-1c2d3e4f5a6b",
"..."
]
}

The imported invoices are available through GET /invoices like any downloaded invoice.

Validation​

The payload is validated as in POST /jobs/invoice-download:

  • from_date cannot be earlier than the 1st of January of the previous year, and to_date cannot be later than today;
  • scheduled_at is optional and cannot be in the past. It is saved on the job, but the simulation runs immediately anyway;
  • fiscal_id must belong to a Business Registry Configuration of your account;
  • from_date, to_date and fiscal_id are required, and to_date cannot be earlier than from_date.

An invalid payload returns a 400 Bad Request response listing the offending fields in violations.

Simulate a failed download​

POST /simulate/jobs/invoice-download/error takes the same payload, imports no invoice and creates the job in status error. Your endpoints receive the job-error webhook. The response contains only the job:

{
"job": "0199f3a2-7c1e-7a4b-9d2e-3f5a6b7c8d9e"
}

Simulate without a payload​

POST /simulate/invoice-download/{fiscal_id} and POST /simulate/invoice-download/{fiscal_id}/error run the same simulation without a body, over the period from the 1st of January of the previous year to today.