# `once build`

Build a declared target.

## Synopsis

```text
once build [OPTIONS] [TARGET]
```

## Description

Resolves the target id against the workspace graph, ensures every transitive dep is built first, and executes the target's `build` capability through the action cache. Targets that match a cached action key reuse the prior outputs; everything else runs and lands its declared outputs in `<workspace>/.once/out/<target>/`. Use `once query targets` to list available ids. With no target and no `--all`, Once builds every workspace-owned target that exposes `build`, in id order, and fails fast when one build fails. Pass `--all` to include every build-capable target in the loaded graph, including targets reached through vendored dependencies.

## Arguments

| Argument | Required | Description |
| --- | --- | --- |
| `<TARGET>` | no | Target id, such as `services/api/Api` or `./Api`. Omit it to build every workspace-owned build target discovered in the graph. |

## Options

| Flag | Value | Default | Description |
| --- | --- | --- | --- |
| `--sandbox` | `<SANDBOX>` | `off` | Local filesystem sandbox policy for command actions. |
| `--config` | `<KEY=VALUE>` |  | Override the workspace build configuration. Recognized keys are `os`, `arch`, and `token` (repeatable), supplied as `KEY=VALUE`. Targets configured with `select` resolve against the merged configuration, and their outputs are scoped so different values never collide. |
| `--ui` | (flag) |  | Start the local Runs interface for this Once build. |
| `--all` | (flag) |  | Build every build-capable target in the loaded graph, including targets reached through vendored dependencies. Without it the targetless default builds only workspace-owned targets. |
