LinkTwin REST API

URL shortener API: automate links that open in the right app.

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.

View Documentation
cURL
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
<?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
// 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
Python
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
TypeScript
// 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
200Response
{
  "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."
}
Works with
  • Zapier
  • n8n
  • Make
  • Airtable
  • Google Sheets
  • Slack
  • WordPress
  • Shopify
  • Custom Apps

Popular API Endpoints

The link API endpoints you will use most.

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.

Create a short link or deep link

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.

  • url required
  • custom
  • password
  • domain
  • expiry
  • clicklimit
  • expirationredirect
  • note
  • display_title
  • metatitle
  • metadescription
  • metaimage
  • pixels
  • collections
  • geotarget
  • devicetarget
  • languagetarget
  • abtesting
  • parameters
  • escape_inapp_browser
POST/api/url/add
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"}
    ]
  }'
200Response
{
  "error": 0,
  "id": "1225",
  "shorturl": "https://linktw.in/desk-lamp",
  "title": "Amazon: LED desk lamp with clamp",
  "description": null
}
The fields you will use most
urlThe long URL to shorten (required)string
customCustom alias for the short URL (optional)string
expiryExpiration date for the link (optional)datetime
passwordPassword protect the link (optional)string
domainA branded domain you already added to your accountstring
clicklimitMaximum number of clicks before the link expiresinteger
geotargetSend visitors from a country, or a state, to a different URLarray
devicetargetA different URL for iPhone, Android and other devicesarray
languagetargetA different URL for each browser languagearray
abtestingSplit traffic between variants by percentarray
parametersUTM and other parameters added on redirectarray
pixels, collectionsPixel and collection IDs or names to attacharray

See this endpoint in the API docs

List and search your links

Page through your links, sort them by date, clicks or name, and filter by text, date or collection.

  • limit
  • page
  • order
  • search
  • date_from
  • date_to
  • collections
  • timezone
GET/api/urls
curl "https://linktw.in/api/urls?limit=2&page=1&order=clicks_desc" \
  -H "Authorization: Bearer YOUR_API_KEY"
200Response, trimmed for length
{
  "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": []
      }
    ]
  }
}

See this endpoint in the API docs

Get one link

Pass the link ID or its full short URL. You get the targeting rules, expiry, collections and pixels, plus its click counts.

  • :id required
  • timezone
GET/api/url/:id
curl "https://linktw.in/api/url/1221" \
  -H "Authorization: Bearer YOUR_API_KEY"
200Response, trimmed for length
{
  "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
  }
}

See this endpoint in the API docs

Update a link

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.

  • :id required
  • url
  • and every create field
PUT/api/url/:id/update
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"}'
200Response
{
  "error": 0,
  "id": 1221,
  "shorturl": "https://linktw.in/desk-tour",
  "title": "Unboxing my new camera",
  "description": null
}

See this endpoint in the API docs

Read click analytics

Clicks, unique clicks, top referrer and country, a daily chart and breakdowns by country, referrer, browser, device and language for one link.

  • :id required
  • date_range
  • start_date
  • end_date
  • timezone
GET/api/statistics/link/:id
curl "https://linktw.in/api/statistics/link/1221?date_range=30d" \
  -H "Authorization: Bearer YOUR_API_KEY"
200Response, trimmed for length
{
  "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.

Create a QR code

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.

  • type required
  • data required
  • background
  • foreground
  • logo
POST/api/qr/add
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)"}'
200Response
{
  "error": 0,
  "id": 3,
  "link": "https://linktw.in/qr/a58f79"
}

See this endpoint in the API docs

Add links to a collection

Add and remove many links in one call. The same pattern attaches a retargeting pixel to many links at /api/pixel/:id/links.

  • :id required
  • add
  • remove
POST/api/collection/: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]}'
200Response
{
  "error": 0,
  "collection_id": 4,
  "added": [
    1221,
    1222,
    1223
  ],
  "removed": [],
  "errors": []
}

See this endpoint in the API docs

Delete a link

Delete one link by ID or short URL, or many at once with POST /api/urls/delete and a list of IDs.

  • :id required
DELETE/api/url/:id/delete
curl -X DELETE "https://linktw.in/api/url/1223/delete" \
  -H "Authorization: Bearer YOUR_API_KEY"
200Response
{
  "error": 0,
  "message": "Link has been successfully deleted."
}

See this endpoint in the API docs

Example requests and responses. Response fields and formats are the real ones; the links and numbers are example data.

Use Cases

What Can You Build with Our API?

From a one-step Zap to a full integration in your own product, these are the jobs teams hand to the LinkTwin API.

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

Bulk Link Management

Import thousands of URLs from spreadsheets, generate short links in bulk, and export them back. Ideal for marketing campaigns and affiliate programs.

  • Google Sheets
  • Excel
  • CSV Import

Analytics Integration

Pull clicks, unique clicks, referrers, countries and devices into your own dashboards, BI tools or reports.

  • Looker Studio
  • Tableau
  • Power BI

Email & SMS Campaigns

Generate unique tracking links for each recipient in your email or SMS campaigns. Track individual engagement and optimize your outreach.

  • Mailchimp
  • SendGrid
  • Twilio

Mobile App Integration

Create deep links on-the-fly from your mobile app. Share content with smart links that open directly in other apps instead of browsers.

  • iOS
  • Android
  • React Native

Dynamic QR Codes

Generate QR codes programmatically for print materials, product packaging, or event tickets. Update the destination URL anytime without reprinting.

  • Print Systems
  • Label Printers
  • POS Systems

Zapier integration

Zapier URL shortener: create and track links from any Zap.

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.

Create links from a Zap

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.

  1. TriggerNew row in Google Sheets
    Column
    Product URL
  2. ActionWebhooks by Zapier: POST
    URL
    https://linktw.in/api/url/add
    Payload type
    json
    Data
    url = {{Product URL}}
    Headers
    Authorization: Bearer YOUR_API_KEY
  3. ActionUpdate the row with the short link
    Short link
    {{shorturl}}

Get a webhook for every new link and click

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.

New link
{
  "type": "url",
  "longurl": "https://www.youtube.com/watch?v=x7K2pQ9mW4s",
  "shorturl": "https://linktw.in/desk-tour",
  "date": "04-10-2026 09:41:12"
}
New click
{
  "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.

The same idea in n8n and Make

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.

  • Store the key as a header credential, never in the URL.
  • Check the error field in the response: 0 means the link was created.
  • Bulk jobs: stay under the rate limit and read the X-RateLimit headers.
n8n

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 }}" }
    ]
  }
}
Make

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

Built for Developers, By Developers

A plain REST API with predictable JSON, clear limits and documentation for every endpoint.

Secure Authentication

Bearer token authentication with the ability to regenerate your API key anytime. All requests are encrypted via HTTPS.

Clear rate limits

Each API key can make 120 requests per minute, and every response tells you where you stand.

RESTful Design

Clean, intuitive endpoints following REST conventions. JSON responses with detailed error messages and status codes.

Deep links by default

Links made through the API open in YouTube, Amazon, Spotify and 100+ other apps, exactly like links made in the dashboard.

Complete Documentation

Every endpoint is documented with its parameters, a sample response and code in cURL, PHP and Node.js.

View Full API Documentation

Developer Support

Stuck on something? Write to us and we will help you get your integration working.

Contact us
Real posts, real people

And what they post on X

Every post links to its original source, so you can read each recommendation in context.

Developer Questions

Common questions about our API, authentication, rate limits, and integrations. Read full API docs.

How do I get an API key?

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.

What are the rate limits?

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.

Can I use the API with N8N, Zapier, or Make?

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.

What endpoints are available?

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.

Is the API included in the free plan?

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.

Do you provide code examples and SDKs?

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.

Do links created through the API open in apps?

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.

Is there a Zapier integration?

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.

One API key, three ways to build

The REST API, the MCP server and the CLI all use the same API key and manage the same links.

API documentation

Every endpoint, with examples

Read the API docs

Start Building with Our API Today

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.