Automated Link Generation
Automatically create short links when new products are added, blog posts are published, or content is uploaded. Perfect for e-commerce and content platforms.
- Shopify
- WordPress
- WooCommerce
LinkTwin REST API
Create, manage and track short links from your own code. Every link the API creates is a LinkTwin deep link, so on a phone it opens YouTube, Amazon, Spotify and 100+ other apps instead of a browser. Connect it to Zapier, n8n, Make, Airtable, Google Sheets or anything that can send an HTTP request.
curl -X POST "https://linktw.in/api/url/add" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.youtube.com/watch?v=x7K2pQ9mW4s", "custom": "desk-tour"}'
<?php
// Create a short link with the LinkTwin API
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://linktw.in/api/url/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"url" => "https://www.youtube.com/watch?v=x7K2pQ9mW4s",
"custom" => "desk-tour",
]),
]);
$response = json_decode(curl_exec($curl));
echo $response->shorturl; // https://linktw.in/desk-tour
// Node.js 18 or newer, with the built-in fetch
const res = await fetch("https://linktw.in/api/url/add", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.LINKTWIN_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ url: "https://www.youtube.com/watch?v=x7K2pQ9mW4s", custom: "desk-tour" }),
});
const data = await res.json();
console.log(data.shorturl); // https://linktw.in/desk-tour
import requests
response = requests.post(
"https://linktw.in/api/url/add",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"url": "https://www.youtube.com/watch?v=x7K2pQ9mW4s", "custom": "desk-tour"},
)
print(response.json()["shorturl"]) # https://linktw.in/desk-tour
// npm install @linktwin/client
import { LinkTwinClient } from "@linktwin/client";
const client = new LinkTwinClient({ apiKey: process.env.LINKTWIN_API_KEY });
const link = await client.links.create({
url: "https://www.youtube.com/watch?v=x7K2pQ9mW4s",
custom: "desk-tour",
});
console.log(link.shorturl); // https://linktw.in/desk-tour
{
"error": 0,
"id": "1221",
"shorturl": "https://linktw.in/desk-tour",
"title": "My $200 desk setup (full tour)",
"description": "A full tour of my $200 desk setup."
}
Popular API Endpoints
Every endpoint takes and returns JSON over HTTPS, authenticated with your API key as a Bearer token. Pick one to see a real request and the response it returns.
Send the long URL and any options as JSON. Only url is required. Paste a YouTube, Amazon or Spotify URL and the short link opens that app on a phone.
curl -X POST "https://linktw.in/api/url/add" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.amazon.com/dp/B09T3KX8QV?tag=mayamakes-20",
"custom": "desk-lamp",
"collections": ["Amazon picks"],
"geotarget": [
{"location": "United Kingdom", "link": "https://www.amazon.co.uk/dp/B09T3KX8QV?tag=mayamakes-21"}
]
}'
{
"error": 0,
"id": "1225",
"shorturl": "https://linktw.in/desk-lamp",
"title": "Amazon: LED desk lamp with clamp",
"description": null
}
url | The long URL to shorten (required)string |
|---|---|
custom | Custom alias for the short URL (optional)string |
expiry | Expiration date for the link (optional)datetime |
password | Password protect the link (optional)string |
domain | A branded domain you already added to your accountstring |
clicklimit | Maximum number of clicks before the link expiresinteger |
geotarget | Send visitors from a country, or a state, to a different URLarray |
devicetarget | A different URL for iPhone, Android and other devicesarray |
languagetarget | A different URL for each browser languagearray |
abtesting | Split traffic between variants by percentarray |
parameters | UTM and other parameters added on redirectarray |
pixels, collections | Pixel and collection IDs or names to attacharray |
Page through your links, sort them by date, clicks or name, and filter by text, date or collection.
curl "https://linktw.in/api/urls?limit=2&page=1&order=clicks_desc" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"error": 0,
"data": {
"result": 9,
"perpage": 2,
"currentpage": 1,
"nextpage": 2,
"maxpage": 5,
"urls": [
{
"id": 1221,
"alias": "desk-tour",
"shorturl": "https://linktw.in/desk-tour",
"longurl": "https://www.youtube.com/watch?v=x7K2pQ9mW4s",
"title": "My $200 desk setup (full tour)",
"clicks": 1764,
"uniqueclicks": 1418,
"date": "2026-08-06 21:41:00",
"collections": [],
"pixels": []
},
{
"id": 1222,
"alias": "new-camera",
"shorturl": "https://linktw.in/new-camera",
"longurl": "https://www.youtube.com/watch?v=Rt5pL0aZc1Q",
"title": "Unboxing my new camera",
"clicks": 1098,
"uniqueclicks": 1045,
"date": "2026-09-21 18:52:00",
"collections": [],
"pixels": []
}
]
}
}
Pass the link ID or its full short URL. You get the targeting rules, expiry, collections and pixels, plus its click counts.
curl "https://linktw.in/api/url/1221" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"error": 0,
"id": 1221,
"details": {
"id": 1221,
"alias": "desk-tour",
"shorturl": "https://linktw.in/desk-tour",
"longurl": "https://www.youtube.com/watch?v=x7K2pQ9mW4s",
"domain": "https://linktw.in",
"title": "My $200 desk setup (full tour)",
"pass": false,
"expiry": null,
"clicklimit": null,
"date": "2026-08-06 21:41:00",
"collections": [
{
"id": 4,
"name": "YouTube",
"description": null,
"color": "#ff0033"
}
],
"pixels": []
},
"data": {
"clicks": 1764,
"uniqueClicks": 1418
}
}
Send only the fields you want to change. The short link stays the same, so every post and QR code that uses it follows the new destination.
curl -X PUT "https://linktw.in/api/url/1221/update" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.youtube.com/watch?v=Rt5pL0aZc1Q", "expiry": "2026-12-31 23:59:59"}'
{
"error": 0,
"id": 1221,
"shorturl": "https://linktw.in/desk-tour",
"title": "Unboxing my new camera",
"description": null
}
Clicks, unique clicks, top referrer and country, a daily chart and breakdowns by country, referrer, browser, device and language for one link.
curl "https://linktw.in/api/statistics/link/1221?date_range=30d" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"error": 0,
"data": {
"link": {
"id": 1221,
"shortUrl": "https://linktw.in/desk-tour",
"longUrl": "https://www.youtube.com/watch?v=x7K2pQ9mW4s",
"title": "My $200 desk setup (full tour)",
"absoluteClicks": 1764,
"createdAt": "2026-08-06 21:41:00"
},
"totalClicks": 504,
"totalUniqueClicks": 483,
"topReferrer": "https://l.instagram.com",
"topCountry": "United States",
"topCountryCode": "US",
"chartData": [
{
"date": "2026-09-03",
"clicks": 19
},
{
"date": "2026-09-04",
"clicks": 20
}
]
}
}
The MCP server and the CLI read link analytics through this endpoint too.
Pick a type (text, vCard, link, email, phone, SMS or Wi-Fi), the data, and optional colors and logo. Link QR codes count scans, and you can change where they point later.
curl -X POST "https://linktw.in/api/qr/add" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type": "link", "data": "https://linktw.in/desk-tour", "foreground": "rgb(13,27,46)"}'
{
"error": 0,
"id": 3,
"link": "https://linktw.in/qr/a58f79"
}
Add and remove many links in one call. The same pattern attaches a retargeting pixel to many links at /api/pixel/:id/links.
curl -X POST "https://linktw.in/api/collection/4/links" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"add": [1221, 1222, 1223]}'
{
"error": 0,
"collection_id": 4,
"added": [
1221,
1222,
1223
],
"removed": [],
"errors": []
}
Delete one link by ID or short URL, or many at once with POST /api/urls/delete and a list of IDs.
curl -X DELETE "https://linktw.in/api/url/1223/delete" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"error": 0,
"message": "Link has been successfully deleted."
}
Example requests and responses. Response fields and formats are the real ones; the links and numbers are example data.
Use Cases
From a one-step Zap to a full integration in your own product, these are the jobs teams hand to the LinkTwin API.
Automatically create short links when new products are added, blog posts are published, or content is uploaded. Perfect for e-commerce and content platforms.
Import thousands of URLs from spreadsheets, generate short links in bulk, and export them back. Ideal for marketing campaigns and affiliate programs.
Pull clicks, unique clicks, referrers, countries and devices into your own dashboards, BI tools or reports.
Generate unique tracking links for each recipient in your email or SMS campaigns. Track individual engagement and optimize your outreach.
Create deep links on-the-fly from your mobile app. Share content with smart links that open directly in other apps instead of browsers.
Generate QR codes programmatically for print materials, product packaging, or event tickets. Update the destination URL anytime without reprinting.
Zapier integration
Use LinkTwin as the URL shortener inside your Zaps, and let LinkTwin tell Zapier when something happens. The same works in n8n, Make and any tool that sends or receives webhooks.
Add a Webhooks by Zapier action that sends a POST request to the LinkTwin API. The next step can use the short link it returns.
Paste a Zapier Catch Hook URL on the Zapier integration page in your dashboard. LinkTwin posts a JSON event each time you create a short link and each time someone clicks one. It works with any webhook system, not only Zapier.
{
"type": "url",
"longurl": "https://www.youtube.com/watch?v=x7K2pQ9mW4s",
"shorturl": "https://linktw.in/desk-tour",
"date": "04-10-2026 09:41:12"
}
{
"type": "view",
"shorturl": "https://linktw.in/desk-tour",
"country": "United States",
"city": "Austin",
"referer": "https://l.instagram.com",
"os": "iOS",
"browser": "Safari",
"date": "2026-10-04 09:41:12"
}
Example payloads with the real field names.
Use the HTTP Request node in n8n or the HTTP module in Make. Send a POST to /api/url/add with your API key in the Authorization header and the URL in the body, then map shorturl into the next step.
HTTP Request node, with a Header Auth credential for Authorization.
{
"method": "POST",
"url": "https://linktw.in/api/url/add",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"bodyParameters": {
"parameters": [
{ "name": "url", "value": "={{ $json.url }}" }
]
}
}
HTTP module, Make a request. {{1.url}} is the URL from the step before.
{
"url": "https://linktw.in/api/url/add",
"method": "POST",
"headers": [
{ "name": "Authorization", "value": "Bearer YOUR_API_KEY" }
],
"bodyType": "raw",
"contentType": "application/json",
"data": "{\"url\": \"{{1.url}}\"}"
}
Why Choose Our API
A plain REST API with predictable JSON, clear limits and documentation for every endpoint.
Bearer token authentication with the ability to regenerate your API key anytime. All requests are encrypted via HTTPS.
Each API key can make 120 requests per minute, and every response tells you where you stand.
Clean, intuitive endpoints following REST conventions. JSON responses with detailed error messages and status codes.
Links made through the API open in YouTube, Amazon, Spotify and 100+ other apps, exactly like links made in the dashboard.
Every endpoint is documented with its parameters, a sample response and code in cURL, PHP and Node.js.
View Full API DocumentationStuck on something? Write to us and we will help you get your integration working.
Contact usCommon questions about our API, authentication, rate limits, and integrations. Read full API docs.
Sign in and open Settings in your dashboard, or the MCP Server and CLI Tool pages under Tools & Integrations. Your API key is shown there once your plan includes API access, which comes on every plan. You can regenerate it at any time, and the old key stops working right away.
Each API key can make 120 requests per minute. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers, so you can pace your calls, and a request over the limit gets error 429 with a Retry-After value. Creating links also has its own per-minute and per-hour allowance that depends on your plan, reported in X-Create-RateLimit headers.
Yes. The API works with any automation platform that can send HTTP requests: the HTTP Request node in n8n, Webhooks by Zapier, or the HTTP module in Make. LinkTwin can also call a Zapier webhook each time you create a link or someone clicks one. The API documentation has the request format for every endpoint.
Links (create, list, get, update, delete and bulk delete), QR codes, collections, branded domains, retargeting pixels, channels, click statistics and your account settings. The API documentation lists the parameters and a sample response for each one.
API access comes on every plan. You can create a free account to try LinkTwin links first, then upgrade when you are ready to build. See plans and pricing.
Yes. The documentation shows each request in cURL, PHP and Node.js, and this page adds Python. For JavaScript and TypeScript there is an official client on npm, @linktwin/client, which also powers the LinkTwin MCP server and CLI.
Yes. A link created through the API works exactly like one made in the dashboard. On a phone it opens the right app, such as YouTube, Amazon or Spotify, and falls back to the browser when the app is not installed. See the supported apps.
Yes, in both directions. A Zap can create links by calling the API with Webhooks by Zapier, and LinkTwin can send a Zapier webhook each time you create a link or someone clicks one. Paste your webhook URLs on the Zapier integration page in your dashboard.
The REST API, the MCP server and the CLI all use the same API key and manage the same links.
MCP server
Command line
API documentation
Create your account, pick a plan with API access and copy your API key. Full documentation and code examples included.
Read Documentation or see plans. API access comes on every plan.