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

# canonicalize

> Return the canonical form of an Action: UTF-8 JSON, sorted keys, no whitespace.

`ctrlrun.canonicalize` — function, defined at `src/ctrlrun/action.py:264`

```python theme={null}
def canonicalize(action: Action) -> bytes
```

Return the canonical form of an Action: UTF-8 JSON, sorted keys, no whitespace.

`action_id` and timestamps are excluded; the schema tag is included (SPEC-v0.1 §2.2). The
encoding is `canonical_bytes`'s, and calling through is what makes that one implementation
rather than two (SPEC-v0.6 §6.2).

## Next

* [Python API index](/reference/api/index).
* [Get started](/get-started/quickstart) · [Why](/why).


## Related topics

- [canonical_bytes](/reference/api/canonical_bytes.md)
- [Threat model](/THREAT_MODEL.md)
- [Claims](/CLAIMS.md)
- [Python API](/reference/api/index.md)
