# div stop

> Stop a run and print what it cost.

## Synopsis

```text
div stop <run> [flags]
```

Stops the run, marks it `canceled`, and prints its duration and final cost.

## Arguments

| Argument | Description |
| --- | --- |
| `<run>` | Run name or ID. One run per call. |

## Flags

| Flag | Description | Default |
| --- | --- | --- |
| `--json` | Print the stopped run as JSON. | |
| `--token <key>` | API key to use. | see [Configuration](https://docs.divergentlabs.xyz/compute/cli/configuration.md) |
| `--api-url <url>` | API URL to use. | see [Configuration](https://docs.divergentlabs.xyz/compute/cli/configuration.md) |

## Behavior

- The printed cost is final. Runs are billed per minute with a one-minute minimum, so a run stopped in its first minute is billed for one minute.
- The run's log stays available through `div logs`. Files the run wrote to a volume stay on the volume.
- If the run has already finished, `div stop` changes nothing, prints how the run ended, and exits `0`.

## Output

```text
run-7 was canceled after 4m 0s, $0.33 spent
```

## Exit codes

| Code | Meaning |
| --- | --- |
| `0` | The run was stopped, or had already finished. |
| `1` | The API rejected the request. |
| `2` | Invalid arguments. |

## Examples

```bash
div stop run-7
div stop run-7 --json
div runs --status active --project lora-sweep | cut -d' ' -f1 | xargs -n1 div stop
```
