TSGGLOBAL Support sign in
Skip to page content
Browse TSG Global API docs

TSG Global API documentation Reports CDR Records Get Count of CDR Records

Get Count of CDR Records

On this page

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

This function is available via our GraphQL API. You can read more about how to authenticate to this API in GraphQL API & Authentication.

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 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.

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
    }
  }
}
{
  "type": "SMS",
  "startDatetime": "2026-09-01T00:00:00.000Z",
  "endDatetime": "2026-09-02T00:00:00.000Z",
  "limit": 1000
}