Index
Edit

Export

You can export all your project’s documents in a dataset by requesting the following URL:

https://<projectId>.api.sanity.io/v1/data/export/<dataset>/

For example, if your project id is zp7mbokg and your dataset name is production, the export endpoint URL will be https://zp7mbokg.api.sanity.io/v1/data/export/production/.

This endpoint returns a node-stream of NDJSON data. You can write this directly to a file by running this in your command line interface:

curl https://<projectId>.api.sanity.io/v1/data/export/<dataset>/ > backup.ndjson

An unauthenticated request will only return publicly available documents. If you include an authentication token, it will include documents that this token has access to (for example: drafts and system documents).

Pro-tip

In most cases you probably want to use the CLI tool’s export functionality, or the JavaScript npm package. Those have built-in features such as assets downloads and optional including drafts.

Previous: Using JSONMatchNext: History