CLI Reference
pikeway runs stop
Stop a background run that is still queued or running.
Synopsis
bash
pikeway runs stop -r <run-id> [--json] pikeway runs stop <run-id>
Description
Calls POST /v1/runs/<id>/stop and prints the run's status afterwards, normally STOPPED. If the run happened to finish while it was being stopped, you get that final status instead.
- Only background runs (ids starting with
run_, started with--asyncor--wait) can be stopped. Synchronous calls finish before the command returns. - A stopped run is not charged unless the upstream call had already completed.
- Needs a key, and the run must belong to the same account.
Options
--run, -rstringrequiredId of the background run. Can also be given as the first word after stop.
Examples
bash
# stop a run you started with --async pikeway runs stop -r run_5f0c2b7e9a4d4e1b8c3a6f2d1e0b9a87 # positional id pikeway runs stop run_5f0c2b7e9a4d4e1b8c3a6f2d1e0b9a87 # stop every background run that is still running pikeway runs list --async --json | jq -r '.items[] | select(.status == "RUNNING" or .status == "QUEUED") | .runId' \ | xargs -n1 pikeway runs stop -r
Output
text
STOPPED · run run_5f0c2b7e9a4d4e1b8c3a6f2d1e0b9a87
--json
json
{
"runId": "run_5f0c2b7e9a4d4e1b8c3a6f2d1e0b9a87",
"status": "STOPPED"
}Errors and exit codes
| Exit | Message | When |
|---|---|---|
| 2 | usage: pikeway runs stop -r <run-id> | No -r and no positional id. |
| 1 | run not found (only async runs can be stopped) | Unknown id, an id from another account, or the id of a synchronous call. |
| 1 | run already finished | The run is no longer queued or running. With --json, details.status has its final status. |
| 3 | no API key: run `pikeway keys add --label main --key pk-...`, set PIKEWAY_API_KEY, or pass --key | No --key, no PIKEWAY_API_KEY and no saved active key. Checked before any request is sent. |
| 3 | invalid or revoked API key — add a key with `pikeway keys add --label main --key pk-...` (or use --x402) | The gateway answered 401 (unknown, revoked or expired key). A 403 also exits with 3. |
| 1 | cannot reach <gateway>: ECONNREFUSED | The gateway could not be reached (DNS, network, wrong PIKEWAY_API_BASE_URL). The code after the colon comes from Node. |