# export_collection

Source: https://modulify.ai/docs/api/database/export-collection

Reads every row of one collection in a single call, with the column names and types alongside.

- Title: Export one collection
- Scope: `data:read`
- Access: Read only
- Endpoint: `POST /v1/export_collection`

It reads up to 100,000 rows. `list_rows` returns 50 at a time and is for reading, while this is for taking a copy. Pass `rowId` to export a single row instead of the whole collection.

It needs the workspace to be on a paid plan, and is refused otherwise with a `403` and `A paid plan is required to export!` When the export stopped at the cap, `truncated` comes back true, and `list_rows` with `offset` reaches the rest. The whole database cannot be exported this way, since that is a downloadable archive in the product. See [Export the whole database](https://modulify.ai/docs/data/clearing-and-exporting#export-the-whole-database).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/export_collection`, sending the inputs below as a JSON object. The token needs the `data:read` scope.

It only reads and changes nothing, so retrying it is safe.

```bash
curl -X POST https://api.modulify.ai/v1/export_collection \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID","entity":"ENTITY"}'
```

Over MCP, the same method is the [export_collection tool](https://modulify.ai/docs/mcp/database/export-collection).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `schema` | string | No | The schema the collection lives in, exactly as `list_collections` reports it. Leave it out to use the site database's own default, which is right unless `list_collections` showed something else. A site on the newer database always uses its default. |
| `entity` | string | Yes | The collection to export, exactly as `list_collections` reports it. |
| `rowId` | string | No | Exports just this one row, by its `id`, instead of the whole collection. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.