# Data export Export your data as CSV or JSON. **Common tasks** - [Export a resource as CSV or JSON](#get-organizations-organization-export-resource) **Only in the app:** Importing data. **How it works in the app:** [help article](https://infranest.io/docs/data-export-import). **Scopes:** Read with `data.read`. See [Tokens and scopes](../tokens-and-scopes.md#scopes).
[Export](#export) 3 · [Import](#import) 1
Every endpoint below takes a token in the `Authorization: Bearer` header and answers JSON. Errors use the shared format in [Errors](../errors.md). Base address: `https://api.infranest.io/api`. ## Export ### List exportable data {#get-organizations-organization-export}
`GET` `/organizations/{organization}/export` **Scope:** `data.read` · **Changes data:** no The kinds of data you can export and the formats available, each marked `locked` when your plan does not include it. CSV is always available; JSON and XML need a plan with advanced export. | Field | Type | Notes | |---|---|---| | `organization_id`
path · required | integer | Your organization's ID. | **Errors:** [`unauthenticated`](../errors.md#unauthenticated), [`scope_missing`](../errors.md#scope_missing), [`wrong_organization`](../errors.md#wrong_organization), [`test_token_required`](../errors.md#test_token_required), [`test_token_sandbox_only`](../errors.md#test_token_sandbox_only), [`permission_denied`](../errors.md#permission_denied), [`not_found`](../errors.md#not_found), [`rate_limited`](../errors.md#rate_limited)
**Request** ```sh curl "https://api.infranest.io/api/organizations/42/export" \ -H "Authorization: Bearer $INFRANEST_TOKEN" \ -H "Accept: application/json" ``` **Response** · 200 ```json { "resources": [ { "key": "domains", "label": "Domains", "locked": false }, { "key": "contacts", "label": "Contacts", "locked": false } ], "formats": [ { "key": "csv", "locked": false }, { "key": "json", "locked": false } ] } ```
--- ### Export one kind of data {#get-organizations-organization-export-resource}
`GET` `/organizations/{organization}/export/{resource}` **Scope:** `data.read` · **Changes data:** no Downloads every record of one kind as a file, in `format` `csv` (default), `json` or `xml`; pass `ids[]` to export only those records. Refused when your role may not read that data or your plan does not include the resource or format. | Field | Type | Notes | |---|---|---| | `organization_id`
path · required | integer | Your organization's ID. | | `resource`
path · required | string | The resource. | **Errors:** [`unauthenticated`](../errors.md#unauthenticated), [`scope_missing`](../errors.md#scope_missing), [`wrong_organization`](../errors.md#wrong_organization), [`test_token_required`](../errors.md#test_token_required), [`test_token_sandbox_only`](../errors.md#test_token_sandbox_only), [`permission_denied`](../errors.md#permission_denied), [`not_found`](../errors.md#not_found), [`rate_limited`](../errors.md#rate_limited)
**Request** ```sh curl "https://api.infranest.io/api/organizations/42/export/1" \ -H "Authorization: Bearer $INFRANEST_TOKEN" \ -H "Accept: application/json" ``` **Response** · 200 — The resource as CSV (the default), JSON or XML, as `format` asks. (`text/csv`, `application/json`, `application/xml`)
--- ### Download a full data export {#get-organizations-organization-export-bundle}
`GET` `/organizations/{organization}/export/bundle` **Scope:** `data.read` · **Changes data:** no A ZIP file with a CSV and a JSON file for every kind of data your role may read, plus a `manifest.json` that lists what is included. | Field | Type | Notes | |---|---|---| | `organization_id`
path · required | integer | Your organization's ID. | **Errors:** [`unauthenticated`](../errors.md#unauthenticated), [`scope_missing`](../errors.md#scope_missing), [`wrong_organization`](../errors.md#wrong_organization), [`test_token_required`](../errors.md#test_token_required), [`test_token_sandbox_only`](../errors.md#test_token_sandbox_only), [`permission_denied`](../errors.md#permission_denied), [`not_found`](../errors.md#not_found), [`rate_limited`](../errors.md#rate_limited)
**Request** ```sh curl "https://api.infranest.io/api/organizations/42/export/bundle" \ -H "Authorization: Bearer $INFRANEST_TOKEN" \ -H "Accept: application/json" ``` **Response** · 200 — Every exportable resource, one file each, in a ZIP archive. (`application/zip`)
## Import ### List importable data {#get-organizations-organization-import}
`GET` `/organizations/{organization}/import` **Scope:** `data.read` · **Changes data:** no The kinds of data you can import from CSV, with the column headers each expects, and whether your plan allows importing (`allowed`). Requires permission to manage the organization. | Field | Type | Notes | |---|---|---| | `organization_id`
path · required | integer | Your organization's ID. | **Errors:** [`unauthenticated`](../errors.md#unauthenticated), [`scope_missing`](../errors.md#scope_missing), [`wrong_organization`](../errors.md#wrong_organization), [`test_token_required`](../errors.md#test_token_required), [`test_token_sandbox_only`](../errors.md#test_token_sandbox_only), [`permission_denied`](../errors.md#permission_denied), [`not_found`](../errors.md#not_found), [`rate_limited`](../errors.md#rate_limited)
**Request** ```sh curl "https://api.infranest.io/api/organizations/42/import" \ -H "Authorization: Bearer $INFRANEST_TOKEN" \ -H "Accept: application/json" ``` **Response** · 200 ```json { "resources": [ { "key": "contacts", "label": "Contacts", "headers": [ "first_name", "last_name" ] }, { "key": "ssl-certificates", "label": "SSL certificates", "headers": [ "subject", "sans" ] } ], "allowed": true } ```