API v1
v1
View as Markdown

Publish a version

PUT /api/v1/templates/{template}/versions/{version}/publication

Freeze a draft and make it the version a new record is put on.

This is the moment the structure stops moving. From here the version never changes again, and any further work starts another draft beside it. Records already on an earlier version stay on it and go on working exactly as they did, until somebody moves them deliberately.

Any section the version carries that is still a draft is published along with it, since a frozen version cannot rest on something that is still moving.

A change note is required from the second version of a template onwards, because it is what somebody deciding whether to move their records reads. The first version of a template needs none, having replaced nothing.

A version with no page, or with a page that has nothing on it, is refused: a structure nobody can fill is not one.

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.

version integer Required

The number of the version within its template, counting from 1, which is the number shown in the version history and the number a change note refers to. It is not a row id, so version 1 of one template and version 1 of another are different things reached through different templates.

change_note string Optional

What changed since the version before. Up to 65535 characters. Required from the second version of a template onwards.

Returns

The version, now published. A version that is not a draft answers 422, and so does one with an empty page or no page at all. A template belonging to somebody else answers 404.

data object

The 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.

Rate limit

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

PUT
curl https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions/4/publication \
-X PUT \
-H "Authorization: Bearer $MONICA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"change_note": "Added the medical page."
}'
const response = await fetch('https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions/4/publication', {
method: 'PUT',
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
change_note: 'Added the medical page.',
}),
})
const data = await response.json()
$response = Http::withToken($token)->put('https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/versions/4/publication', [
'change_note' => 'Added the medical page.',
]);
Response 200
{
"data": {
"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"
}
}
}

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