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
peppolIdNoBuyer Peppol participant ID, including its scheme, such as 0235:100000000000003. Applies to both sales and purchase documents.
sourceNoExact source name, such as acme-erp
versionNoExact source version, such as 1.0.0; can be used with or without source
documentTypeNosales or purchase; omit for both. purchase is singular here, while the documents API takes type=purchases.
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. All supplied filters must match. Source names and versions are case-sensitive. A source name without a version includes all its versions; a version without a source name includes all sources with that version.

Use source and version for source filtering. Other source and branch parameters 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'
Count one company's purchases by buyer and sourcebash
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 'companyId=66b9f0a1c2d3e4f567890123' \
  --data-urlencode 'documentType=purchase' \
  --data-urlencode 'peppolId=0235:100000000000003' \
  --data-urlencode 'source=acme-erp' \
  --data-urlencode 'version=1.0.0'

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 September date-range request:

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,
      "peppolId": null,
      "source": null,
      "version": 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_VALIDATION_ERRORUse a Peppol ID with its scheme and identifier. Do not send blank source or version values or unsupported filters.
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