> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/resources/reporters/currents-cmd/currents-run-get.md).

# currents run get

Get the data of a Currents run by CI build ID, or the last run of a branch or tag, with the currents run get command

`currents run get` gets the data of a run from the Currents REST API and prints it as JSON. It finds the run by its [CI Build ID](/guides/parallelization-guide/ci-build-id.md), or the last run of a branch, a tag or both.

## Usage

Run the commands on this page in a project that installs `@currents/cmd`. Elsewhere, replace `npx currents` with `npx --package @currents/cmd@2 currents`.

{% hint style="info" %}
The command needs an [API key](/dashboard/administration/api-keys.md) and the project ID, passed as `--api-key` and `--project-id`, or set as `CURRENTS_API_KEY` and `CURRENTS_PROJECT_ID`.
{% endhint %}

Get the run recorded under a CI build ID and save it to a file:

```bash
npx currents run get --api-key <api-key> --project-id <project-id> --ci-build-id <ci-build-id> --output run.json
```

Get the last run of a branch with the tags `tagA` and `tagB`:

```bash
npx currents run get --api-key <api-key> --project-id <project-id> --branch <branch> --tag tagA,tagB
```

Save the failed tests of a run where Playwright reads them, for `playwright test --last-failed`:

```bash
npx currents run get --api-key <api-key> --project-id <project-id> --ci-build-id <ci-build-id> --pw-last-run --output test-results/.last-run.json
```

The output is the `data` of [the run in the REST API](https://docs.currents.dev/api/resources/runs). Without `--output`, the JSON is the only output on stdout, so you can pipe it to another command.

## Options

| Option                  | Environment variable   | Description                                                                                                                                                         |
| ----------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--api-key <api-key>`   | `CURRENTS_API_KEY`     | An API key from the Currents dashboard. Required.                                                                                                                   |
| `-p, --project-id <id>` | `CURRENTS_PROJECT_ID`  | The project ID from the Currents dashboard. Required.                                                                                                               |
| `--ci-build-id <id>`    | `CURRENTS_CI_BUILD_ID` | The CI build ID the run was recorded with. It cannot be combined with `--branch` or `--tag`. The environment variable is ignored when `--branch` or `--tag` is set. |
| `-b, --branch <branch>` |                        | Find the last run of this git branch.                                                                                                                               |
| `-t, --tag <tag>`       |                        | Find the last run with these tags. Comma-separated or repeated.                                                                                                     |
| `-o, --output <path>`   | `CURRENTS_OUTPUT`      | Write the JSON to this file instead of stdout.                                                                                                                      |
| `--pw-last-run`         |                        | Print only the status and the failed tests of the run, in the format of Playwright's `.last-run.json`.                                                              |
| `--debug`               | `CURRENTS_DEBUG`       | Print debug logs. Keys are hidden in them. Default: `false`.                                                                                                        |

To get other data, such as a list of runs, use [currents api](/resources/reporters/currents-cmd/currents-api.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.currents.dev/resources/reporters/currents-cmd/currents-run-get.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
