> ## Documentation Index
> Fetch the complete documentation index at: https://s2.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Apply

> Apply a JSON spec with the S2 CLI to create or update basins and streams, with a dry run before making changes.

Reads a JSON spec file and ensures the declared basins and streams exist with the specified configuration. Resources that already exist are reconfigured to match the spec, and only the fields present in the spec are updated.

```bash theme={null}
s2 apply -f spec.json
```

## Flags

| Flag         | Description                                                     |
| ------------ | --------------------------------------------------------------- |
| `-f, --file` | Path to the JSON spec file (required unless `--schema` is used) |
| `--dry-run`  | Preview changes without making any mutations                    |
| `--schema`   | Print the JSON Schema for the spec format to stdout             |

For the spec file format, configuration fields, IDE setup, and dry run output, see [Declarative Spec](/infra/declarative-spec).
