Muro
API reference

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.

MethodPathWhat it does
POST/utm-templatesCreate a template
GET/utm-templatesList 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
}
FieldTypeDescription
idstringThe template's ID, starting with utmt_.
namestringThe template's name. Unique in your account, ignoring case.
utmobjectThe values it sets: any of source, medium, campaign, content, term. Keys it doesn't set are left out.
created_atnumberWhen it was created, in Unix milliseconds.
updated_atnumberWhen it was last changed, in Unix milliseconds.

Create a template

POST /utm-templates

Body

FieldTypeRequiredRules
namestringYesTrimmed, 1–50 characters, no control characters. Unique in your account, ignoring case.
utmobjectYesAny 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

StatusCodeWhen
400INVALID_JSONThe body isn't valid JSON.
403UTM_TEMPLATE_LIMIT_REACHEDYou already have 100 templates, the limit on every plan.
409UTM_TEMPLATE_NAME_TAKENYou already have a template with that name, ignoring case.
422VALIDATION_ERRORThe 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.

  • name renames the template.
  • utm replaces all of its values. Keys you leave out of utm are 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.

Next steps

On this page