> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getprimo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Count tickets for up to 20 queries in one call

> Return only numbers: `{"counts":{"<label>":<number>}}`, one per labelled query. Use it for any how-many question about tickets, one total or a breakdown (by status, priority, tag, assignee) with one query per bucket, instead of calling `getTickets` once per bucket. A query takes the `status`, `priority`, `searchTerm`, `assigneeEmployeeId` and `tagIds` of `getTickets`, and counts what `getTickets` would return for it (`pagination.totalElements`): top-level tickets only, so tasks are not counted. To list the tickets behind a count, use `getTickets`.

<span className="badge-read">Key: Read</span><span className="badge-company">Scope: Company</span>


## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /tickets/count
openapi: 3.1.1
info:
  title: Public API - BETA
  description: Read docs on https://docs.getprimo.com/
  version: '1.0'
  contact: {}
servers:
  - url: https://api.getprimo.com
security:
  - apikey: []
tags: []
paths:
  /tickets/count:
    post:
      tags:
        - Tickets
      summary: Count tickets for up to 20 queries in one call
      description: >-
        Return only numbers: `{"counts":{"<label>":<number>}}`, one per labelled
        query. Use it for any how-many question about tickets, one total or a
        breakdown (by status, priority, tag, assignee) with one query per
        bucket, instead of calling `getTickets` once per bucket. A query takes
        the `status`, `priority`, `searchTerm`, `assigneeEmployeeId` and
        `tagIds` of `getTickets`, and counts what `getTickets` would return for
        it (`pagination.totalElements`): top-level tickets only, so tasks are
        not counted. To list the tickets behind a count, use `getTickets`.
      operationId: countTickets
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CountTicketsBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CountTickets_Output'
components:
  schemas:
    CountTicketsBody:
      type: object
      properties:
        queries:
          description: >-
            Up to 20 ticket queries, each under a label you choose (letters,
            digits, "_" or "-"), e.g.
            `{"pending":{"status":"PENDING"},"pendingHigh":{"status":"PENDING","priority":"HIGH"}}`.
            A query takes the `status`, `priority`, `searchTerm`,
            `assigneeEmployeeId` and `tagIds` of `getTickets`, nothing else.
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: object
            properties:
              status:
                type: string
                enum:
                  - PENDING
                  - IN_PROGRESS
                  - COMPLETED
                  - CANCELLED
                  - SCHEDULED
                  - LOADING
              priority:
                type: string
                enum:
                  - LOW
                  - MEDIUM
                  - HIGH
              searchTerm:
                description: >-
                  Case-insensitive substring of the title or description, or a
                  ticket reference (`IT-1741` or `1741`).
                type: string
                minLength: 1
              assigneeEmployeeId:
                type: string
              tagIds:
                description: Filter tickets by tag ids
                type: array
                items:
                  type: string
            additionalProperties: false
      required:
        - queries
    CountTickets_Output:
      type: object
      properties:
        counts:
          type: object
          description: >-
            The number of records matching each query, under the label the query
            was sent with
          propertyNames:
            type: string
          additionalProperties:
            type: integer
            minimum: 0
            maximum: 9007199254740991
      required:
        - counts
      additionalProperties: false
  securitySchemes:
    apikey:
      scheme: bearer
      bearerFormat: API key
      type: http
      description: >-
        Use your Primo API key in the Authorization header as `Bearer
        <API_KEY>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.