# Sprites

The sprite sheet a style draws its icons from, and the individual icons in it. Every command here takes a style ID first, plus the common flags — `--username`/`-u`, `--token`/`-t`, `--profile`, `--id` — described in [Shared parameters](https://docs.mapbox.com/ja/cli/reference/#shared-parameters).

-   [`mapbox sprites get-json`](#mapbox-sprites-get-json)
-   [`mapbox sprites upload`](#mapbox-sprites-upload)
-   [`mapbox sprites upload-batch`](#mapbox-sprites-upload-batch)
-   [`mapbox sprites delete`](#mapbox-sprites-delete)
-   [`mapbox sprites delete-batch`](#mapbox-sprites-delete-batch)

## `mapbox sprites get-json`

The sprite index: where each icon sits in the sheet, and how big it is.

**Parameters:**

| Parameter | Description |
| --- | --- |
| `<style-id>` | Unique identifier for the style. |

**Examples:**

```sh
mapbox sprites get-json ckstyle00000000000000001a
```

This read sits behind a 15-minute cache, so it can lag a recent upload or delete. The four commands below answer with the index themselves.

## `mapbox sprites upload`

Adds one SVG to a style's sprite under the given icon name. Limits: 512 px per side, under 400 KB, and 1,000 images per sprite.

**Parameters:**

| Parameter | Description |
| --- | --- |
| `<style-id>` | Unique identifier for the style. |
| `<icon-name>` | URL-encoded name of the sprite image. |
| `--file` | The SVG file. Its bytes become the request body. |

**Examples:**

```sh
mapbox sprites upload ckstyle00000000000000001a zz-clitest-1 \
  --file icon.svg
```

## `mapbox sprites upload-batch`

Adds up to 25 SVGs in one request, 100 KB each. Each icon takes its name from its filename: `zz-clitest-3.svg` becomes the icon `zz-clitest-3`.

**Parameters:**

| Parameter | Description |
| --- | --- |
| `<style-id>` | Unique identifier for the style. |
| `--file` | File to upload, repeatable. Each becomes a part in the multipart field `images`. |

**Examples:**

```sh
mapbox sprites upload-batch ckstyle00000000000000001a \
  --file zz-clitest-3.svg --file zz-clitest-4.svg
```

## `mapbox sprites delete`

Removes one icon from the sprite.

**Parameters:**

| Parameter | Description |
| --- | --- |
| `<style-id>` | Unique identifier for the style. |
| `<icon-name>` | URL-encoded name of the sprite image. |

**Examples:**

```sh
mapbox sprites delete ckstyle00000000000000001a zz-clitest-1
```

## `mapbox sprites delete-batch`

Removes up to 150 icons in one request.

**Parameters:**

| Parameter | Description |
| --- | --- |
| `<style-id>` | Unique identifier for the style. |
| `--data`/`-d` | A JSON array of icon names, not an object. |

**Examples:**

```sh
mapbox sprites delete-batch ckstyle00000000000000001a \
  -d '["zz-clitest-5","zz-clitest-6"]'
```