# History

`mapbox history` shows the runs the CLI recorded on this machine over the last 30 days (up to 10 MB): which command ran, how it ended, how long it took, and the request IDs Mapbox support can look up. Argument values are never recorded, so a run shows as its command path — `mapbox search forward`, not what was searched for. Neither command makes a request or needs a token, and neither is itself recorded; nor are `--help`, `--version`, `completion` or a run under `sudo`.

History is on by default. Turn it off with [`mapbox config set history off`](https://docs.mapbox.com/ja/cli/reference/config/); both commands then find nothing and say why on stderr. History is also how you read a run's diagnostic log, captured after you run `mapbox config set log on`: `history show` includes it while it's still kept.

-   [`mapbox history list`](#mapbox-history-list)
-   [`mapbox history show`](#mapbox-history-show)

## `mapbox history list`

Lists the most recent runs, newest first: a short ID, when it ran (UTC), its exit code and its command path, with `[log]` after a run whose diagnostic log was captured. `-o json` gives each run's full `id`.

**Parameters:**

| Parameter | Description |
| --- | --- |
| `--limit` | How many runs to list. Defaults to `20`; `0` lists every recorded run. |

**Examples:**

```sh
mapbox history list
mapbox history list --limit 0
mapbox history list -o json
```

## `mapbox history show`

Shows everything recorded about one run: its command path, exit code and duration, its error code, how many requests it made and the IDs of the last five. When a diagnostic log was captured and is still kept, it's included: the command line with tokens redacted, which token was used, each request and the error message. Otherwise the output says whether logging was off for that run or the log has since expired or been removed to keep logs under 100 MB.

An ID that names no run fails with `history_not_found`, a prefix shared by several runs fails with `history_ambiguous_id`, and `show` with nothing recorded yet fails with `history_empty`.

**Parameters:**

| Parameter | Description |
| --- | --- |
| `[id]` | The run's ID, or any prefix of it that names one run. Defaults to the newest run. |

**Examples:**

```sh
mapbox history show
mapbox history show 2c67e6a1
mapbox history show 2c67e6a1 -o json
```