Skip to main content

Automatic Numbering for Invoices

Use the NumberingSequence API to assign invoice numbers automatically in A-Cube.

Step 1: Create a Numbering Sequence​

Define sequences that specify the format and number series for invoices.

Creating a NumberingSequence​

Send a POST request:

POST /numbering-sequences

With a JSON body (example):

{
"name": "SequenceName",
"format": "Sez1-%s",
"number": 0
}
  • name: Unique sequence identifier
  • format: Template for invoice numbers (use "%s" as a placeholder for the number)
  • number: Last number used. Set N to have the next invoice numbered N+1 (e.g., set 0 for starting at 1)

The API returns a resource with a UUID that identifies the sequence. For details, see the NumberingSequence API.

Step 2: Use Numbering Sequences in Invoices​

Insert the placeholder in your invoice:

getNumero(<name>)

Example JSON:

{
// other fields in the invoice
"dati_generali_documento": {
"data": "2021-01-01",
"numero": "getNumero(SequenceName)",
...
}
}

or XML:

// other fields in the invoice
<DatiGeneraliDocumento>
<Data>2021-01-01</Data>
<Numero>getNumero(SequenceName)</Numero>
...

When you create an invoice, A-Cube replaces the placeholder with the next number: "Sez1-1", "Sez1-2", etc.

Notes​

Some important notes to consider when using the automatic numbering feature:

  • Counter increments automatically for every invoice successfully sent
  • Counter resets to 1 at the start of the year
  • If you were using a sequence for the past year, when the first invoice of the new year is sent, the new sequence will be created automatically

Formats​

Exactly one of the following placeholders is required:

  • %s simple number (1, 2, 3, ...)
  • %0Xs zero-padded number (e.g., %04s for 0001, 0002, ...). X must be a number between 1 and 9.

Additional placeholders can be used:

  • %Y year (e.g., 2025)
  • %y two-digit year (e.g., 25 for 2025)