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": "FV-%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:

autoincrement(<sequence_name>)

Alternatively, you can use the placeholder: autoNumeracja(<sequence_name>):

autoNumeracja(<sequence_name>)

Example​

JSON:

{
// other fields in the invoice
"P_1": "2026-01-01",
"P_2": "autoincrement(SequenceName)",
...
}

or XML:

<!-- other fields in the invoice -->
<P_1>2026-01-01</P_1>
<P_2>autoincrement(SequenceName)</P_2>
...

When you create an invoice, A-Cube replaces the placeholder with the next number: "FV-1", "FV-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 for 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., 2026)
  • %y two-digit year (e.g., 26 for 2026)