Schema
A schema defines validation rules for ledger records using JSON Schema format. Schemas enforce constraints on the custom and data fields of records at creation and update time.
Schema enforcement activates per resource type after the first schema is created for that type. Before that, records of that type are untyped and accept any structure. Once a schema exists, all new records of that type must reference a valid schema.
Existing untyped records are not affected until their next update — at that point they must conform to a valid schema or the update is rejected.
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /schemas | Define a new validation schema to enforce rules on ledger records. |
| GET | /schemas | Query schemas with filtering, sorting, and pagination. |
| GET | /schemas/{id} | Retrieve a schema by its handle or LUID. |
| PUT | /schemas/{id} | Submit a new version of a schema. |
| POST | /schemas/{id}/proofs | Submit a signed proof to a schema record. |
Access & History
| Method | Path | Description |
|---|---|---|
| POST | /schemas/{id}/access/!check | Evaluate what actions a signer can perform on this schema. |
| GET | /schemas/{id}/changes | Retrieve the change history of a schema by its handle or LUID. |
| GET | /schemas/{id}/changes/{change} | Retrieve a change record for a schema by handle or LUID and change number. |
Related
- About Schemas — how schemas validate and structure records
- Custom Fields — defining custom data structures on records
- About Layouts — using schemas with layout templates
Get policy change GET
Returns a single change by its sequence number. The change includes a full record snapshot as it existed at that point.
Create schema POST
Once the first schema for a resource type is created, all new records of that type must reference a valid schema. Existing records remain valid until updated, at which point they must conform to a valid schema. Schemas use JSON Schema format and support standard features including type constraints, `required` fields, `oneOf`/`anyOf` composition, `$ref` references, and `enum` values. Broadcasts the `schema-created` signal. Use [effects](/ledger/reference/api/effect) to subscribe.