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-sequencesWith a JSON body (example):
{
"name": "SequenceName",
"format": "Sez1-%s",
"number": 1
}- name : Unique sequence identifier
- format : Template for invoice numbers (use "%s" as a placeholder for the number)
- number : Initial number
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:
-
%ssimple number (1, 2, 3, ...) -
%0Xszero-padded number (e.g.,%04sfor 0001, 0002, ...).Xmust be a number between 1 and 9.
Additional placeholders can be used:
-
%Yyear (e.g., 2025) -
%ytwo-digit year (e.g., 25 for 2025)