
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGood news! You don't need to set up OAuth for using the export documents endpoint. A simple internal API token will work perfectly fine.
Here's what you need to do:
The export endpoint accepts standard API token authentication. You can create a token through your project's API settings and include it in your request using the Authorization header with a Bearer token format.
npx sanity@latest manage from your CLIInclude your token in the Authorization header when making requests:
Authorization: Bearer YOUR_TOKEN_HERE
The endpoint URL format is:
https://{projectId}.api.sanity.io/{apiVersion}/data/export/{dataset}Unauthenticated requests will only return publicly available documents. When you include an authentication token, you'll get access to all documents that token has permissions for, including drafts and system documents.
For most use cases, you'll probably want to use the Sanity CLI's export functionality (sanity dataset export) or the @sanity/export npm package. These have built-in features like asset downloads, draft inclusion options, and automatic handling of cursor mode for large datasets.
The token approach is much simpler than OAuth and is the standard way to authenticate with Sanity's HTTP API for programmatic access!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store