Skip to Content
API ReferenceShort Links

Short Links Management

This section documents the endpoints available for creating, managing, and tracking short links. Short links allow you to create branded redirects using custom domains with advanced routing rules (Geo-targeting, Device-targeting, etc.).

Base URL

https://api.multi-upload-tool.com/api/v1

Authentication

All requests require an API Token in the header: x-api-key: YOUR_API_TOKEN


Retrieve a list of short links you have created.

Endpoint

GET /short-links

Query Parameters

No specific query parameters are strictly required, but the results are scoped to your user and optional team.

Example Request

curl -X GET "https://api.multi-upload-tool.com/api/v1/short-links" \ -H "x-api-key: YOUR_API_TOKEN"

Example Response

[ { "id": 101, "slug": "my-campaign", "url": "https://goleaf.link/my-campaign", "destination": "https://mysite.com/landing", "clicks": 150, "isActive": true, "createdAt": "2023-10-27T10:00:00.000Z" } ]

Create a new short link with optional advanced routing rules.

Endpoint

POST /short-links

Content-Type

application/json

Body Parameters

ParameterTypeRequiredDescription
urlstringYesThe default destination URL where users will be redirected.
domainIdintegerNoThe ID of the custom domain to use (e.g. link.mybrand.com). If omitted, uses the default domain. Custom domains require a paid plan.
slugstringNoCustom alias for the link (e.g., summer-sale). If empty, one is generated.
titlestringNoMetadata title for previews.
descriptionstringNoMetadata description for previews.
imageUrlstringNoMetadata image URL for previews.
useDeeplinkbooleanNoWhether to attempt deep linking app schemes (default: false).
botProtectionbooleanNoRedirect bots to a safe URL instead of the money link (default: false).
safeUrlstringNoThe URL to send bots to if protection is enabled.
rulesarrayNoList of advanced routing rules (see below).

Rule Object Structure

Each rule object defines a condition and a destination. If the condition matches, the user is redirected to the specified destination.

Common Fields (All Rules)

FieldTypeRequiredDescription
typestringYesRule type: geo, device, language, time, referer.
destinationstringYesWhere to redirect if the rule matches.
prioritynumberNoOrder of execution (Higher numbers run first). If not set, defaults to last_priority + 1. If a priority already exists, all rules with equal or greater priority are incremented.

Geo Rule (type: "geo")

Redirects based on the user’s country (IP-based).

FieldTypeRequiredDescription
countryCodesstringYesComma-separated ISO 3166-1 alpha-2 codes (e.g., US,FR,BE).

Device Rule (type: "device")

Redirects based on the user’s device form factor and/or operating system.

FieldTypeRequiredDescription
devicesstringNoComma-separated form factors: mobile, desktop, tablet.
osstringNoComma-separated operating systems: ios, android, macos, windows, linux.

Note: You can use devices, os, or both. If both are provided, both conditions must match (AND logic). Example: devices="mobile" AND os="ios" matches only iPhones (not iPads if considered tablet, and not Android phones).

Language Rule (type: "language")

Redirects based on the Accept-Language header.

FieldTypeRequiredDescription
languagesstringYesComma-separated language codes (e.g., en,fr,es).

Time Rule (type: "time")

Redirects during a specific time window.

FieldTypeRequiredDescription
startTimestringYesISO Date string (e.g. 2024-01-01T00:00:00Z). Start validity.
endTimestringYesISO Date string. End validity.

Referer Rule (type: "referer")

Redirects based on the source website (Referer header).

FieldTypeRequiredDescription
referersstringYesDomain or keyword to match in Referer header (e.g. facebook.com).

Example Request

curl -X POST "https://api.multi-upload-tool.com/api/v1/short-links" \ -H "x-api-key: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "url": "https://mysite.com", "slug": "promo-2024", "domainId": 123, "title": "Super Promo", "botProtection": true, "safeUrl": "https://google.com", "rules": [ { "type": "geo", "destination": "https://mysite.com/fr", "countryCodes": "FR,BE", "priority": 10 }, { "type": "device", "destination": "https://mysite.com/app-download", "devices": "mobile", "os": "ios", "priority": 5 } ] }'

Example Response

{ "id": 101, "slug": "promo-2024", "shortUrl": "https://goleaf.link/promo-2024", "destination": "https://mysite.com", "isActive": true }

Retrieve full details of a specific link, including its stats and rules.

Endpoint

GET /short-links/:id

Example Request

curl -X GET "https://api.multi-upload-tool.com/api/v1/short-links/101" \ -H "x-api-key: YOUR_API_TOKEN"

Example Response

{ "id": 101, "slug": "promo-2024", "destination": "https://mysite.com", "clicks": 1250, "rules": [ { "type": "geo", "countryCodes": "FR", "destination": "..." } ], "linkClicks": [ { "country": "FR", "device": "mobile", "clickedAt": "..." } ] }

Modify an existing short link. You can update metadata, destination, or replace the rules entirely.

Endpoint

PUT /short-links/:id

Body Parameters

Same as Create endpoint. Fields omitted will remain unchanged, but providing rules will replace the existing list of rules.

Example Request

curl -X PUT "https://api.multi-upload-tool.com/api/v1/short-links/101" \ -H "x-api-key: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "isActive": false, "destination": "https://mysite.com/closed" }'

Permanently remove a short link. It will no longer redirect users.

Endpoint

DELETE /short-links/:id

Example Request

curl -X DELETE "https://api.multi-upload-tool.com/api/v1/short-links/101" \ -H "x-api-key: YOUR_API_TOKEN"

Example Response

{ "success": true, "message": "Link deleted" }