UTM templates endpoints
Create, list, update and delete saved UTM presets through the API.
A UTM template is a named set of UTM values, like "Twitter launch" with source: twitter and medium: social. Templates are the same ones you see under Templates in the link form. All paths are relative to https://app.muroanalytics.com/api/v1.
| Method | Path | What it does |
|---|---|---|
POST | /utm-templates | Create a template |
GET | /utm-templates | List templates |
PATCH | /utm-templates/{id} | Update a template |
DELETE | /utm-templates/{id} | Delete a template |
Templates are presets only. The API has no "apply template" call: to use one, read its utm object and send it as the utm field when you create a link.
The template object
{
"id": "utmt_2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"name": "Twitter launch",
"utm": { "source": "twitter", "medium": "social", "campaign": "launch" },
"created_at": 1791734400000,
"updated_at": 1791734400000
}| Field | Type | Description |
|---|---|---|
id | string | The template's ID, starting with utmt_. |
name | string | The template's name. Unique in your account, ignoring case. |
utm | object | The values it sets: any of source, medium, campaign, content, term. Keys it doesn't set are left out. |
created_at | number | When it was created, in Unix milliseconds. |
updated_at | number | When it was last changed, in Unix milliseconds. |
Create a template
POST /utm-templates
Body
| Field | Type | Required | Rules |
|---|---|---|---|
name | string | Yes | Trimmed, 1–50 characters, no control characters. Unique in your account, ignoring case. |
utm | object | Yes | Any of source, medium, campaign, content, term, each a string up to 200 characters. Values are trimmed and empty ones dropped. At least one must be set. |
Example
curl -X POST https://app.muroanalytics.com/api/v1/utm-templates \
-H "Authorization: Bearer muro_lnk_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Twitter launch",
"utm": { "source": "twitter", "medium": "social", "campaign": "launch" }
}'Response
201 Created with the template object.
Errors
| Status | Code | When |
|---|---|---|
400 | INVALID_JSON | The body isn't valid JSON. |
403 | UTM_TEMPLATE_LIMIT_REACHED | You already have 100 templates, the limit on every plan. |
409 | UTM_TEMPLATE_NAME_TAKEN | You already have a template with that name, ignoring case. |
422 | VALIDATION_ERROR | The name is missing or too long, utm sets no values, a value is too long or not a string. field names the field, for example name, utm or utm.source. |
List templates
GET /utm-templates
Returns all your templates, sorted by name (ignoring case). This list isn't paginated.
curl https://app.muroanalytics.com/api/v1/utm-templates \
-H "Authorization: Bearer muro_lnk_xxxxxxxxxxxx"200 OK:
{
"templates": [
{
"id": "utmt_7c8d9e0f-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
"name": "Newsletter",
"utm": { "source": "newsletter", "medium": "email" },
"created_at": 1790524800000,
"updated_at": 1790524800000
},
{
"id": "utmt_2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"name": "Twitter launch",
"utm": { "source": "twitter", "medium": "social", "campaign": "launch" },
"created_at": 1791734400000,
"updated_at": 1791734400000
}
],
"template_limit": 100
}template_limit is how many templates your account can hold, or null if unlimited.
Update a template
PATCH /utm-templates/{id}
Send name, utm, or both. At least one is required.
namerenames the template.utmreplaces all of its values. Keys you leave out ofutmare cleared, so send the complete set.
curl -X PATCH https://app.muroanalytics.com/api/v1/utm-templates/utmt_2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e \
-H "Authorization: Bearer muro_lnk_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "utm": { "source": "x", "medium": "social", "campaign": "launch" } }'200 OK with the updated template object.
Errors: 404 UTM_TEMPLATE_NOT_FOUND if the template isn't in your account, 409 UTM_TEMPLATE_NAME_TAKEN, and 422 VALIDATION_ERROR (including a body with neither field).
Delete a template
DELETE /utm-templates/{id}
curl -X DELETE https://app.muroanalytics.com/api/v1/utm-templates/utmt_2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e \
-H "Authorization: Bearer muro_lnk_xxxxxxxxxxxx"Returns 204 No Content. Links you created with the template keep their UTM parameters.
Errors: 404 UTM_TEMPLATE_NOT_FOUND.