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/countsBase URL
All requests use the Complyance API base URL:
https://prod.gets.complyance.ioThere 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
| Header | Required | Description |
|---|---|---|
X-API-Key | Yes | API key for an ISV partner workspace. |
X-Environment | No | Data environment. Use sandbox or production. Defaults to production. |
Accept | No | Set to application/json. |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
countryCode | string | Yes | Two-letter country code. Supported values: AE, SA, MY, BE, and DE. |
companyId | string | No | Returns the count for one managed company. When omitted, all managed companies for the country are returned. |
from | string | No | Start date in YYYY-MM-DD format, inclusive. Must be provided together with to. |
to | string | No | End 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
| Field | Type | Description |
|---|---|---|
success | boolean | true when the request succeeds. |
data.totalCount | number | Sum of the counts returned in data.clients. |
data.clients | array | Counts for managed companies in the selected country. |
data.clients[].clientId | string | Complyance company ID. |
data.clients[].count | number | Number of valid sales invoices attributed to the company. |
meta.requestId | string | Unique request identifier for support and troubleshooting. |
meta.timestamp | string | Response timestamp in ISO 8601 format. |
meta.filters | object | Normalized 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 status | Code | Description |
|---|---|---|
400 | CONNECT_VALIDATION_ERROR | A required parameter is missing or malformed. |
400 | CONNECT_INVALID_ENVIRONMENT | X-Environment is not supported. |
400 | CONNECT_UNSUPPORTED_COUNTRY | Invoice counts are not supported for the requested country. |
400 | CONNECT_DATE_RANGE_INCOMPLETE | Only one of from or to was supplied. |
400 | CONNECT_INVALID_DATE_RANGE | from is later than to. |
401 | CONNECT_AUTH_CONTEXT_MISSING | The API key did not provide a workspace context. |
403 | CONNECT_ISV_ACCESS_DENIED | The authenticated workspace cannot use Connect APIs. |
403 | CONNECT_COMPANY_ACCESS_DENIED | The requested company is not managed by the authenticated ISV. |
429 | CONNECT_RATE_LIMIT_EXCEEDED | The request rate limit was exceeded. Retry after the period in the response headers. |
502 | CONNECT_CLIENT_LOOKUP_FAILED | Managed companies could not be resolved. |
502 | CONNECT_TRANSACTION_COUNT_LOOKUP_FAILED | Invoice 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.
fromandtofilter on the invoice's latest processing update date (updatedAt, falling back tocreatedAt), 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.