> ## Documentation Index
> Fetch the complete documentation index at: https://gtmsdk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# gtm sanity

> Command reference for gtm sanity — Download content from Sanity. Generated from the CLI help text.

Download content from Sanity.

Every command follows the [CLI contract](/concepts/cli-contract): JSON on stdout, errors on stderr, and command-specific mutation safety controls. Keys resolve as described in [Secrets and API keys](/secrets).

## `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).

```bash theme={"system"}
uv run gtm sanity blog download [OPTIONS]
```

| Option                            | Type    | Default       | Description                                                                                                                                                                                                      |
| --------------------------------- | ------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--out-dir`                       | path    | `out`         | Output directory; posts are written under \<out-dir>/blogs/\<slug>/.                                                                                                                                             |
| `--project-id`                    | text    | `nsq559ov`    | Sanity project ID                                                                                                                                                                                                |
| `--dataset`                       | text    | `production`  | Sanity dataset name                                                                                                                                                                                              |
| `--api-version`                   | text    | `v2025-02-19` | Sanity API version date string                                                                                                                                                                                   |
| `--token`                         | text    | —             | Bearer token for private datasets (public datasets need none).                                                                                                                                                   |
| `--use-cdn, --no-cdn`             | boolean | `false`       | Read 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-token` | boolean | `false`       | Off 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-prune`             | boolean | `true`        | Remove snapshots of posts no longer in the live corpus.                                                                                                                                                          |


## Related topics

- [CLI overview](/cli/index.md)
- [Secrets and API keys](/secrets.md)
- [Architecture](/concepts/architecture.md)
- [CLI contract](/concepts/cli-contract.md)
- [Quickstart: install gtm-sdk and run your first command](/quickstart.md)
