# Export your data

> The portal.export.get operation: GET /api/v1/portal/me/export in the REST API and the portal_export_get tool in the MCP server.

Returns everything the brand holds about the signed-in customer as one file: the account with its tax IDs,
location evidence, invoices and credit notes with their lines, payments, payment methods, subscriptions, wallets
and the credit balance (at most 1,000 records of each type).

- `json`: one document grouped by record type.
- `csv`: one row per value (`record_type,record_id,field,value`), nested fields as dotted paths.

The portal offers it as a download. Customer portal only (`portal:read`).

## At a glance

- **REST:** `GET /api/v1/portal/me/export`
- **MCP tool:** `portal_export_get`
- **Operation ID:** `portal.export.get`
- **Scope:** Brand
- **Permission:** `portal:read`
- **Risk tier:** `read`
- **Dry run:** Not supported
- **Idempotency:** Not needed (read only)
- **Modes:** Test and live
- **Authentication:** A customer signed in to the customer portal (API keys can't call it)
- **Since:** M9

## Request

### Query parameters

| Field    | Type                 | Required | Description                |
| -------- | -------------------- | -------- | -------------------------- |
| `format` | one of `json`, `csv` | No       | `json` (default) or `csv`. |

## Response

`200 OK` with a JSON object:

| Field         | Type                 | Description                                           |
| ------------- | -------------------- | ----------------------------------------------------- |
| `object`      | `"portal_export"`    |                                                       |
| `format`      | one of `json`, `csv` |                                                       |
| `filename`    | string               |                                                       |
| `contentType` | string               |                                                       |
| `content`     | string               | The file's text: JSON, or CSV with one row per value. |

## Examples

### CSV export

```http
GET /api/v1/portal/me/export?format=csv
Authorization: Bearer or_test_…
```

Response (`200`):

```json
{
  "object": "portal_export",
  "format": "csv",
  "filename": "genno-cus_01m4tx5nj8emwbyf7y9vcf48b1-2026-10-20.csv",
  "contentType": "text/csv; charset=utf-8",
  "content": "record_type,record_id,field,value\r\ncustomer,cus_01m4tx5nj8emwbyf7y9vcf48b1,email,ana@example.com\r\n"
}
```

## Errors

| Code                                                                                         | HTTP status | When                                                                                                               | What to do                                                                                                                  |
| -------------------------------------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| [`validation_failed`](https://ownrecord.io/docs/reference/errors.md#validation_failed)       | 400         | A field or pagination value is malformed.                                                                          | Fix the fields listed in `details.issues` and send the request again.                                                       |
| [`livemode_not_allowed`](https://ownrecord.io/docs/reference/errors.md#livemode_not_allowed) | 403         | The portal session is in the other mode than the request.                                                          | Use test mode, or credentials for the target's mode. Developers need live access granted by an organization owner or admin. |
| [`permission_denied`](https://ownrecord.io/docs/reference/errors.md#permission_denied)       | 403         | The caller isn't a customer signed in to this brand's portal (operators and API keys use the customer operations). | Ask an organization owner or admin for a role or scope that allows this action.                                             |

It can also return these [common errors](https://ownrecord.io/docs/reference.md#common-errors): [`api_version_unsupported`](https://ownrecord.io/docs/reference/errors.md#api_version_unsupported), [`authentication_required`](https://ownrecord.io/docs/reference/errors.md#authentication_required), [`api_key_invalid`](https://ownrecord.io/docs/reference/errors.md#api_key_invalid), [`scope_required`](https://ownrecord.io/docs/reference/errors.md#scope_required), [`resource_not_found`](https://ownrecord.io/docs/reference/errors.md#resource_not_found), [`dry_run_not_supported`](https://ownrecord.io/docs/reference/errors.md#dry_run_not_supported), [`rate_limited`](https://ownrecord.io/docs/reference/errors.md#rate_limited), [`internal_error`](https://ownrecord.io/docs/reference/errors.md#internal_error).
