> For AI agents: the complete Sanity documentation index is available at [https://www.sanity.io/docs/llms.txt](https://www.sanity.io/docs/llms.txt).

# Assets CLI command reference

Reference documentation for the Sanity CLI assets command.

**npm**

```shell
npx sanity assets --help
```

**pnpm**

```shell
pnpm dlx sanity assets --help
```

**yarn**

```shell
yarn dlx sanity assets --help
```

**bun**

```shell
bunx sanity assets --help
```

## Commands

### `upload`

**CLI output**

```sh
USAGE
  $ sanity assets upload [-d <name>] [-p <id>] [--content-type <mime-type>] --file <path> [--filename <filename>] [--type <value>]

FLAGS
      --content-type=<mime-type>  MIME type of the asset, such as image/png or application/pdf
      --file=<path>               Path to the local file to upload
      --filename=<filename>       Original filename stored on the asset document. Defaults to the local filename
      --type=<value>              Asset type to create

OVERRIDE FLAGS
  -d, --dataset=<name>   Dataset to upload the asset to (overrides CLI configuration)
  -p, --project-id=<id>  Project ID to upload the asset to (overrides CLI configuration)

DESCRIPTION
  Upload one local image or file to a Sanity dataset and print the asset document as JSON

EXAMPLES
  Upload an image using the configured project

    $ sanity assets upload --file ./hero.png --type image --dataset production

  Upload a file with explicit project, dataset, and MIME type

    $ sanity assets upload --file ./brief.pdf --type file --content-type application/pdf --project-id abc123 --dataset production
```

