Skip to main content
Download content from Sanity. Every command follows the CLI contract: JSON on stdout, errors on stderr, and command-specific mutation safety controls. Keys resolve as described in Secrets and API keys.

gtm sanity blog

Download blog posts from Sanity.

gtm sanity blog download

Download every blog post to <out-dir>/blogs/<slug>/ (index.md + post.json).
uv run gtm sanity blog download [OPTIONS]
OptionTypeDefaultDescription
--out-dirpathoutOutput directory; posts are written under <out-dir>/blogs/<slug>/.
--project-idtextnsq559ovSanity project ID
--datasettextproductionSanity dataset name
--api-versiontextv2025-02-19Sanity API version date string
--tokentextBearer token for private datasets (public datasets need none).
--use-cdn, --no-cdnbooleanfalseRead from the cached CDN edge instead of the live origin. Off by default so an archive run never captures stale content or misses just-published/just-deleted posts.
--use-env-token, --no-env-tokenbooleanfalseOff by default so a public archive run ignores any ambient SANITY_API_TOKEN and stays reproducible. Pass —use-env-token to authenticate from the environment (an explicit —token always applies regardless).
--prune, --no-prunebooleantrueRemove snapshots of posts no longer in the live corpus.
Last modified on July 14, 2026