> For the complete documentation index, see [llms.txt](https://docs.tsgglobal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tsgglobal.com/api-reference/reports/cdr-records/get-count-of-cdr-records.md).

# Get Count of CDR Records

How to count CDR records for a period using the cdrRecords GraphQL query.

## Overview

Get the total number of CDR records between a start and end datetime.

## Authentication

{% hint style="info" %}
This function is available via our GraphQL API. You can read more about how to authenticate to this API in [GraphQL API & Authentication](/graphql-api-and-authentication.md).
{% endhint %}

## Method

The GraphQL API does not expose a separate count field. To count records for a period, run the `cdrRecords` query described in [Get CDR Records](/api-reference/reports/cdr-records/get-cdr-records.md) with the maximum page size and follow `paginationInfo.nextCursor` until it is `null`, summing the length of `cdrs` on each page. For very large periods, generate the `exportLink` instead and count the rows of the CSV.

```graphql
query($type: CdrType!, $startDatetime: DateTime!, $endDatetime: DateTime!, $limit: Int, $cursor: String) {
  cdrRecords(type: $type, startDatetime: $startDatetime, endDatetime: $endDatetime, limit: $limit, cursor: $cursor) {
    paginationInfo {
      limit
      nextCursor
    }
    cdrs {
      __typename
    }
  }
}
```

```json
{
  "type": "SMS",
  "startDatetime": "2026-09-01T00:00:00.000Z",
  "endDatetime": "2026-09-02T00:00:00.000Z",
  "limit": 1000
}
```
