Complyance Logo

Get invoice counts

Returns the number of valid sales invoices for companies managed by the authenticated ISV workspace. The response includes a count for each company and the combined total.

Endpoint

GET /v3/connect/invoices/counts

Base URL

All requests use the Complyance API base URL:

https://prod.gets.complyance.io

There is no separate sandbox hostname. Select the data environment with the X-Environment header: sandbox for test data, or production (the default) for live data.

Authentication

Send your API key in the X-API-Key header.

Keep API keys secret. Do not include a real API key in documentation, client-side code, or source control.

Request headers

HeaderRequiredDescription
X-API-KeyYesAPI key for an ISV partner workspace.
X-EnvironmentNoData environment. Use sandbox or production. Defaults to production.
AcceptNoSet to application/json.

Query parameters

ParameterTypeRequiredDescription
countryCodestringYesTwo-letter country code. Supported values: AE, SA, MY, BE, and DE.
companyIdstringNoReturns the count for one managed company. When omitted, all managed companies for the country are returned.
fromstringNoStart date in YYYY-MM-DD format, inclusive. Must be provided together with to.
tostringNoEnd date in YYYY-MM-DD format, inclusive. Must be provided together with from.

When from and to are both omitted, the endpoint returns all-time counts.

The date range filters on each invoice's latest processing update date (updatedAt, falling back to createdAt when the invoice has no processing updates), not the invoice issue date.

Example: all-time counts

Replace {API_KEY} with an API key for your account.

curl --location 'https://prod.gets.complyance.io/v3/connect/invoices/counts?countryCode=AE' \
  --header 'X-API-Key: {API_KEY}' \
  --header 'X-Environment: sandbox' \
  --header 'Accept: application/json'

Example: counts within a date range

curl --get 'https://prod.gets.complyance.io/v3/connect/invoices/counts' \
  --header 'X-API-Key: {API_KEY}' \
  --header 'X-Environment: sandbox' \
  --header 'Accept: application/json' \
  --data-urlencode 'countryCode=AE' \
  --data-urlencode 'from=2026-07-01' \
  --data-urlencode 'to=2026-07-31'

Example: one company

curl --get 'https://prod.gets.complyance.io/v3/connect/invoices/counts' \
  --header 'X-API-Key: {API_KEY}' \
  --header 'X-Environment: sandbox' \
  --header 'Accept: application/json' \
  --data-urlencode 'countryCode=AE' \
  --data-urlencode 'companyId=company-1'

Successful response

{
  "success": true,
  "data": {
    "totalCount": 17,
    "clients": [
      {
        "clientId": "company-1",
        "count": 12
      },
      {
        "clientId": "company-2",
        "count": 5
      }
    ]
  },
  "meta": {
    "requestId": "01K1EXAMPLE000000000000000",
    "timestamp": "2026-08-12T10:00:00.000Z",
    "filters": {
      "countryCode": "AE",
      "environment": "sandbox"
    }
  }
}

The values in this example are illustrative.

Response fields

FieldTypeDescription
successbooleantrue when the request succeeds.
data.totalCountnumberSum of the counts returned in data.clients.
data.clientsarrayCounts for managed companies in the selected country.
data.clients[].clientIdstringComplyance company ID.
data.clients[].countnumberNumber of valid sales invoices attributed to the company.
meta.requestIdstringUnique request identifier for support and troubleshooting.
meta.timestampstringResponse timestamp in ISO 8601 format.
meta.filtersobjectNormalized filters applied to the request.

Managed companies with no matching valid invoices are included with a count of 0. Inactive companies remain included so their historical counts stay visible. If the workspace has no managed companies for the selected country, the endpoint returns:

{
  "success": true,
  "data": {
    "totalCount": 0,
    "clients": []
  },
  "meta": {
    "requestId": "01K1EXAMPLE000000000000000",
    "timestamp": "2026-08-12T10:00:00.000Z",
    "filters": {
      "countryCode": "AE",
      "environment": "sandbox"
    }
  }
}

Error response

Errors use the standard Connect API envelope:

{
  "success": false,
  "error": {
    "code": "CONNECT_INVALID_DATE_RANGE",
    "message": "from must be less than or equal to to."
  },
  "meta": {
    "requestId": "01K1EXAMPLE000000000000000",
    "timestamp": "2026-08-12T10:00:00.000Z"
  }
}

Error codes

HTTP statusCodeDescription
400CONNECT_VALIDATION_ERRORA required parameter is missing or malformed.
400CONNECT_INVALID_ENVIRONMENTX-Environment is not supported.
400CONNECT_UNSUPPORTED_COUNTRYInvoice counts are not supported for the requested country.
400CONNECT_DATE_RANGE_INCOMPLETEOnly one of from or to was supplied.
400CONNECT_INVALID_DATE_RANGEfrom is later than to.
401CONNECT_AUTH_CONTEXT_MISSINGThe API key did not provide a workspace context.
403CONNECT_ISV_ACCESS_DENIEDThe authenticated workspace cannot use Connect APIs.
403CONNECT_COMPANY_ACCESS_DENIEDThe requested company is not managed by the authenticated ISV.
429CONNECT_RATE_LIMIT_EXCEEDEDThe request rate limit was exceeded. Retry after the period in the response headers.
502CONNECT_CLIENT_LOOKUP_FAILEDManaged companies could not be resolved.
502CONNECT_TRANSACTION_COUNT_LOOKUP_FAILEDInvoice counts could not be retrieved.

Counting behavior

  • Only sales invoices resolved to the valid status are counted.
  • Purchase documents and non-valid invoices are excluded.
  • from and to filter on the invoice's latest processing update date (updatedAt, falling back to createdAt), not the invoice issue date.
  • Inactive companies remain included so their historical counts stay visible.
  • Results are scoped to the workspace associated with the API key.
  • companyId, when supplied, must belong to the authenticated ISV workspace.
  • Date boundaries are inclusive and evaluated using the selected country's local calendar date.

Rate limit

This endpoint allows up to 120 requests per minute for each workspace.