> ## Documentation Index
> Fetch the complete documentation index at: https://actianvectorai-docs-low-effort-fixes.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Count points

> Count the number of points in a collection, optionally filtered by payload conditions. Useful for checking collection size, validating data loads, or counting points matching specific criteria.



## OpenAPI

````yaml post /collections/{collection_name}/points/count
openapi: 3.0.3
info:
  title: Actian VectorAI DB - Search API
  description: Vector similarity search operations for Actian VectorAI DB.
  version: 1.0.0
  contact:
    name: Actian Corporation
    url: https://www.actian.com
servers:
  - url: http://localhost:6575
    description: Local development server (REST API)
  - url: https://api.vectorai.actian.com
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Search
    description: Vector similarity search operations
  - name: Scroll
    description: Pagination and iteration
  - name: Count
    description: Counting operations
paths:
  /collections/{collection_name}/points/count:
    post:
      tags:
        - Count
      summary: Count points
      description: >-
        Count the number of points in a collection, optionally filtered by
        payload conditions. Useful for checking collection size, validating data
        loads, or counting points matching specific criteria.
      operationId: count_points
      parameters:
        - name: collection_name
          in: path
          required: true
          schema:
            type: string
          description: The name of the collection to count points in.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                filter:
                  type: object
                  description: >-
                    Optional filter conditions. Only points matching the filter
                    are counted.
                exact:
                  type: boolean
                  default: true
                  example: true
                  description: >-
                    If `true`, returns an exact count. If `false`, returns a
                    faster approximate count. Defaults to `true`.
            examples:
              count_all:
                summary: Count all points
                value:
                  exact: true
              count_filtered:
                summary: Count with filter
                value:
                  filter:
                    must:
                      - key: category
                        match:
                          value: A
                  exact: true
      responses:
        '200':
          description: Count result
          content:
            application/json:
              schema:
                type: object
                properties:
                  usage:
                    type: object
                    properties:
                      hardware:
                        type: object
                        nullable: true
                        description: >-
                          Hardware resource counters for the operation,
                          including CPU, payload I/O, payload index I/O, and
                          vector I/O metrics.
                  time:
                    type: number
                    format: double
                    example: 0.000004424
                    description: Time spent to process this request, in seconds.
                  status:
                    type: string
                    example: ok
                    description: Operation status.
                  result:
                    type: object
                    properties:
                      count:
                        type: integer
                        example: 4
                        description: The number of points matching the criteria.
              example:
                usage:
                  hardware: null
                time: 0.000004424
                status: ok
                result:
                  count: 4
        4XX:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: Python
          label: Count all points
          source: |
            from actian_vectorai_client import VectorAIClient

            with VectorAIClient("localhost:6574") as client:
                # Count total points
                count = client.points.count("my_collection")
                print(f"Total points: {count}")
        - lang: Python
          label: Count with filter
          source: >
            from actian_vectorai_client import VectorAIClient, Field,
            FilterBuilder


            with VectorAIClient("localhost:6574") as client:
                # Count points matching filter
                payload_filter = FilterBuilder().must(Field("category").eq("A")).build()
                count_a = client.points.count("my_collection", filter=payload_filter)
                print(f"Category A: {count_a}")
        - lang: JavaScript
          label: Count all points
          source: |
            import { VectorAIClient } from '@actian/vectorai-client';

            const client = new VectorAIClient('localhost:6574');

            const count = await client.points.count('my_collection');
            console.log(`Total points: ${count}`);

            client.close();
        - lang: JavaScript
          label: Count with filter
          source: >
            import { VectorAIClient, Field } from '@actian/vectorai-client';


            const client = new VectorAIClient('localhost:6574');


            const filter = Field.of('category').eq('electronics');

            const count = await client.points.count('my_collection', { filter
            });

            console.log(`Electronics count: ${count}`);


            client.close();
        - lang: cURL
          label: Count points
          source: >
            curl -X POST
            "http://localhost:6575/collections/my_collection/points/count" \
              -H "Content-Type: application/json" \
              -H 'Authorization: Bearer <admin-jwt-or-access-token>' \
              -d '{
                "exact": true
              }'
        - lang: cURL
          label: Count with filter
          source: >
            curl -X POST
            "http://localhost:6575/collections/my_collection/points/count" \
              -H "Content-Type: application/json" \
              -H 'Authorization: Bearer <admin-jwt-or-access-token>' \
              -d '{
                "filter": {
                  "must": [
                    {
                      "key": "category",
                      "match": {"value": "A"}
                    }
                  ]
                }
              }'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        status:
          type: object
          properties:
            error:
              type: string
        time:
          type: number
          format: double
          description: Time spent to process this request, in seconds.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Admin JWT or access token for authenticating requests to VectorAI DB.

````