> For the complete documentation index, see [llms.txt](https://docs.fylr.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fylr.io/for-developers/api/endpoints/api-schema.md).

# /api/v1/schema

The **schema** endpoint exposes the JSON-Schema view of a datamodel version — the structural description that `/api/db` and `/api/search` validate against. The same datamodel can also be rendered as a diagram via `?format=svg` / `?format=png`.

`version` can be:

* `HEAD` — the working copy (uncommitted edits).
* `CURRENT` — the most recently committed version. Resolved server-side; equivalent to the highest committed number.
* a positive integer pointing at a specific committed version.

Reading requires only an authenticated user; no `system.datamodel` right is needed.

### `GET /schema/user/{version}` — Retrieve a datamodel snapshot.

{% openapi src="/files/kfiDjhyZfEICNBmt5f49" path="/schema/user/{version}" method="get" %}
[fylr-openapi.yml](https://4100607288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAdRFzQASDY2Elfdm3wXW%2Fuploads%2Fgit-blob-27a76749464f8079ac8ce2ee65518544084ed6fa%2Ffylr-openapi.yml?alt=media)
{% endopenapi %}

### `POST /schema/user/HEAD` — Update the working datamodel (`HEAD`).

{% openapi src="/files/kfiDjhyZfEICNBmt5f49" path="/schema/user/HEAD" method="post" %}
[fylr-openapi.yml](https://4100607288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAdRFzQASDY2Elfdm3wXW%2Fuploads%2Fgit-blob-27a76749464f8079ac8ce2ee65518544084ed6fa%2Ffylr-openapi.yml?alt=media)
{% endopenapi %}

### `POST /schema/commit` — Commit the working datamodel (`HEAD`).

{% openapi src="/files/kfiDjhyZfEICNBmt5f49" path="/schema/commit" method="post" %}
[fylr-openapi.yml](https://4100607288-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAdRFzQASDY2Elfdm3wXW%2Fuploads%2Fgit-blob-27a76749464f8079ac8ce2ee65518544084ed6fa%2Ffylr-openapi.yml?alt=media)
{% endopenapi %}
