## Count Vectors

`client.VectorStores.Count(ctx, vectorStoreName, body) (*VectorStoreCountResponse, error)`

**post** `/v5/vector-stores/{vector_store_name}/count`

Count documents in a vector store, optionally filtered by metadata.

**Use Cases:**

- Monitor vector store size and growth over time
- Preview the number of documents matching a filter before deletion
- Validate data ingestion by comparing expected versus actual document counts
- Analyze document distribution across metadata categories

**Filtering:** Apply the same metadata filter syntax as delete and list operations. Only indexed fields
can be used for filtering. An empty filter counts all documents in the store.

### Parameters

- `vectorStoreName string`

  The name of the vector store

- `body VectorStoreCountParams`

  - `Filter param.Field[map[string, any]]`

    Metadata filter expression

### Returns

- `type VectorStoreCountResponse struct{…}`

  Response for count operation.

  - `Count int64`

    Number of documents matching the criteria

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  response, err := client.VectorStores.Count(
    context.TODO(),
    "vector_store_name",
    sgpdev.VectorStoreCountParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Count)
}
```

#### Response

```json
{
  "count": 0
}
```
