Document counts

Return valid sales and purchase document counts by company, country, environment and date range.

Endpoint

http
GET https://prod.gets.complyance.io/v3/connect/invoices/counts

Authentication

Send X-API-Key. Send X-Environment: sandbox or X-Environment: production explicitly; the default is production. simulation is not accepted.

Parameters

QueryRequiredDescription
countryCodeYesAE, SA, MY, BE or DE
companyIdNoReturned company identifier; omit to include all managed companies in the country
documentTypeNosales or purchase; omit for both
fromWith toInclusive start date, YYYY-MM-DD
toWith fromInclusive end date, YYYY-MM-DD

Dates use the country’s local calendar days and the document’s latest processing update, not its invoice issue date. Omit both dates for all-time counts. These counts support usage reporting; they are not an immutable billing ledger.

The endpoint counts valid documents. Source and branch filters are not accepted: sending sourceName, sourceVersion, sourceId, branchId or transactionType returns 400. Use data.companyId from onboarding or data[].companyId from company listing.

Count sandbox documents for Septemberbash
curl --get 'https://prod.gets.complyance.io/v3/connect/invoices/counts' \
  --header "X-API-Key: ${COMPLYANCE_API_KEY}" \
  --header 'X-Environment: sandbox' \
  --data-urlencode 'countryCode=AE' \
  --data-urlencode 'from=2026-09-01' \
  --data-urlencode 'to=2026-09-30'

Response

HTTP 200 returns success: true, data and meta. data contains salesCount, purchaseCount and totalCount. data.companies[] contains per-company counts. When you set documentType, only that count is returned: salesCount for sales, purchaseCount for purchase, both overall and per company. Companies with no matching documents have zero counts; historical counts remain relevant for inactive companies.

meta includes the request identifier, timestamp and applied filters. An omitted filter is represented by null.

Example counts for the request above:

Document counts — HTTP 200json
{
  "success": true,
  "data": {
    "totalCount": 25,
    "salesCount": 17,
    "purchaseCount": 8,
    "companies": [
      {
        "companyId": "66b9f0a1c2d3e4f567890123",
        "totalCount": 20,
        "salesCount": 14,
        "purchaseCount": 6
      },
      {
        "companyId": "66b9f0a1c2d3e4f567890456",
        "totalCount": 5,
        "salesCount": 3,
        "purchaseCount": 2
      }
    ]
  },
  "meta": {
    "requestId": "01K1EXAMPLE000000000000000",
    "timestamp": "2026-09-22T10:00:00.000Z",
    "filters": {
      "countryCode": "AE",
      "environment": "sandbox",
      "companyId": null,
      "documentType": null,
      "from": "2026-09-01",
      "to": "2026-09-30"
    }
  }
}

Errors

CodeCorrection
CONNECT_UNSUPPORTED_COUNTRYUse one of the supported country codes
CONNECT_INVALID_ENVIRONMENTSend sandbox or production
CONNECT_INVALID_DOCUMENT_TYPESend lowercase sales or singular purchase
CONNECT_DATE_RANGE_INCOMPLETESupply both dates or neither
CONNECT_INVALID_DATE_RANGEEnsure from is not later than to
CONNECT_COMPANY_ACCESS_DENIEDUse a company managed by this workspace in this country
CONNECT_RATE_LIMIT_EXCEEDEDRespect Retry-After; the limit is 120 requests per workspace per minute

See Connect errors for authentication and temporary failures.

Last updated