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

> ## Agent Instructions
> Agent home for Datum, with what it is, pricing, and how to act: https://agents.datum.net
> If you can only fetch URLs: read https://www.datum.net/docs/llms.txt in full and open the most specific page for the task. Commands, limits, and field paths are on task, operations, and limits pages, not on section overviews. Pages described as "Documentation is coming soon" are placeholders.
> If you have a shell or can save files: download https://www.datum.net/docs/llms-full.txt (every page, about 740 KB) once and search it with grep, instead of fetching pages one at a time.
> datumctl describes itself: `datumctl api-resources` lists resource types and `datumctl explain <resource>` shows a schema. To act on live resources, use Datum MCP or datumctl. To search the docs, use the Docs MCP server at https://www.datum.net/docs/mcp.

# Changing resources

> Create, update, and delete Datum Cloud resources — with declarative apply as the primary workflow.

`datumctl` treats your Datum Cloud infrastructure as declarative configuration: you describe the state you want in a manifest, store it in source control, and let the CLI reconcile the platform to match. The same handful of write verbs — `apply`, `create`, `edit`, and `delete` — work across every resource type, so once you learn them you can change anything the platform exposes.

> [!NOTE]
>
> Every write runs against your active scope. Use `--organization` or `--project` to target a context, and see [Contexts & scoping](https://www.datum.net/docs/datumctl/contexts-and-scoping.md) for how a command decides where it acts. Run `datumctl ctx` to check your active context before making changes.

## Apply is the primary workflow

`datumctl apply` is the recommended way to manage resources. You give it a manifest describing the state you want; if the resource does not exist it is created, and if it already exists it is updated to match. Because apply is idempotent, you can run the same command as many times as you like and converge on the same result.

```bash theme={null}
# Apply a single manifest
datumctl apply -f ./proxy.yaml --project your-project-id --namespace default

# Apply every manifest in a directory
datumctl apply -f ./infra/ --organization your-org-id

# Apply from stdin
cat dnszone.yaml | datumctl apply -f - --project your-project-id
```

Manifests are YAML or JSON. Multiple resources can live in a single file separated by YAML document markers (`---`), and each manifest must set the correct `apiVersion` and `kind` for its resource type.

> [!TIP]
>
> Keep your manifests in version control and apply them from CI/CD. Treating network and platform configuration as code gives you review, history, and repeatable deployments — and lets you rebuild state from the same source at any time.

A typical declarative loop looks like this:

**1. Author or edit a manifest**

Describe the resource you want in a `.yaml` file. Not sure which fields a type takes? Inspect the schema first with `datumctl explain <type>`.

**2. Preview the change**

Run `datumctl diff -f ./proxy.yaml` to see exactly what the platform would change before you write anything. See [Safe changes](https://www.datum.net/docs/datumctl/resources/safe-changes.md).

**3. Apply it**

`datumctl apply -f ./proxy.yaml` creates or updates the resource to match your manifest.

**4. Verify the result**

`datumctl get <type> <name> -o yaml` confirms the live state matches what you intended.

> [!WARNING]
>
> Preview before you write. Run `datumctl diff -f` to see the server-computed changes, and add `--dry-run=server` to `apply` to validate a manifest against the API without persisting anything. [Safe changes](https://www.datum.net/docs/datumctl/resources/safe-changes.md) covers both.

## Create from a manifest

`datumctl create` provisions a new resource from a manifest. Unlike `apply`, it does not update an existing resource — if a resource of the same name already exists, the create fails. Reach for `create` when you specifically want to fail loudly on a name collision; reach for `apply` for idempotent create-or-update.

```bash theme={null}
# Create a project from a manifest
datumctl create -f ./project.yaml --organization your-org-id

# Create from stdin
cat dnszone.yaml | datumctl create -f - --project your-project-id

# Validate without creating
datumctl create -f ./project.yaml --organization your-org-id --dry-run=server
```

## Edit a resource in place

`datumctl edit` fetches a resource, opens it in your local text editor, and applies whatever you save back to the platform. It is convenient for quick, one-off changes when you do not have a manifest on disk.

```bash theme={null}
# Edit a project
datumctl edit project your-project-id --organization your-org-id

# Edit a DNS zone in a chosen editor
EDITOR="code --wait" datumctl edit dnszone my-zone --project your-project-id --namespace default

# Edit in JSON instead of the default YAML
datumctl edit project your-project-id --organization your-org-id -o json
```

The editor is chosen from the `EDITOR` environment variable (the CLI also honors `KUBE_EDITOR`), falling back to `vi` on Linux/macOS or `notepad` on Windows. Changes are applied when you save and close the file. If the resource was modified server-side while your editor was open, `datumctl` detects the conflict and saves your edits to a temporary file so you can reconcile them.

> [!NOTE]
>
> For changes you want to keep and repeat, prefer editing a manifest and running `datumctl apply` — that keeps your source of truth in version control. Use `edit` for exploratory or one-time tweaks.

## Patch individual fields

`datumctl patch` changes one or more fields of a live resource in a single command, without rendering and applying a full manifest. Pass the patch inline with `-p`, or from a file with `--patch-file`. You can write patches in JSON or YAML.

```bash theme={null}
# Change a single field with a merge patch
datumctl patch workload my-app -p '{"spec":{"replicas":2}}' --project your-project-id

# Write the patch as YAML
datumctl patch workload my-app -p $'spec:\n  replicas: 2' --project your-project-id

# Patch a resource identified by a manifest file
datumctl patch -f ./workload.yaml -p '{"spec":{"replicas":2}}' --project your-project-id

# Use a JSON patch for precise, positional edits
datumctl patch workload my-app --type=json -p '[{"op":"replace","path":"/spec/replicas","value":2}]' --project your-project-id
```

Choose the patch format with `--type`:

| Type | Format | When to use it |
| - | - | - |
| `merge` (default) | A JSON merge patch: a partial document whose fields replace the matching fields of the live resource. | Nearly every change. |
| `json` | A JSON patch: an ordered list of operations (`add`, `replace`, `remove`, and others) with explicit paths. | Precise edits to items inside lists. |

## Add, change, or remove labels and annotations

`datumctl label` and `datumctl annotate` update the metadata on one or more live resources. Labels organize and select resources, for example with the `-l` flag of `datumctl get` and `datumctl delete`. Annotations are free-form key/value metadata that is not used for selection. Use annotations to record notes or to nudge a resource, for example setting a fresh annotation on a workload to trigger a rollout.

Both commands take the same arguments:

* Pass `KEY=VALUE` to add a label or annotation.
* Pass `KEY-` (a trailing dash) to remove one.
* Add `--overwrite` to change a key that already exists. Without it, `datumctl` leaves an existing key untouched.
* Add `--list` to show the current labels or annotations on a resource.

```bash theme={null}
# Add a label to a workload
datumctl label workload my-app tier=frontend --project your-project-id

# Change a label that already exists
datumctl label workload my-app tier=backend --project your-project-id --overwrite

# Remove a label
datumctl label workload my-app tier- --project your-project-id

# Label every DNS zone matching a label selector
datumctl label dnszones -l team=platform env=prod --project your-project-id

# Add an annotation to a workload
datumctl annotate workload my-app restart=now --project your-project-id

# Show the annotations on a project
datumctl annotate project your-project-id --list --organization your-org-id
```

> [!TIP]
>
> `patch`, `label`, and `annotate` all accept `--dry-run=server`. Combine it with `-o yaml` to validate the change against the API server and preview the result without persisting anything:
>
> ```bash theme={null}
> datumctl patch workload my-app -p '{"spec":{"replicas":2}}' --project your-project-id --dry-run=server -o yaml
> ```

## Delete a resource

`datumctl delete` removes one or more resources, selected by type and name, by label selector, or from a manifest file.

```bash theme={null}
# Delete by name
datumctl delete project your-project-id --organization your-org-id

# Delete from a manifest
datumctl delete -f ./my-resource.yaml --organization your-org-id

# Delete everything matching a label selector
datumctl delete dnszones -l app=my-app --project your-project-id
```

> [!WARNING]
>
> `datumctl delete` has **no confirmation prompt** — it deletes immediately. It also does not perform a version check first, so a delete proceeds even if the resource changed after you last fetched it. Preview what would be removed with `--dry-run=client` before you commit:
>
> ```bash theme={null}
> datumctl delete project your-project-id --organization your-org-id --dry-run=client
> ```

## Namespaces

Many project-scoped resources live in a namespace. The examples above target the `default` namespace with `--namespace default`; if a command targets `default`, you can omit the flag. Currently only `default` is supported. Which organization or project a write acts on is covered in [Contexts & scoping](https://www.datum.net/docs/datumctl/contexts-and-scoping.md).

## Next steps

* [Safe changes & declarative config](https://www.datum.net/docs/datumctl/resources/safe-changes.md) — preview every change with `datumctl diff -f` and `--dry-run=server` before it touches live infrastructure.
* [Discovering resources & schemas](https://www.datum.net/docs/datumctl/discovering-resources.md) — find resource types and inspect their fields with `explain` and `api-resources` before authoring a manifest.
* [Reading resources](https://www.datum.net/docs/datumctl/resources/reading.md) — verify the result with `datumctl get` and `datumctl describe` after a write.
* [Contexts & scoping](https://www.datum.net/docs/datumctl/contexts-and-scoping.md) — control which organization or project a change targets.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.