Documentation Index
Fetch the complete documentation index at: https://docs.linkutm.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
UTM templates are reusable sets of UTM values (source, medium, campaign, term, content) saved to a workspace. They are referenced from Create link viatemplateId to pre-fill UTM fields. Every endpoint lives under /api/v1/templates, requires a JWT, and is workspace-scoped.
Template fields
| Field | Type | Notes |
|---|---|---|
id | string (UUID) | Server-generated. |
name | string | Template label. |
description | string | null | Internal context. |
utmSource | string | null | Pre-fill value for utm_source. |
utmMedium | string | null | Pre-fill value for utm_medium. |
utmCampaign | string | null | Pre-fill value for utm_campaign. |
utmTerm | string | null | Pre-fill value for utm_term. |
utmContent | string | null | Pre-fill value for utm_content. |
usageCount | integer | Times the template has been applied. Drives the most-used ranking. |
isActive | boolean | Active templates sort first and are the only ones returned by most-used. |
workspaceId | string (UUID) | Set on creation; immutable. |
createdById | string (UUID) | User who created the template. |
updatedById | string (UUID) | null | User who last updated the template. |
createdAt | timestamp | UTC. |
updatedAt | timestamp | UTC. |
The
customUtmParams field is accepted in the request body interface but is not persisted on the template record. Set custom UTM keys directly on the link instead.Create a template
Headers
| Header | Required | Notes |
|---|---|---|
Authorization: Bearer <jwt> | Yes | |
x-workspace-id: <uuid_or_slug> | Yes | Target workspace |
Content-Type: application/json | Yes |
Body
Template label.
Internal context.
UTM source pre-fill, e.g.,
google.UTM medium pre-fill, e.g.,
cpc.UTM campaign pre-fill, e.g.,
q2_launch.UTM term pre-fill.
UTM content pre-fill.
Accepted by the request interface but not stored on the template record.
Example request
Example response
Errors
| Code | When |
|---|---|
400 | Validation failure |
401 | Missing or invalid JWT |
403 | Workspace UTM template maximum reached - the message reports used and limit counts and asks you to upgrade the plan |
404 | Workspace not found |
List templates
Headers
| Header | Required | Notes |
|---|---|---|
Authorization: Bearer <jwt> | Yes | |
x-workspace-id: <uuid_or_slug> | Yes | Target workspace |
Query parameters
Page number.
Items per page.
Case-insensitive substring match against
name, description, utmSource, utmMedium, and utmCampaign.Example request
Example response
Errors
| Code | When |
|---|---|
401 | Missing or invalid JWT |
Most used templates
usageCount descending. Only templates with isActive=true are included.
Headers
| Header | Required | Notes |
|---|---|---|
Authorization: Bearer <jwt> | Yes | |
x-workspace-id: <uuid_or_slug> | Yes | Target workspace |
Query parameters
Number of templates to return.
Example request
Example response
Errors
| Code | When |
|---|---|
401 | Missing or invalid JWT |
Get a template
x-workspace-id header against the template’s workspace, but it is still recommended to send it for consistency.
Headers
| Header | Required | Notes |
|---|---|---|
Authorization: Bearer <jwt> | Yes |
Example request
Example response
Errors
| Code | When |
|---|---|
401 | Missing or invalid JWT |
404 | Template not found |
Update a template
updatedById.
Headers
| Header | Required | Notes |
|---|---|---|
Authorization: Bearer <jwt> | Yes | |
Content-Type: application/json | Yes |
Body
Template label.
Internal context.
UTM source pre-fill.
UTM medium pre-fill.
UTM campaign pre-fill.
UTM term pre-fill.
UTM content pre-fill.
Accepted by the request interface but not persisted.
Example request
Example response
Errors
| Code | When |
|---|---|
401 | Missing or invalid JWT |
404 | Template not found |
Delete a template
Headers
| Header | Required | Notes |
|---|---|---|
Authorization: Bearer <jwt> | Yes |
Behavior
- If any link still has
templateIdset to this template, the request fails with400. The message reports how many links reference it. - If
usageCountis greater than0, the request fails with400even when no link currently references it. - Clear the UTM parameters on the linked links or delete those links before removing the template.
Example request
Example response
Returns the deleted template record.Errors
| Code | When |
|---|---|
400 | Template is referenced by one or more links, or usageCount is greater than 0 |
401 | Missing or invalid JWT |
404 | Template not found |
Increment usage count
usageCount by 1. Call this when a template is applied to a link so it ranks in Most used templates.
Headers
| Header | Required | Notes |
|---|---|---|
Authorization: Bearer <jwt> | Yes |
Example request
Example response
Returns the updated template record with the incrementedusageCount.
The request body is ignored - the increment applies to the template named in the path. Note that a non-zero
usageCount blocks deletion of the template.Errors
| Code | When |
|---|---|
401 | Missing or invalid JWT |
404 | Template not found |