UTM Link Builder

UTM Link Builder API

Marketing

Create trackable marketing links with UTM parameters instantly. Monitor campaign performance and traffic sources for better marketing insights.

Authentication

All API requests require a valid API key passed in the Authorization header as a Bearer token.

Rate Limit

120 requests per minute

Endpoints

1 endpoint available

Overview

Builds a campaign link by adding UTM parameters to a destination URL. It only builds the link: the destination is not fetched or checked.

Behavior

  • The destination must be an absolute http or https URL. Up to 4,000 characters.
  • utm_source, utm_medium and utm_campaign are required. utm_term and utm_content are optional and left out when empty. Each value is up to 500 characters.
  • Values are percent-encoded, so spaces become + and special characters are escaped.
  • Query parameters and the fragment already on the URL are kept. A utm parameter already on the URL is not replaced: the new one is added after it, so remove old ones first.
  • The URL is normalized, for example a bare domain gets a trailing slash.

The parameters

  • utm_source - where the traffic comes from (google, newsletter, facebook)
  • utm_medium - the channel (cpc, banner, email)
  • utm_campaign - the campaign name (spring_sale, product_launch)
  • utm_term - paid search keywords
  • utm_content - tells similar links or ads apart (banner1, banner2)

Endpoints

POST
https://opentools.ca/api/v1/tools/utm-link-builder
Add UTM parameters to a URL

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
url
string
Required
The destination URL, including http:// or https://.
utm_source
string
Required
Traffic source, for example google or newsletter. 1 to 500 characters.
utm_medium
string
Required
Marketing medium, for example cpc or email. 1 to 500 characters.
utm_campaign
string
Required
Campaign name, for example spring_sale. 1 to 500 characters.
utm_term
string
OptionalPaid search keywords. Up to 500 characters.
utm_content
string
OptionalTells similar content or links apart. Up to 500 characters.

Response Example

{
  "success": true,
  "originalUrl": "https://example.com/products",
  "generatedUrl": "https://example.com/products?utm_source=newsletter&utm_medium=email&utm_campaign=summer_sale&utm_content=header_banner",
  "parameters": {
    "utm_source": "newsletter",
    "utm_medium": "email",
    "utm_campaign": "summer_sale",
    "utm_content": "header_banner"
  }
}

Error Codes

400
Bad Request - Invalid or non-http url, or a missing, empty or too long utm parameter
401
Unauthorized - Invalid or missing API key
403
Forbidden - API key is inactive or expired, or the request IP is not allowed for this key
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error

Code Examples

curl -X POST https://opentools.ca/api/v1/tools/utm-link-builder \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/products",
    "utm_source": "newsletter",
    "utm_medium": "email",
    "utm_campaign": "summer_sale",
    "utm_content": "header_banner"
  }'

Ready to get started?

Create an API key to start using the UTM Link Builder API.

Rather use it in your browser? Open the UTM Link Builder