# Operations

> Follow an API command from acceptance to completion, and handle delays or failures.

Source: https://docs.thalovant.com/developers/operations/

---
Some API commands continue after the HTTP request returns. Their response includes an `operation` object and a `links.self` URL. Wait for the operation to finish before using the changed resource.

## Status Sequence

1. **`requested`** means your command was accepted.
2. **`committed`** means the requested configuration has been saved.
3. **`applied`** means the configuration has been applied; the resource may still be starting.
4. **`ready`** means the resource is ready to use.

`failed` and `timed_out` are terminal. Read `error_code` and `error_message` before retrying. Reuse the original idempotency key when retrying an ambiguous acceptance response.

## Poll An Operation

```bash
curl --fail-with-body \
  -H "Authorization: Bearer $THALOVANT_TOKEN" \
  https://api.thalovant.com/v1/operations/OPERATION_ID
```

Poll with bounded backoff. Stop on `ready`, `failed`, or `timed_out`. For commands that only save configuration, `committed` can be the final state. Follow the completion state documented for the command you called.

  Operation reads are private: you can read only the operations your own account started. An unknown ID, or one belonging to somebody else, returns `404` either way.

The Python, Node, Go, and Rust SDK control-plane clients expose `get_operation` or `getOperation` using their language naming convention.
