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

# List Collections

> Lists the collections of a MongoDB database and the indexes of one collection.

<Note>
  Every `/data` endpoint needs the **Intermediary** plan or higher, on the **database owner's**
  account — not the caller's. Below that the answer is `PLAN_RESTRICTED_FEATURE` (403).
  It is also **dashboard-session only**: an API key gets `API_KEY_SCOPE_DENIED` (403) here, regardless of
  its scopes.
</Note>

MongoDB only.

<ParamField path="id" type="string" required>The ID of the database.</ParamField>
<ParamField query="workspace" type="string">Workspace the database belongs to.</ParamField>

### Response

<ResponseField name="response" type="object[]">
  <Expandable title="Toggle object">
    <ResponseField name="name" type="string">Collection name.</ResponseField>
    <ResponseField name="documents_count" type="number">Documents in the collection.</ResponseField>
    <ResponseField name="size_bytes" type="number">Size on disk.</ResponseField>
    <ResponseField name="avg_document_size" type="number">Average document size, in bytes.</ResponseField>
    <ResponseField name="indexes_count" type="number">Number of indexes.</ResponseField>
  </Expandable>
</ResponseField>

***

## Indexes

<ParamField header="GET" type="string">`/v1/databases/{id}/data/collections/{name}/indexes`</ParamField>

Returns an array of `{ name, keys, unique, sparse }`, where `keys` has the same shape as `createIndex`
(`{ "created_at": -1 }`). The collection name must be one the database's own `listCollections`
returns; anything else answers `OBJECT_NOT_FOUND`.
