API v1
v1
View as Markdown

List template versions

GET /api/v1/templates/{template}/versions

List the versions of one template, newest first.

Every change to a structure produces a version rather than editing one, so this is the whole history of the template and the record of what was frozen when. A published version never changes again, which is what lets a record made a year ago go on rendering exactly as it did.

At most one version is a draft at a time. Publishing a later version does not change an earlier one, so several versions read as published and the template says which one is current. Each keeps its record_count for as long as anything is still on it.

This answers with the versions and not with what they contain. Read one version to get its pages, its sections and its fields.

This endpoint also answers QUERY, with the same parameters sent in the request body. How QUERY works.

Parameters

Sent as JSON. Anything not listed here is ignored.

template uuid Required

The id of the template. A path that is not a uuid answers 404 without a query being run, so neither the slug nor a sequential number reaches anything here.

page integer Optional default: 1

Which page to answer with.

per_page integer Optional default: 25

How many one page holds, between 1 and 100. A number outside the range is brought back into it rather than refused.

Returns

A page of version objects, newest first, and how many there are in all. A template belonging to somebody else answers 404.

data array

The versions on this page. An empty list rather than an error when there are none.

data[] object

One version.

data[].type string

Always structure_version. It names the kind of record, so a caller holding several kinds can tell them apart without looking at where they came from.

data[].id string

The id of this record, as a string even when it reads as a number. It is what every endpoint naming this record takes.

data[].attributes object

Everything the record holds.

data[].attributes.version_number integer

Which version this is within its template, counting from 1. It is what the address of this version takes, and what a change note refers to.

data[].attributes.status string

Either draft or published. A draft is still being designed and may be changed freely. A published version is frozen and never changes again, and stays published after a later version replaces it, so read published_version_number on the template to know which one a new record is put on.

data[].attributes.change_note string

What changed since the version before, written when this one was published, or null on a draft and on the first version of a template. It is what somebody deciding whether to move their records reads.

data[].attributes.published_at timestamp

When the version was frozen, as a count of seconds, or null while it is a draft.

data[].attributes.retired_at timestamp

Always null. Publishing a later version does not retire the one it replaces, because the records still on it go on working exactly as they did.

data[].attributes.record_count integer

How many records point at this precise version. A record follows the version it was put on until somebody moves it deliberately, so a retired version keeps a count above zero for as long as anything is still on it.

data[].attributes.previous_version_number integer

The number of the version this one was started from, or null on the first version of a template.

data[].attributes.created_at timestamp

When the version was started, as a count of seconds.

data[].attributes.updated_at timestamp

When it last changed, as a count of seconds. Equal to created_at until it first changes. A published version never changes, so this stops moving at publication.

data[].links object

Where to find this record.

data[].links.self string

The absolute address this record is read from.

meta object

Where you are in the collection.

meta.page integer

The page this is, counting from 1.

meta.per_page integer

How many one page holds, which is the size that was asked for once it has been brought into the allowed range.

meta.total integer

How many versions there are in all, not how many are on this page.

Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in X-RateLimit-Remaining.

GET
curl https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions \
-H "Authorization: Bearer $MONICA_TOKEN"
const response = await fetch('https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions', {
headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
$response = Http::withToken($token)->get('https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions');
Response 200
{
"data": [
{
"type": "structure_version",
"id": "318",
"attributes": {
"version_number": 4,
"status": "draft",
"change_note": null,
"published_at": null,
"retired_at": null,
"record_count": 0,
"previous_version_number": 3,
"created_at": 1756425600,
"updated_at": 1756425600
},
"links": {
"self": "https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions/4"
}
},
{
"type": "structure_version",
"id": "312",
"attributes": {
"version_number": 3,
"status": "published",
"change_note": "Added the medical page.",
"published_at": 1756339200,
"retired_at": null,
"record_count": 84,
"previous_version_number": 2,
"created_at": 1756335600,
"updated_at": 1756339200
},
"links": {
"self": "https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions/3"
}
}
],
"meta": {
"page": 1,
"per_page": 25,
"total": 2
}
}

Keys act as you, with exactly the access you have. Make one per integration so you can revoke it alone.