An operation records the outcome of work on a workspace, project, computer, database or checkpoint. An idempotency key identifies a request you may need to repeat. See Track and wait for operations for CLI steps.
Operation states
| State | Meaning |
|---|---|
running | Work remains pending. |
finished | Work succeeded. Terminal. |
failed | Work failed; error contains its code, message and details. Terminal. |
resource identifies the affected resource, including the new resource for a branch
or restore. Read its current state separately. Use the operation ID returned by
an asynchronous mutation or list operations.
A project's sleep, wake or branch (project.sleep, project.wake,
project.branch) has no work of its own. It finishes once every member's own operation has. If any member failed, it
ends failed with error.details.members, each failed member's id and
error, and the other members stay done.
Stopping a CLI wait does not cancel work. Waiting again observes the same operation; it does not restart a failed action. The worker's 15-minute deadline marks stalled work failed without undoing effects or deleting a created resource.
With --wait --json, a resource command prints its final resource state after
the work finishes. Completed deletion is represented by state: deleted.
Asynchronous responses include operation details and the original operations
IDs. A command that completes synchronously does not add an operation field.
Without --wait, the CLI checks a returned operation once without polling. If
that check fails, operation contains only its ID, so the accepted work can still
be followed.
After a successful database create or branch with --wait, reading its connection
can still fail. The CLI keeps the created database and operation result alongside
that error and exits with the connection error's status. Under --json, that
result is in the error document's error.result and stdout is empty. Use
nevia pg connect for the created database instead of repeating creation. See
Connections and credentials
for the JSON fields and credential availability rules.
An incompatible action can return 423 operation_in_progress with an operation ID,
or 409 invalid_state. Clients do not automatically retry these errors.
On 401, the CLI refreshes credentials and retries the request once, including
during polling. If authentication still fails, accepted work continues.
Restore access, then wait on the same operation as described in
Track and wait for operations.
Request identity
| Request | Idempotency-Key |
|---|---|
| Computer/database create | Required. |
| Branch (computer, database or project), restore, checkpoint/workspace create, password reset | Required. |
| Create access / invite by email | Required; replay never refreshes the invite or resends mail. Use a new action to resend. |
| Secret create and version update, variable create, key rotation and current-key revocation | Required. Secret values are excluded from request hashes; reusing a key with another value replays the first result. |
| Destination create | Required. Header values are excluded from request hashes, like secret values. |
| Settings, variable and destination updates, resource-id DELETE, sleep, wake | Omitted; resource identity protects repeated actions. |
| Exec | Omitted; never replayed after possible dispatch. |
CLI, Console and MCP generate keys internally, once per action. CLI users do not supply or override them. An automatic transport retry preserves the key, method, path and body. Starting the command again creates a new request identity and can start new work. Resource IDs are generated by the API.
The API reserves each principal/key in the database before effects, across replicas:
- Same input: return the recorded status and body, including any operation ID.
- Different input: 409
idempotency_conflict. - Still unresolved: wait up to 10 seconds, then 409; no second copy within the window.
- Failed attempt: retain its failure under the key. A proven safe 503 refusal
allows another attempt; a proven safe 429 refusal allows one after
Retry-After. Both require the same key and input and keep the original key expiry.
Keys expire 10 minutes after admission, or 120 seconds after success or terminal
failure, whichever is earlier. Reusing an expired key can start new work, including
when the original outcome remains unknown. The API tracks at most 100,000 requests
across replicas. New keys at capacity receive 429 rate_limited and Retry-After
of 600–630 seconds; existing keys can still replay.
Authentication and authorization still apply to every request.
Database create replays redact connection; password-reset replays redact secrets.
Use Get connection to read current credentials.
Retries
The replay guarantee applies within the retained window, whether a client retries automatically or the caller repeats a request. A proven refusal before dispatch with successful rollback can be retried under the same key. Other failures are replayed. Once an execution stream opens, it is never replayed.
Listing operations requires access to the workspace. Reading one by ID also allows the principal who started it, even after workspace deletion. See Workspace permissions.
The response's X-Request-ID identifies the current HTTP request for diagnosis.
The API generates a fresh ID for every request, including retries, and ignores
incoming request IDs. Error bodies do not include the ID. It does not replace
an operation ID or an idempotency key. See request IDs and client updates.