---
title: "Get number of documents in a collection"
method: GET
path: "/_fabric/{fabric}/_api/collection/{collection-name}/count"
tags: ["Collections"]
---

# Get number of documents in a collection

`GET /_fabric/{fabric}/_api/collection/{collection-name}/count`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/macrometa/apis/macrometa-api-reference/docs/_fabric/:fabric/_api/collection/:collection-name/count/get.ts> (a function with typed inputs; its response is checked against the schema)

Retrieve the count of documents within the collection.

**Note**: This always loads the collection into memory.

## Path parameters

- `fabric` string, string, required
- `collection-name` string, string, required

## Response `200`

Successfully fetched number of documents in a collection.

- ApiCollectionGetCountExamplesRc200
  - `code` integer: HTTP response code.
  - `error` boolean: Flag if there is an error in response. *False* for this response.
  - `searchEnabled` boolean: *True* if collection is searchable.
  - `count` string: Number of document in the collection.
  - `id` string: Id of the the collection.
  - `isSystem` boolean: *True* if collection is a system collection.
  - `name` string: Name of the collection.
  - `globallyUniqueId` string: Global unique identifier.

## Other responses

- `400`: Failed due to missing or malformed data. Verify that all parameters are complete.
- `404`: Failed to find specified collection.

---

[API](https://skmtc.dev/macrometa/apis/macrometa-api-reference.md) - [All operations](https://skmtc.dev/macrometa/apis/macrometa-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/macrometa/apis/macrometa-api-reference/revisions/2006b6d7f31d?raw)
