# swb unschedule-deploy

Takes back the time a deploy was run for: the deploy is offered again, and
nothing deploys it at that time.

## Synopsis

```
usage: swb unschedule-deploy <deploy-id> --env <env> [--json]
```

## Arguments and flags

| Argument or flag | Takes | Default |
|---|---|---|
| `<deploy-id>` | The **deploy id** a [`swb run-deploy --at`](/command-line/run-deploy) queued. Required. | — |
| `--env` | An environment's **name or id**; a name is matched first. Required. | — |
| `--json` | Nothing. Prints the deploy as the API answered it instead of the table. | off |
| `--help`, `-h` | Prints the command's help and exits. | off |

## What it does

Calls `Mutation.unscheduleDeploy`. A deploy queued for a time that has not
started returns to `UPDATE_AVAILABLE`, its time cleared, and runs only when
someone runs it again. Taking back a deploy that is already offered changes
nothing, so the call takes no client token. A deploy that has started, or one
queued to run now, has no time to take back and is refused.

## What it prints

```
ID                                                  APP           VERSION  STATUS            AT  BY
crew-signout#beta0925#2026-09-12T08:00:00.000Z#d1  crew-signout  1.4.0    UPDATE_AVAILABLE  -   mruiz@lime-energy.com
```

`--json` prints the deploy as the API answered it.

## The operation and the permission

`Mutation.unscheduleDeploy`. The caller needs `swb.deploys.run` on the tenant.
`swb unschedule-deploy` also reads `Query.me` once for the tenant and
`Query.tenant` to turn the `--env` name into an id.

## Refusals and exit status

Exit status is 0 once the time is taken back, and 1 on every refusal below.

| Refusal | When |
|---|---|
| `swb unschedule-deploy takes <deploy-id>` | No deploy was named, or more than one. |
| `swb unschedule-deploy needs --env <env>` | `--env` was not given. |
| `no environment named "<env>" in tenant <tenant> (have: dev, staging, prod)` | No environment of the tenant has that name or id. |
| `not signed in or token expired — run swb login` | There is no usable credential. |
| `NotFound: Deploy <id> not found` | The tenant has no such deploy. |
| `Conflict: <id> is <STATUS>: only a queued deploy that carries a time and has not started can be unscheduled` | The deploy has started, finished, or was queued to run now. |
| `NotAuthorized: …` | The caller lacks `swb.deploys.run`. |

## Example

```console
$ swb unschedule-deploy crew-signout#beta0925#2026-09-12T08:00:00.000Z#d1 --env beta
```
