HTTP API Reference

CDN Cache Purge API Reference

API reference for purging cached dataset query results and individual images or files.

Purge cached dataset query results or one dataset image or file from Sanity's CDN.

Self-service cache purging must be enabled for the project. Authenticate with a user or robot token that has permission to update project datasets. The Administrator and Developer roles include this permission.

See Purge CDN caches for usage, completion guarantees, and rate limits.

Base API server URL

Sanity API

https://api.sanity.io

Endpoints

Purge one dataset image or file

post/v1/projects/{project_id}/datasets/{dataset_name}/assets/{asset_id}/purges

Purges all cached representations of one dataset image or file. Send a POST with an empty body.

Path parameters

  • project_idstringrequired

    The project that owns the dataset.

  • dataset_namestringrequired

    The dataset the asset belongs to.

  • asset_idstringrequired

    The asset document's _id or an asset reference's _ref. Use image-<sha1>-<width>x<height>-<format> or file-<sha1>-<extension>.

Responses

202

The request was durably accepted. The purge runs in the background.

  • purgeIdstring

    An opaque identifier for the accepted purge. Include it when contacting support.

  • acceptedAtstring (date-time)

    A UTC timestamp in RFC 3339 format.

Purge cached query responses for one dataset

post/v1/projects/{project_id}/datasets/{dataset_name}/purges

Purges cached GROQ and GraphQL query results for one dataset. Send a POST with an empty body.

Path parameters

  • project_idstringrequired

    The project that owns the dataset.

  • dataset_namestringrequired

    The dataset whose cached query results will be purged.

Responses

202

The request was durably accepted. The purge runs in the background.

  • purgeIdstring

    An opaque identifier shared by requests joining the same pending purge batch. Include it when contacting support.

  • acceptedAtstring (date-time)

    A UTC timestamp in RFC 3339 format.

Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change site theme