Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ that may never merge. They are not releases and are not listed here.

## Unreleased

- Clean up.

### Added

- The README now documents installing without the install script: the
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mapbox-cli"
version = "0.2.2"
version = "0.3.0"
edition = "2021"
description = "A command-line interface for Mapbox APIs, with commands generated at build time from OpenAPI specs."
repository = "https://github.com/mapbox/cli"
Expand Down
90 changes: 20 additions & 70 deletions docs/commands.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Implemented commands

Every command the CLI ships: four auth commands, 34 API operations across 11
Every command the CLI ships: four auth commands, 33 API operations across 10
command groups, the tilesets-cli proxy, `completion` and `generate-skills`. Each is
shown in both of its renderings. Which one you get is decided by `--output`, whose default
(`auto`) reads stdout: a terminal gets the left column, a pipe or redirect
Expand All @@ -10,7 +10,7 @@ gets the right one. See
Account names, style ids and tokens in the examples are replaced; everything
else is as the API sent it.

**29 of the 34 were run against the live API and show what came back:** 26
**29 of the 33 were run against the live API and show what came back:** 26
on 2026-09-01, and `fonts list`, `fonts upload` and `fonts delete` on
2026-09-08, once `fonts:list`/`fonts:write` became
registrable. The write operations were exercised as round trips on
Expand All @@ -29,12 +29,10 @@ commands and the flags they take — is held to `mapbox --schema` on every
`cargo test` run by `tests/docs_contract.rs`, so the half of this page that
can be checked cannot fall behind the binary.

The remaining 5 give the response shape from the spec or the docs instead
of a live capture, for two different reasons. `rasterarrays get-mrt-tile`
needs a raster-array job this account does not have. The other four are
`search`'s: read-only and safe to run, but the credentials used to write
this page have no Search Box API access, so every call answers 401 rather
than a result.
The remaining 4 give the response shape from the spec or the docs instead
of a live capture: they're all `search`'s — read-only and safe to run, but
the credentials used to write this page have no Search Box API access, so
every call answers 401 rather than a result.

Each **Parameters** section lists only what is specific to its command. The
globals every API command takes are
Expand Down Expand Up @@ -102,7 +100,6 @@ nests, and is typed `mapbox styles draft get`.
**[Tilesets](#tilesets)** —
[tilesets.get-tile](#mapbox-tilesets-get-tile) ·
[tilesets.get-mvt](#mapbox-tilesets-get-mvt) ·
[tilesets.get-mrt](#mapbox-tilesets-get-mrt) ·
[tilesets.query](#mapbox-tilesets-query)

**[Tilesets CLI](#tilesets-cli)** — [tilesets-cli](#mapbox-tilesets-cli-args)
Expand Down Expand Up @@ -349,7 +346,7 @@ Docs: https://docs.mapbox.com/api/accounts/tokens/

## API command groups

34 operations across 11 command groups. Ten are generated from the OpenAPI specs
33 operations across 10 command groups. Nine are generated from the OpenAPI specs
vendored in `openapi/`; `search` is the one exception — a hand-authored
spec versioned in this repo's own `custom-openapi/`, see
`custom-openapi/README.md`.
Expand All @@ -367,7 +364,6 @@ operation moved to `tilesets`.
| [`accounts`](#accounts) | **3** |
| [`fonts`](#fonts) | **3** |
| [`geocoder`](#geocoder) | **3** |
| [`rasterarrays`](#raster-arrays) | **1** |
| [`search`](#search) | **4** |
| [`sprites`](#sprites) | **5** |
| [`static-images`](#static-images) | **3** |
Expand All @@ -376,7 +372,7 @@ operation moved to `tilesets`.
| [`tilequery`](#tilequery) | **1** |
| [`tilesets`](#tilesets) | **2** |

The [Contents](#contents) list above names every one of the 34.
The [Contents](#contents) list above names every one of the 33.

**Everything else the Mapbox specs describe is not here at all.** Not
hidden, not shipped as a command that refuses: absent from the spec content
Expand Down Expand Up @@ -487,7 +483,7 @@ Three things worth knowing about the read forms:
A command that changes something takes `--dry-run`, which prints the request
it would send, on stdout, and sends nothing. Which commands those are is not
a list anyone keeps: it is every `POST`, `PUT`, `PATCH` and `DELETE` — 12 of
the 34 operations — plus `auth login`, `auth logout`, `auth refresh` and
the 33 operations — plus `auth login`, `auth logout`, `auth refresh` and
`generate-skills`. A read-only `GET` does not take it, so `mapbox styles
list --dry-run` is a usage error rather than a no-op. It rehearses
rather than describes: `--data` is parsed and every `--file` is read, so a
Expand Down Expand Up @@ -568,8 +564,8 @@ properties directly. A conforming response never reaches that case:
`geocoder` requires `name`/`feature_type` on every feature, `tilequery`
requires `tilequery.layer`.

Four of the eleven command groups can answer with bytes — `rasterarrays`,
`static-images`, `static-tiles` and `tilesets`. Those bypass `--output` in
Three of the ten command groups can answer with bytes — `static-images`,
`static-tiles` and `tilesets`. Those bypass `--output` in
both modes:

<table>
Expand Down Expand Up @@ -817,14 +813,8 @@ afterward.

### `mapbox fonts list`

The font faces an account owns.

#### Parameters

`--fresh` skips the cache. Worth knowing even outside a script: a font
just uploaded does not appear without it — the API's own `Cache-Control`
otherwise serves a listing from before the upload for some window
afterward.
The font faces an account owns. Cached: a font just uploaded may not appear
for some window afterward, per the API's own `Cache-Control`.

#### Examples

Expand Down Expand Up @@ -1915,8 +1905,7 @@ mapbox styles get ckstyle00000000000000001a --username user -o json > style.json
— is served through CloudFront with `max-age=900`, so a `styles get` right
after an `styles update` may still show the old document. The mutation
commands return the new state themselves, from the origin; trust that rather
than reading back. `list-files --fresh true` is the one read that rebuilds
instead of being served from cache.
than reading back.

A style document is a nested tree of layers and sources, not rows, so it
stays JSON in both modes — indented under `text`, one line under `json`.
Expand Down Expand Up @@ -2247,18 +2236,17 @@ beforehand.

## Tilesets

Tiles by tileset id, plus the raster-array and vector-tile lookups that key
off one: raster from the Raster Tiles API, vector from the Vector Tiles
API, MRT tiles from a raster-array job, and `query` from the Tilequery
API. Four operations, out of four different specs, under one command
group (#116) — a caller asking about a tileset is asking the same kind of
question regardless of which API answers it.
Tiles by tileset id, plus the vector-tile lookup that keys off one: raster
from the Raster Tiles API, vector from the Vector Tiles API, and `query`
from the Tilequery API. Three operations, out of three different specs,
under one command group (#116) — a caller asking about a tileset is asking
the same kind of question regardless of which API answers it.

Not to be confused with [`mapbox tilesets-cli`](#tilesets-cli), which
forwards to the separately installed Python Tilesets CLI and shares
nothing with this but the word.

The three tile commands return bytes, so `--output` does not apply on
The two tile commands return bytes, so `--output` does not apply on
them — redirect to a file. `query` returns GeoJSON.

### `mapbox tilesets get-tile`
Expand Down Expand Up @@ -2355,44 +2343,6 @@ $ ls -l tile.mvt
</td></tr>
</table>

### `mapbox tilesets get-mrt`

One MRT tile from a raster-array job.

#### Parameters

`--jobid <jobid>` is required and comes from the raster-array job that
produced the tiles.

#### Examples

```sh
mapbox tilesets get-mrt --jobid <jobid> <tileset-id> 12 2048 1361 > tile.mrt
```

#### Outputs

Not exercised: this account has no raster-array job. A `--jobid` that does
not exist gets a 500 rather than a 404, so the error says nothing useful
about what was wrong:

<table>
<tr><th width="50%">Terminal — <code>-o text</code></th><th width="50%">Agent — <code>-o json</code></th></tr>
<tr><td>

```
Error: Internal Server Error (HTTP 500)
```

</td><td>

```json
{"code":"http_500","message":"Internal Server Error","status":500}
```

</td></tr>
</table>

### `mapbox tilesets query`

What features a vector tileset has at or near a point.
Expand Down
8 changes: 0 additions & 8 deletions openapi/api-accounts/tokens-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,6 @@ components:
description: The username of the account that owns the tokens.
schema:
type: string
TokenId:
name: token_id
in: path
required: true
description: The unique identifier of the token (the `id` field of a token object), not the token
string itself.
schema:
type: string
responses:
BadRequest:
description: The request was malformed — for example, the token string was supplied where a token
Expand Down
15 changes: 0 additions & 15 deletions openapi/api-fonts/fonts.production.v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,14 @@ servers:
security:
- AccessTokenQuery: []
tags:
- name: health
description: API health check
- name: fonts
description: Manage and retrieve custom fonts
- name: fontstacks
description: Retrieve Mapbox fontstack glyphs
- name: models
description: Retrieve 3D model assets
components:
securitySchemes:
AccessTokenQuery:
type: apiKey
in: query
name: access_token
parameters:
fresh:
name: fresh
in: query
required: false
schema:
type: boolean
description: If true, sets Cache-Control to no-cache.
schemas:
Error:
type: object
Expand Down Expand Up @@ -113,7 +99,6 @@ paths:
security:
- AccessTokenQuery: []
parameters:
- $ref: '#/components/parameters/fresh'
- name: owner
in: path
required: true
Expand Down
34 changes: 0 additions & 34 deletions openapi/api-gl/static-images.production.v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,22 +158,6 @@ components:
schema:
type: string
example: pin-s+ff0000(-118.2437,34.0522),pin-s+0000ff(-118.2537,34.0422)
bbox:
name: bbox
in: path
required: true
description: |
Bounding box as `[minlon,minlat,maxlon,maxlat]`. Coordinates are
WGS84 longitude/latitude. `minlon` must be less than `maxlon` and
`minlat` less than `maxlat`, otherwise the request returns `422`.

The square brackets may be sent literally or percent-encoded as `%5B`
and `%5D`; both are accepted. Note that `curl` treats `[` and `]` as
glob characters, so a literal bounding box on the command line needs
either the percent-encoded form or the `--globoff` flag.
schema:
type: string
example: '[-77.043686,38.892035,-76.933086,38.942035]'
lon:
name: lon
in: path
Expand Down Expand Up @@ -311,24 +295,6 @@ components:
schema:
type: string
example: waterway-label
padding:
name: padding
in: query
required: false
description: |
Padding in pixels around the overlay or bounding box. Accepts 1 to 4
comma-separated integers (CSS shorthand order: top, right, bottom,
left). Only applies to `auto` and bounding box positioning; using it on
any other endpoint returns `422`.

Left plus right padding must be less than `width`, and top plus bottom
padding must be less than `height`, otherwise the request returns
`422`.

Defaults to 5% of the smallest dimension, up to a maximum of 12 pixels.
schema:
type: string
example: 50,20,50,20
addlayer:
name: addlayer
in: query
Expand Down
Loading
Loading