Skip to main content

What is Invoice Numbering?

Invoice Numbering is a global setting that teaches AffZero your invoice number format and keeps track of where you are in the sequence. Once configured, the {invoice_number_global} variable is generated automatically inside every Create Invoice step — no separate numbering step needed. Go to Invoices → Invoice Numbering to set it up.

Global vs Local Sequences

AffZero supports two invoice numbering approaches. You can use both in the same automation.
Global sequenceLocal sequence
Variable name{invoice_number_global}{invoice_number_local} (default, customisable)
Configured inInvoices → Invoice NumberingGenerate Invoice Number step
ScopeShared across all automationsOne automation only
When generatedInside the Create Invoice step, when it runsInside the Generate Invoice Number step, when it runs
Available in panelAfter a Create Invoice stepAfter a Generate Invoice Number step
Use the global sequence when all your automations should share one continuous series (e.g. all affiliate invoices follow #00133 → #00134 → …). Use a local sequence when a specific automation needs its own numbering that is independent from everything else — for example, a separate series for advertiser billing.

Why Global Instead of Per-Automation?

Previously, invoice numbering had to be configured inside each automation as a dedicated Generate Invoice Number step. This meant:
  • Duplicating the same configuration across multiple automations
  • Risk of two automations generating the same number if they ran at the same time
  • No single place to see your current sequence position
The global sequence solves all of this. Configure it once under Invoices → Invoice Numbering, and every automation that runs a Create Invoice step picks up the next number automatically.

How to Configure the Sequence

Step 1 — Enter examples

Paste 2–4 of your most recent invoice numbers. AffZero uses these to understand your format. Examples by format:
Your formatPaste examples like
Simple sequentialINV-045, INV-046, INV-047
Year + sequenceINV-2026-001, INV-2026-002
Year + zero-padded2026-0045, 2026-0046
Custom prefixACME/2026/0010, ACME/2026/0011

Step 2 — Optional: Add a pattern description

Describe your numbering rules in plain English, especially for formats with year resets or unusual sequences:
Year followed by a 4-digit zero-padded sequence.
Resets to 0001 on January 1st each year.

Step 3 — Optional: Add a regex

If your invoice numbers must match a strict format, enter a regex the AI must satisfy:
INV-\d{4}-\d{3}

Step 4 — Preview

Click Generate Preview to see what the next invoice number would be based on your examples. Verify it’s correct before saving.

Step 5 — Save

Click Save. AffZero stores your sequence configuration and pre-computes the next number.

How It Works at Runtime

When an automation runs a Create Invoice step, AffZero:
  1. Reads your saved sequence configuration
  2. Generates the next number in the series — deterministically for common patterns, or via AI for complex ones
  3. Injects it as {invoice_number_global} into the automation’s variable context
  4. Updates the Last Used Number so the next Create Invoice run advances the sequence
{invoice_number_global} is then available in any step that comes after the Create Invoice step — Send Email, Condition Check, Write to Google Sheets, etc.
The sequence only advances when a Create Invoice step actually executes. Automations without a Create Invoice step (e.g. stats-only or email-only workflows) never consume a sequence number.

Updating After a Manual Invoice

If you manually created an invoice outside AffZero (or a run failed and you issued the number manually), update the sequence so it doesn’t repeat that number.
  1. Go to Invoices → Invoice Numbering
  2. Click Edit Last Used Number
  3. Enter the number you issued manually
  4. Click Save
The next Create Invoice run will generate the number after the one you entered.

Viewing the Current Sequence Position

The Invoice Numbering page shows:
  • Last used number — the most recently issued invoice number
  • Next number preview — what the next automated invoice number will be
  • Your saved pattern examples and description

Using {invoice_number_global} in Automations

The variable is generated by the Create Invoice step — you don’t need to add a separate numbering step. Use {invoice_number_global} in any step that runs after Create Invoice:
  • Create Invoice step filename: Invoice_{affiliate_name_1_stats_1}_{invoice_number_global}
  • Create Invoice template HTML: <p>Invoice #: {invoice_number_global}</p>
  • Send Email subject: Invoice {invoice_number_global} for {affiliate_name_1_stats_1}
  • Write to Google Sheets column
  • Any other variable-consuming field
If you need a second invoice sequence (e.g. one for affiliates and one for advertisers), add a Generate Invoice Number step to the automation that needs it. That step writes its result to {invoice_number_local} (or a custom name you choose), completely independent from {invoice_number_global}.

AI Calls

For most invoice formats, AffZero uses a deterministic algorithm to compute the next number — no AI call required. AI is only used for complex or irregular patterns that cannot be predicted algorithmically. Check your usage on Settings → Usage.