# Deploying with toft

> The everyday commands, and the exit codes a pipeline relies on.

Source: /toft-docs/latest/user/cli/deploying/

From your project folder:

```bash
toft link my-app     # once: record which app this folder deploys to
toft deploy          # bundle the folder, deploy it, wait for the build
```

Add `--verify /` to fail unless the page answers once the deploy succeeds, or run
`toft check` first to find out whether the deploy would be refused, without
deploying.

What gets sent and how the app is chosen is on [From your machine](/toft-docs/latest/user/deploy/from-your-machine.md). To make a new app, run `toft create`; add `--repo <url>` to build from a repository, and `--subdir <folder>` to build one folder of it.

## Everyday commands

| Command | What it does |
|---|---|
| `toft apps` | The apps you can see (`--mine` for your own) |
| `toft whoami` | Who you are signed in as, and what this install lets you do |
| `toft check` | Whether a deploy of this folder would be refused, without deploying |
| `toft status` | What is serving, since when, from where, and which deployment |
| `toft fetch /path` | Request a page of your app as you; `--anonymous` as a stranger |
| `toft logs` | The app's log; `--follow` to stream, `--deploy <id>` for a build |
| `toft events` | What has gone wrong with the app |
| `toft redeploy` | Rebuild from the app's own source — its repository, or what was last uploaded |
| `toft rollback` | Make an earlier deployment current again; by default the one before what is serving |
| `toft restart` · `start` · `stop` | Lifecycle; `--wait` waits until it is up |
| `toft deps` | Why the dependency policy refused a deploy, and what fixes it |
| `toft env` | List, set and unset [environment variables](/toft-docs/latest/user/run/settings.md); `--restart` applies them |
| `toft visibility` | Print or change [who can see the app](/toft-docs/latest/user/share/visibility.md) |
| `toft deployments` | List old deployments, or delete them |
| `toft delete <slug>` | Delete the app; there is no undo |
| `toft job` | Run [jobs](/toft-docs/latest/user/automation/jobs.md), rerun them, wait for them and read their logs |
| `toft store` | Files in a store: `ls`, `put`, `get`, `rm` |
| `toft sdk vendor` | Copy the [app SDK](/toft-docs/latest/user/cli/sdk.md) into your project |
| `toft api GET apps` | Call any API route with your stored credential |
| `toft skill` | Print the instructions for a coding agent |

Every command takes `--help` and `--json`. Flags can go before or after positional arguments. Full reference: [Commands](/toft-docs/latest/cli/cli/commands.md) in the CLI & SDK guide.

## In a pipeline

`toft deploy`, `toft job run` and `toft restart --wait` wait for the outcome and fail the step if it fails. `toft` never prompts without a terminal; a command that needs confirmation, such as `toft rollback`, needs `--yes`.

| Exit code | Meaning |
|---|---|
| `0` | It worked |
| `1` | The platform tried and it failed — a build, or a job run that did not succeed — or another deploy is still queued |
| `2` | Usage or configuration — no app linked, a bad flag, an unknown or already-taken name, a locked app |
| `3` | Not authenticated, or refused — including by the app's state, such as a locked app |
| `4` | Could not reach the install |

With `--json`, output is one JSON document per line, and a refusal is a JSON object too. See [CI and automation](/toft-docs/latest/cli/cli/ci.md) and [Exit codes](/toft-docs/latest/cli/cli/exit-codes.md).
