Document Numbering
Set the initial (starting) number for a document type's numbering series — for example, to continue numbering from a previous system. Changing the starting number creates a new counter; the most recent counter always wins.
Use cases: Set a company's first invoice number when migrating them from another product.
POST
/counters/createSet the starting number for a document type. This can only be done before any activity for that document type in the current calendar year (see notes).
Year guard: the starting number can only be set while there has been no activity for this document type in the current calendar year. Once a document of that type has been issued this year — or a counter for it was created this year — the request is rejected with 400 COUNTER_CANNOT_BE_CREATED. Use GET /counters/ to view the current-year counters.
Body Parameters
| Name | Type | Description | |
|---|---|---|---|
documentType | string | required | The document type. One of "QUOTATION", "ORDER", "DELIVERY", "RETURN", "INVOICE", "INVOICE_RECEIPT", "REFUND", "BILL", "RECEIPT", "PURCHASE_ORDER", "PURCHASE_RECEIPT", "SUPPLIER_INVOICE". |
count | number | The starting number (integer > 0). Defaults to 1. | |
paddingLength | number | Zero-pad the number to this width (integer ≥ 0). | |
prefix | string | A prefix prepended to the number. |
Request
curl -X POST "https://api.glance.co.il/counters/create" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"documentType": "example_documentType",
"count": 0,
"paddingLength": 0,
"prefix": "example_prefix"
}'Response
Response
{
"success": true,
"counter": {
"id": 10,
"documentType": "INVOICE",
"companyId": 123,
"count": 1000,
"documentsCount": 0,
"paddingLength": 4,
"prefix": null
}
}