API v1
v1
View as Markdown

Duplicate a template

POST /api/v1/templates/{template}/duplicate

Copy a template and everything it is made of into a separate template of your own.

This is how you build on a template the product supplied without touching it, and how you try a change out without putting the records of the original at risk. The copy is a separate template with its own id and its own slug, and nothing about the original moves.

What is copied is the published version when there is one, and the newest version otherwise. It arrives in the copy as a draft numbered 1, so the copy has nothing published until you publish it. A template with no version at all has nothing to copy and answers 404.

The copy takes a name and a slug of your choosing, or is given ones derived from the original when you send none.

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.

name string Optional

What to call the copy. Up to 255 characters. Derived from the original when absent.

slug string Optional

The address of the copy. Cleaned the same way a derived one is, and made unique within your account.

Returns

The template that was created. A template belonging to somebody else answers 404, and so does one with no version to copy.

data object

The template.

data.type string

Always template. 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.slug string

How the template is addressed in the application itself, in lower case letters, numbers and dashes. It is settled when the template is created and never rebuilt, so a link that already went out keeps working through any rename. Use it to build a browser link; use the id for every call here.

data.attributes.name string

What the template is called. A template the product supplied answers with the name translated into your language rather than the one stored, so the same template reads differently to two people.

data.attributes.description string

What the template is for, or null when nobody said.

data.attributes.applies_to string

Either contact or entity. A template describing a contact applies to the people in every vault; one describing an entity applies only to records of the type named in entity_type_id.

data.attributes.entity_type_id string

The id of the entity type this template describes, or null when it describes contacts. Read that type through the entity types endpoints.

data.attributes.is_system boolean

Whether the product supplied the template rather than you. It says where the template came from and locks nothing: a supplied template is renamed, moved, stopped and deleted exactly like one you made. Duplicating it first is usually the better move, because a copy leaves the original for anything already using it.

data.attributes.is_active boolean

Whether the template may still be applied to a record. False stops it being offered and touches nothing already using it: every record on it stays readable and stays editable.

data.attributes.position integer

Where the template sits in the list on the templates screen, counting from 1. It is the order you arranged, and it is the order the list endpoint answers in.

data.attributes.published_version_number integer

The number of the version records are put on when the template is applied today, or null when nothing has been published yet. A template with no published version is one still being designed.

data.attributes.created_at timestamp

When the template was created, as a count of seconds since 1970 rather than a written date.

data.attributes.updated_at timestamp

When it last changed, as a count of seconds. Equal to created_at until it first changes.

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.

POST
curl https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/duplicate \
-X POST \
-H "Authorization: Bearer $MONICA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Contact, expanded",
"slug": "contact-expanded"
}'
const response = await fetch('https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/duplicate', {
method: 'POST',
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'Contact, expanded',
slug: 'contact-expanded',
}),
})
const data = await response.json()
$response = Http::withToken($token)->post('https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af/duplicate', [
'name' => 'Contact, expanded',
'slug' => 'contact-expanded',
]);
Response 201
{
"data": {
"type": "template",
"id": "7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af",
"attributes": {
"slug": "contact",
"name": "Contact",
"description": "What every person in a vault shows.",
"applies_to": "contact",
"entity_type_id": null,
"is_system": false,
"is_active": true,
"position": 1,
"published_version_number": 3,
"created_at": 1756252800,
"updated_at": 1756339200
},
"links": {
"self": "https://my.monicahq.com/api/v1/templates/7b1c4e92-3d58-4f07-9a26-8c5b0e14d3af"
}
}
}

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