---
title: "Count calls matching a query"
method: POST
path: "/api/v1/phones/calls/count"
tags: ["Phones - Calls"]
---

# Count calls matching a query

`POST /api/v1/phones/calls/count`

## Request

- Base URL: `https://api.voicelogica.ai`
- URL: `https://api.voicelogica.ai/api/v1/phones/calls/count`
- Auth: API key in header `x-api-key`

Total number of calls matching the same `queryOptionsRequest` filters as POST /query. Split out so the page of rows never waits on the count; pagination and sort are ignored.

## Headers

- `x-api-key` string, required
- `x-company-id` string

## Request body

- object: Request schema for querying calls with filters, sorting, and pagination
  - `pagedListRequest` object, required: Pagination settings
    - `nextId` string, nullable: ID of the next page for cursor-based pagination. Use null for the first page, then use the ID returned in the response for subsequent pages.
    - `pageSize` integer: Number of calls to return per page (default: 50, max: 100)
  - `queryOptionsRequest` object, required: Query filter, sort, and include options
    - `filtersRequest` object[], required: List of filters to apply to the query
      - `field` string, required: Field name to filter on (e.g., "createdAt", "status", "phoneNumber", "agentId", "callDirection")
      - `matchMode` number, required: Filter match mode: 1=Equal, 2=NotEqual, 3=LessThan, 4=LessThanOrEqual, 5=GreaterThan, 6=GreaterThanOrEqual, 7=Like, 8=Contains, 10=Between (for date ranges), 11=In
      - `operator` number, nullable: Logical operator between multiple filters: 1=AND, 2=OR
      - `value` object, nullable: Single value to filter against (for Equal, Like, etc.)
      - `values` object[], nullable: Array of values for In operations
      - `rangeValues` object, nullable: Range values for Between operations (used for date ranges)
        - `start` object, required: Start value of the range (ISO 8601 date string for date fields)
        - `end` object, required: End value of the range (ISO 8601 date string for date fields)
      - `ignoreCase` boolean, nullable: Whether to perform case-insensitive comparison
    - `sortRequest` object[], required: List of sort operations to apply
      - `field` string, required: Field name to sort by (e.g., "createdAt", "duration", "status")
      - `direction` number, required: Sort direction: 0=Ascending, 1=Descending
      - `priority` integer, required: Sort priority when multiple sort fields are specified (lower number = higher priority)
    - `includes` string[], required: Related entities to include in the response: "agent", "contact", "voipPhone", "user", "recordingFile", "transcriptionFile", "campaign", "humanRecordingFile", "humanTranscriptionFile"
    - `selectFields` string[], required: Specific fields to return in the response. Leave empty to return all fields.
    - `excludeFields` string[]: Fields to leave out (ignored when selectFields is set), e.g. "messages", "aiDialogue". "agent.systemPrompt" slims an included record.

## Other responses

- `401`: Unauthorized
- `403`: Invalid CSRF
- `429`: Rate limit exceeded
- `500`: Internal Server Error

---

[API](https://skmtc.dev/voicelogica/apis/voice-logica-api.md) · [All operations](https://skmtc.dev/voicelogica/apis/voice-logica-api/llms.txt) · [OpenAPI document](https://skmtc.dev/voicelogica/apis/voice-logica-api/revisions/30f76840084e?raw)
