COUNTCOUNT
Sign Up
InvoicesGet the next invoice number

Get the next invoice number

GET/partners/invoices/generate/number

Returns the number COUNT would assign to the next invoice, estimate, or credit memo.

Numbering is tracked per document type, so pass `invoiceType` to number an estimate or credit memo rather than an invoice. The response carries `number` when the workspace numbers sequentially, or `lastNumber` when the most recent document used a non-numeric reference the API cannot increment — in that case pick the next reference yourself. The number is not reserved, so two calls before either invoice is created return the same value.

HMAC signature + Bearer access token
Try this request

Query parameters

invoiceTypeenumoptional

Which numbering sequence to read. Defaults to invoice.

One of: invoice, estimate, memo

Responses

200The next sequential number. `lastNumber` is returned instead when the latest number is non-numeric.
401Missing or invalid HMAC signature, expired timestamp, or invalid Bearer token. Troubleshoot
403The credential does not have access to this workspace or resource. Troubleshoot
429Rate limit exceeded (100 requests per minute per clientId). Retry after the Retry-After header. Troubleshoot
GEThttps://api.getcount.com/partners/invoices/generate/number
Request
import crypto from 'node:crypto';

const BASE_URL = 'https://api.getcount.com';
const CLIENT_ID = process.env.COUNT_CLIENT_ID;
const CLIENT_SECRET = process.env.COUNT_CLIENT_SECRET;
const ACCESS_TOKEN = process.env.COUNT_ACCESS_TOKEN;

const method = 'GET';
const signingPath = '/invoices/generate/number';
const timestamp = Math.floor(Date.now() / 1000).toString();
const bodyString = '';

const bodyHash = '';
const baseString = `${method}:${signingPath}:${timestamp}:${bodyHash}`;
const signature = crypto.createHmac('sha256', CLIENT_SECRET).update(baseString).digest('hex');

const response = await fetch(`${BASE_URL}/partners/invoices/generate/number`, {
  method,
  headers: {
    'x-client-id': CLIENT_ID,
    'x-timestamp': timestamp,
    'x-signature': signature,
    Authorization: `Bearer ${ACCESS_TOKEN}`,
  },
});

console.log(await response.json());
Response · 200
{
  "status": "Success",
  "message": "Success on generating invoice number",
  "data": {
    "result": {
      "number": 1043
    }
  }
}