For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
CloudGitHub
  • API Reference
      • POSTRetrieve points
      • PUTUpsert points
      • GETRetrieve a point
      • POSTDelete points
      • PUTUpdate vectors
      • POSTDelete vectors
      • POSTSet payload
      • PUTOverwrite payload
      • POSTDelete payload
      • POSTClear payload
      • POSTBatch update points
      • POSTScroll points
      • POSTCount points
      • POSTPayload field facets
LogoLogo
CloudGitHub
API ReferencePoints

Count points

POST
/collections/:collection_name/points/count
POST
/collections/:collection_name/points/count
$# Count total number of points in a collection
$curl -X POST \
> 'http://localhost:6333/collections/collection_name/points/count' \
> --header 'api-key: <api-key-value>' \
> --header 'Content-Type: application/json' \
> --data-raw '{
> "exact": true
>}'
$
$# Count points satisfying a filter condition
$curl -X POST \
> 'http://localhost:6333/collections/collection_name/points/count' \
> --header 'api-key: <api-key-value>' \
> --header 'Content-Type: application/json' \
> --data-raw '{
> "filter": {
> "must": [
> {
> "key": "color",
> "match": {
> "value": "red"
> }
> }
> ]
> },
> "exact": true
>}'
200Successful
1{
2 "usage": {
3 "cpu": 1,
4 "payload_io_read": 1,
5 "payload_io_write": 1,
6 "payload_index_io_read": 1,
7 "payload_index_io_write": 1,
8 "vector_io_read": 1,
9 "vector_io_write": 1
10 },
11 "time": 0.002,
12 "status": "ok",
13 "result": {
14 "count": 1
15 }
16}
Counts the number of points that match a specified filtering condition.
Was this page helpful?
Previous

Payload field facets

Next
Built with

Authentication

api-keystring
API Key authentication via header

Path parameters

collection_namestringRequired
Name of the collection to count in

Query parameters

timeoutintegerOptional>=1
If set, overrides global timeout for this request. Unit is seconds.

Request

Request counts of points which matches given filtering condition
shard_keystring or uint64 or list of strings or uint64s or anyOptional

Specify in which shards to look for the points, if not specified - look in all shards

filterobject or anyOptional
Look only for points which satisfies this conditions
exactbooleanOptionalDefaults to true

If true, count exact number of points. If false, count approximate number of points faster. Approximate count might be unreliable during the indexing process. Default: true

Response

successful operation
usageobject or any
timedouble
Time spent to process this request
statusstring
resultobject