An API key is required for requests to be processed by the system. Once a user registers, an API key is automatically generated for this user. The API key must be sent with each request (see full example below). If the API key is not sent or is expired, there will be an error. Please make sure to keep your API key secret to prevent abuse.
To authenticate with the API system, you need to send your API key as an authorization token with each request. You can see sample code below.
curl --location --request POST 'https://linktw.in/api/account' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/account",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/account',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: ''
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Our API has a rate limiter to safeguard against spike in requests to maximize its stability. Our rate limiter is currently caped at 120 requests per 1 minute.
Several headers will be sent alongside the response and these can be examined to determine various information about the request.
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 119
X-RateLimit-Reset: TIMESTAMP
All API response are returned in JSON format by default. To convert this into usable data, the appropriate function will need to be used according to the language. In PHP, the function json_decode() can be used to convert the data to either an object (default) or an array (set the second parameter to true). It is very important to check the error key as that provides information on whether there was an error or not. You can also check the header code.
{
"error": 1,
"message": "An error occurred"
}
All date and time fields in API responses are returned in your account's configured timezone. You can set your timezone in your account settings. If no timezone is configured, dates default to UTC.
You can also override your account timezone per-request by adding a ?timezone= query parameter to most endpoints (e.g., ?timezone=America/New_York).
Date fields are formatted as YYYY-MM-DD HH:MM:SS (e.g. 2024-01-15 14:30:00).
The Account endpoint returns timezone_offset which is the current UTC offset in minutes for your configured timezone. This accounts for daylight saving time and can be used to convert dates to other timezones. For example, -300 means UTC-5 (Eastern Standard Time), 60 means UTC+1 (Central European Time).
{
"settings": {
"timezone": "America/New_York",
"timezone_offset": -300
},
"date": "2024-01-15 14:30:00"
}
The location field in the geotarget array must use the exact full country name as shown below. Country names are case-sensitive. Click on any country to see its available states/regions for the optional state field.
| Code | Country Name (use this in location) | |
|---|---|---|
AD |
Andorra | |
AF |
Afghanistan | |
AG |
Antigua and Barbuda | |
AI |
Anguilla | |
AL |
Albania | |
AM |
Armenia | |
AN |
Netherlands Antilles | |
AO |
Angola | |
AQ |
Antarctica | |
AR |
Argentina | |
AS |
American Samoa | |
AT |
Austria | |
AU |
Australia | |
AW |
Aruba | |
AX |
Ã…land | |
AZ |
Azerbaijan | |
BA |
Bosnia and Herzegovina | |
BB |
Barbados | |
BD |
Bangladesh | |
BE |
Belgium | |
BF |
Burkina Faso | |
BG |
Bulgaria | |
BH |
Bahrain | |
BI |
Burundi | |
BJ |
Benin | |
BL |
Saint Barthélemy | |
BM |
Bermuda | |
BN |
Brunei | |
BO |
Bolivia | |
BQ |
Bonaire, Sint Eustatius and Saba | |
BR |
Brazil | |
BS |
Bahamas | |
BT |
Bhutan | |
BV |
Bouvet Island | |
BW |
Botswana | |
BY |
Belarus | |
BZ |
Belize | |
CA |
Canada | |
CC |
Cocos [Keeling] Islands | |
CD |
DR Congo | |
CF |
Central African Republic | |
CG |
Congo Republic | |
CH |
Switzerland | |
CI |
Ivory Coast | |
CK |
Cook Islands | |
CL |
Chile | |
CM |
Cameroon | |
CN |
China | |
CO |
Colombia | |
CR |
Costa Rica | |
CS |
Serbia and Montenegro | |
CU |
Cuba | |
CV |
Cabo Verde | |
CW |
Curaçao | |
CX |
Christmas Island | |
CY |
Cyprus | |
CZ |
Czechia | |
DE |
Germany | |
DJ |
Djibouti | |
DK |
Denmark | |
DM |
Dominica | |
DO |
Dominican Republic | |
DZ |
Algeria | |
EC |
Ecuador | |
EE |
Estonia | |
EG |
Egypt | |
EH |
Western Sahara | |
ER |
Eritrea | |
ES |
Spain | |
ET |
Ethiopia | |
FI |
Finland | |
FJ |
Fiji | |
FK |
Falkland Islands | |
FM |
Micronesia | |
FO |
Faroe Islands | |
FR |
France | |
GA |
Gabon | |
GB |
United Kingdom | |
GD |
Grenada | |
GE |
Georgia | |
GF |
French Guiana | |
GG |
Guernsey | |
GH |
Ghana | |
GI |
Gibraltar | |
GL |
Greenland | |
GM |
Gambia | |
GN |
Guinea | |
GP |
Guadeloupe | |
GQ |
Equatorial Guinea | |
GR |
Greece | |
GS |
South Georgia and South Sandwich Islands | |
GT |
Guatemala | |
GU |
Guam | |
GW |
Guinea-Bissau | |
GY |
Guyana | |
HK |
Hong Kong | |
HM |
Heard Island and McDonald Islands | |
HN |
Honduras | |
HR |
Croatia | |
HT |
Haiti | |
HU |
Hungary | |
ID |
Indonesia | |
IE |
Ireland | |
IL |
Israel | |
IM |
Isle of Man | |
IN |
India | |
IO |
British Indian Ocean Territory | |
IQ |
Iraq | |
IR |
Iran | |
IS |
Iceland | |
IT |
Italy | |
JE |
Jersey | |
JM |
Jamaica | |
JO |
Jordan | |
JP |
Japan | |
KE |
Kenya | |
KG |
Kyrgyzstan | |
KH |
Cambodia | |
KI |
Kiribati | |
KM |
Comoros | |
KN |
St Kitts and Nevis | |
KP |
North Korea | |
KR |
South Korea | |
KW |
Kuwait | |
KY |
Cayman Islands | |
KZ |
Kazakhstan | |
LA |
Laos | |
LB |
Lebanon | |
LC |
Saint Lucia | |
LI |
Liechtenstein | |
LK |
Sri Lanka | |
LR |
Liberia | |
LS |
Lesotho | |
LT |
Lithuania | |
LU |
Luxembourg | |
LV |
Latvia | |
LY |
Libya | |
MA |
Morocco | |
MC |
Monaco | |
MD |
Moldova | |
ME |
Montenegro | |
MF |
Saint Martin | |
MG |
Madagascar | |
MH |
Marshall Islands | |
MK |
North Macedonia | |
ML |
Mali | |
MM |
Myanmar | |
MN |
Mongolia | |
MO |
Macao | |
MP |
Northern Mariana Islands | |
MQ |
Martinique | |
MR |
Mauritania | |
MS |
Montserrat | |
MT |
Malta | |
MU |
Mauritius | |
MV |
Maldives | |
MW |
Malawi | |
MX |
Mexico | |
MY |
Malaysia | |
MZ |
Mozambique | |
NA |
Namibia | |
NC |
New Caledonia | |
NE |
Niger | |
NF |
Norfolk Island | |
NG |
Nigeria | |
NI |
Nicaragua | |
NL |
Netherlands | |
NO |
Norway | |
NP |
Nepal | |
NR |
Nauru | |
NU |
Niue | |
NZ |
New Zealand | |
OM |
Oman | |
PA |
Panama | |
PE |
Peru | |
PF |
French Polynesia | |
PG |
Papua New Guinea | |
PH |
Philippines | |
PK |
Pakistan | |
PL |
Poland | |
PM |
Saint Pierre and Miquelon | |
PN |
Pitcairn Islands | |
PR |
Puerto Rico | |
PS |
Palestine | |
PT |
Portugal | |
PW |
Palau | |
PY |
Paraguay | |
QA |
Qatar | |
RE |
Réunion | |
RO |
Romania | |
RS |
Serbia | |
RU |
Russia | |
RW |
Rwanda | |
SA |
Saudi Arabia | |
SB |
Solomon Islands | |
SC |
Seychelles | |
SD |
Sudan | |
SE |
Sweden | |
SG |
Singapore | |
SH |
Saint Helena | |
SI |
Slovenia | |
SJ |
Svalbard and Jan Mayen | |
SK |
Slovakia | |
SL |
Sierra Leone | |
SM |
San Marino | |
SN |
Senegal | |
SO |
Somalia | |
SR |
Suriname | |
SS |
South Sudan | |
ST |
São Tomé and PrÃncipe | |
SV |
El Salvador | |
SX |
Sint Maarten | |
SY |
Syria | |
SZ |
Eswatini | |
TC |
Turks and Caicos Islands | |
TD |
Chad | |
TF |
French Southern Territories | |
TG |
Togo | |
TH |
Thailand | |
TJ |
Tajikistan | |
TK |
Tokelau | |
TL |
Timor-Leste | |
TM |
Turkmenistan | |
TN |
Tunisia | |
TO |
Tonga | |
TR |
Turkey | |
TT |
Trinidad and Tobago | |
TV |
Tuvalu | |
TW |
Taiwan | |
TZ |
Tanzania | |
AE |
United Arab Emirates | |
UA |
Ukraine | |
UG |
Uganda | |
UM |
U.S. Minor Outlying Islands | |
US |
United States | |
UY |
Uruguay | |
UZ |
Uzbekistan | |
VA |
Vatican City | |
VC |
St Vincent and Grenadines | |
VE |
Venezuela | |
VG |
British Virgin Islands | |
VI |
U.S. Virgin Islands | |
VN |
Vietnam | |
VU |
Vanuatu | |
WF |
Wallis and Futuna | |
WS |
Samoa | |
XK |
Kosovo | |
YE |
Yemen | |
YT |
Mayotte | |
ZA |
South Africa | |
ZM |
Zambia | |
ZW |
Zimbabwe |
"geotarget": [
{"location": "Canada", "link": "https://example.ca"},
{"location": "United States", "link": "https://example.us", "state": "California"},
{"location": "United Kingdom", "link": "https://example.co.uk"}
]
https://linktw.in/api/urls?limit=2&page=1&order=date&collections=%5B1%2C2%5D
To get your links via the API, you can use this endpoint. You can also filter data (See table for more info). If your plan has a click limit, the response includes a usage object with your current click count, limit, and days until the billing period resets. This field is omitted for unlimited plans.
Missed clicks: The missedclicks field per link and missed_clicks in the usage object are only returned for free plan users (who have click limits).
Link status: status is active (live), upgrade_required (free plan, destination not on the approved list), needs_domain (restricted content, works only on your own domain), verify_email (account email not confirmed yet) or disabled. statuses lists every reason the link is not live. restriction is null unless the status is needs_domain; then it gives the reason (adult, gambling, high_risk, restricted_domain) and what you can do. type is the redirect mode as stored (direct, frame, splash, overlay-…), null when not set.
Badges: features lists the dashboard's link badges that apply, expires_at is the expiry date (Y-m-d) or null and kind the link type; a single, created or updated link carries the same fields.
| Parameter | Description |
|---|---|
| limit | (optional) Per page data result |
| page | (optional) Current page request |
| order | (optional) Sort data: date, date_desc, date_asc, clicks_desc, clicks_asc, name_asc, name_desc |
| search | (optional) Search links by alias, custom alias, URL, meta title, custom title, or description. Supports domain alias expansion (e.g., "youtube" matches youtube.com and youtu.be) |
| date_from | (optional) Filter by start date (Y-m-d or ISO 8601 format, e.g., 2025-01-01 or 2025-01-01T00:00:00.000Z) |
| date_to | (optional) Filter by end date (Y-m-d or ISO 8601 format, e.g., 2025-01-31 or 2025-01-31T23:59:59.999Z) |
| collections | (optional) Array of collection IDs or names to filter links by. Use either all IDs or all names, not mixed. Example: [1,2,3] or ["Marketing","Social Media"] |
| tags | (optional) Tag names or IDs to filter links by, comma-separated or as an array. Example: promo,summer or [4,7] |
| tags_mode | (optional) any (default): links with at least one of the tags. all: links with every tag. |
| timezone | (optional) Timezone for date fields in response (e.g., America/New_York, Europe/London). Overrides account timezone setting. Defaults to UTC if not specified. |
curl --location --request GET 'https://linktw.in/api/urls?limit=2&page=1&order=date&collections=%5B1%2C2%5D' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls?limit=2&page=1&order=date&collections=%5B1%2C2%5D",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/urls?limit=2&page=1&order=date&collections=%5B1%2C2%5D',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": "0",
"data": {
"result": 2,
"perpage": 2,
"currentpage": 1,
"nextpage": 1,
"maxpage": 1,
"urls": [
{
"id": 2,
"alias": "google",
"shorturl": "https:\/\/linktw.in\/google",
"longurl": "https:\/\/google.com",
"clicks": 0,
"uniqueclicks": 0,
"title": "Google",
"description": "",
"display_title": "My Dashboard Title",
"custom_title": "My Custom Google Title",
"custom_description": "This is my custom description for Google",
"metaimage": "https:\/\/linktw.in\/content\/images\/AbCdEf_ai_GhIjKl.jpg",
"custom_preview": true,
"type": "direct",
"status": "active",
"restriction": null,
"kind": "music",
"features": [
"geo",
"password",
"expiry"
],
"expires_at": "2026-12-31",
"collections": [
{
"id": 1,
"name": "Marketing",
"description": "All marketing campaign links",
"color": "#1E88E5"
},
{
"id": 3,
"name": "Social Media",
"description": "Social media platform links",
"color": "#43A047"
}
],
"tags": [
{
"id": 4,
"name": "promo",
"color": "#0967f2"
}
],
"pixels": [
{
"id": 1,
"type": "gtmpixel",
"name": "GTM Pixel",
"tag": "GTM-XXXXX"
},
{
"id": 2,
"type": "fbpixel",
"name": "Facebook Pixel",
"tag": "1234567890"
}
],
"date": "2023-11-10 18:01:43"
},
{
"id": 1,
"alias": "googlecanada",
"shorturl": "https:\/\/linktw.in\/googlecanada",
"longurl": "https:\/\/google.ca",
"clicks": 0,
"uniqueclicks": 0,
"title": "Google Canada",
"description": "",
"display_title": null,
"custom_title": null,
"custom_description": null,
"metaimage": null,
"custom_preview": false,
"type": null,
"status": "needs_domain",
"restriction": null,
"collections": [],
"tags": [],
"pixels": [],
"date": "2023-11-10 18:00:25"
}
],
"usage": {
"clicks": 1250,
"clicks_limit": 50000,
"clicks_reset_days": 22
}
}
}
https://linktw.in/api/url/:id
To get details for a single link via the API, you can use this endpoint. You can pass either the link ID or the full short URL.kind is what the link does on click, the type the dashboard shows: music, podcast, store, sms, email, phone, whatsapp, deeplink or direct. type is the redirect mode as stored (direct, frame, splash, overlay-…), null when not set. music and store show the Smart Music Link and App Store Link settings; available says whether the link can use them (see Update Link); page_image is the image gathered from the destination (its og:image, or the YouTube thumbnail): what a preview shows when the link has no image of its own, the website's "Page image" (null when none was found). metaimage is the link's own preview image (null when the social preview is off or has no image); preview_image_none is true when "No image" was chosen. music.cover is the cover the music page shows (your upload, else the artwork fetched from the platform) and music.cover_custom whether a cover is set on the link (see Upload a Link Cover). music.fetched_title / music.fetched_artist are the title and artist fetched from the platform; music.title / music.artist are your own (null = the fetched ones are shown; send null in Update Link to go back to them). param_forwarding is the link's own parameter forwarding ({mode, names, tracking}), null when it follows the account setting. stock_monitor shows the Amazon Stock Monitor settings. available is true for an Amazon product link when the plan includes Stock Monitor and the account switch is on; otherwise the other fields are empty (null / 0). monitored says whether the link is checked right now, last_checked when it was last checked, used / cap how many products the account monitors out of its plan limit. action and suppressed_oos are the values in effect (the link's own, else the account's); account holds the account defaults, and account.enroll_mode manual means only links with monitor on are monitored.
Link status: status is active (live), upgrade_required (free plan, destination not on the approved list), needs_domain (restricted content, works only on your own domain), verify_email (account email not confirmed yet) or disabled. statuses lists every reason the link is not live. restriction is null unless the status is needs_domain; then it gives the reason (adult, gambling, high_risk, restricted_domain) and what you can do.
| Parameter | Description |
|---|---|
| :id | (required) The link ID (e.g., 123) or the full short URL (e.g., https://linktw.in/abc123) |
| timezone | (optional) Timezone for date fields in response (e.g., America/New_York, Europe/London). Overrides account timezone setting. Defaults to UTC if not specified. |
curl --location --request GET 'https://linktw.in/api/url/:id' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/url/:id',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 1,
"details": {
"id": 1,
"alias": "googlecanada",
"shorturl": "https:\/\/linktw.in\/googlecanada",
"longurl": "https:\/\/google.com",
"domain": "https:\/\/linktw.in",
"title": "Google",
"description": "",
"display_title": "My Dashboard Title",
"custom_title": "My Custom Title",
"custom_description": "My Custom Description",
"note": "Internal note for this link",
"pass": false,
"location": {
"canada": {
"all": "https:\/\/google.ca"
},
"united states": {
"CA": "https:\/\/google.us\/california",
"NY": "https:\/\/google.us\/newyork",
"all": "https:\/\/google.us"
}
},
"device": {
"iphone": "https:\/\/google.com",
"android": "https:\/\/google.com"
},
"languagetarget": {
"en": "https:\/\/google.com",
"fr": "https:\/\/google.ca"
},
"utmtarget": [
{
"param": "utm_source",
"value": "facebook",
"link": "https:\/\/example.com\/facebook-offer"
}
],
"parameters": {
"utm_source": "api",
"utm_medium": "link"
},
"expiry": "2025-12-31 23:59:59",
"clicklimit": 1000,
"expirationredirect": "https:\/\/example.com\/expired",
"abtesting": [
{
"percent": 50,
"link": "https:\/\/variant-a.com",
"count": 125
},
{
"percent": 50,
"link": "https:\/\/variant-b.com",
"count": 130
}
],
"metaimage": "https:\/\/linktw.in\/content\/images\/AbCdEf_ai_GhIjKl.jpg",
"date": "2023-11-10 18:01:43",
"kind": "deeplink",
"type": "direct",
"custom_preview": true,
"page_image": "https:\/\/www.google.com\/og-image.png",
"preview_image_none": false,
"param_forwarding": null,
"stock_monitor": {
"available": false,
"monitored": false,
"monitor": "auto",
"action": null,
"alternatives": [],
"suppressed_oos": null,
"last_checked": null,
"used": 0,
"cap": 0,
"account": null
},
"music": {
"available": false,
"enabled": false,
"services": [],
"auto_open": null,
"title": null,
"artist": null,
"style": "list",
"cover": null,
"cover_custom": false,
"fetched_title": null,
"fetched_artist": null
},
"store": {
"available": false,
"enabled": false,
"ios": null,
"android": null,
"huawei": null,
"mac": null,
"windows": null,
"chrome": null,
"fallback": null
},
"status": "active",
"restriction": null,
"features": [
"geo",
"password",
"expiry"
],
"expires_at": "2026-12-31",
"collections": [
{
"id": 1,
"name": "Marketing",
"description": "All marketing campaign links",
"color": "#FF6B6B"
},
{
"id": 3,
"name": "Social Media",
"description": "Social media platform links",
"color": "#4ECDC4"
}
],
"tags": [
{
"id": 4,
"name": "promo",
"color": "#0967f2"
}
],
"pixels": [
{
"id": 1,
"type": "gtmpixel",
"name": "GTM Pixel",
"tag": "GTM-ABCDE"
},
{
"id": 2,
"type": "fbpixel",
"name": "Facebook Pixel",
"tag": "123456789012345"
}
]
},
"data": {
"clicks": 0,
"uniqueClicks": 0,
"missedClicks": 0,
"topCountries": 0,
"topReferrers": 0,
"topBrowsers": 0,
"topOs": 0,
"socialCount": {
"facebook": 0,
"twitter": 0,
"google": 0
}
}
}
https://linktw.in/api/url/add
To create a link, send your data as JSON (raw body, Content-Type: application/json) or as multipart/form-data (required when uploading an image file directly). The example below shows all available parameters — only url is required.
Restricted destinations: a link to a restricted destination (e.g. adult content platforms) on a shared domain fails with error_code: restricted_domain, plus offer (move, add or upgrade) and domains (your branded domains): use one of them as domain.
| Parameter | Description |
|---|---|
| url | (required) Long URL to shorten. |
| custom | (optional) Custom alias instead of random alias. |
| password | (optional) Password protection |
| domain | (optional) Custom Domain (must match an already added branded domain) |
| expiry | (optional) Expiration for the link example 2024-09-28 23:11:16 |
| clicklimit | (optional) Maximum number of clicks before link expires (integer) |
| expirationredirect | (optional) URL to redirect to after link expires (by date or click limit) |
| note | (optional) Internal note/description for this link (not visible to visitors) |
| display_title | (optional) Custom title for organizing this link in your dashboard. This is for your reference only and does not affect og:title or the link preview. |
| geotarget | (optional) Geo targeting data. Array of objects with location, link, and optional state fields. The location must be a full country name (e.g., "United States", "Canada"). The optional state field allows targeting a specific state/region within the country (e.g., "California"). See full country and state list. |
| devicetarget | (optional) Device targeting data. Array of objects with device and link fields. |
| languagetarget | (optional) Language targeting data. Array of objects with language and link fields. |
| utmtarget | (optional) UTM targeting data. Array of objects with param, value and link fields, checked in order: the first rule whose query parameter matches wins. |
| abtesting | (optional) A/B testing variants. Array of objects with link and optional percent fields. |
| parameters | (optional) URL parameters to append. Array of objects with name and value fields. |
| metatitle | (optional) Meta title |
| metadescription | (optional) Meta description |
| metaimage | (optional) Social share preview image (og:image). Accepts two formats: (1) JSON: provide a publicly accessible URL ending in .jpg, .jpeg, or .png — e.g. "metaimage": "https://example.com/image.jpg"; (2) File upload: send the request as multipart/form-data and include the image file in a field named metaimage. Both formats require JPG/JPEG or PNG, max 1MB. |
| custompreview | (optional) Set to true to turn on the Social Media Preview switch without sending any custom title, description or image. The preview then uses the destination page's own title, description and image. Sending metatitle, metadescription or metaimage turns it on automatically. |
| pixels | (optional) Array of pixel IDs or names to attach to the link. Use either all IDs or all names, not mixed. |
| collections | (optional) Array of collection IDs or names to add the link to. Use either all IDs or all names, not mixed. |
| tags | (optional) Tags for the link: an array or a comma-separated string of tag names or IDs. A new name becomes a tag of the workspace. |
| bridge_override | (optional) Set to 1 to override the account-wide redirect (bridge) page settings for this link. When 0 or omitted, the link inherits your account defaults and the five fields below are ignored. Fields you leave out take your account default. |
| bridge_page | (optional, requires bridge_override=1) 1 to show the bridge page ("Tap to Continue"), 0 to hide it and redirect fast. |
| bridge_auto_redirect | (optional, requires bridge_override=1) 1 to auto-redirect after a delay, 0 to require the visitor to tap to continue. |
| bridge_redirect_delay | (optional, requires bridge_override=1) Auto-redirect delay in seconds (1-30). |
| escape_inapp_browser | (optional, requires bridge_override=1) When the destination app is not installed: 1 to escape in-app browsers (Facebook/Instagram/TikTok) and open in the external browser, 0 to stay in the in-app browser. |
| bridge_lang | (optional, requires bridge_override=1) Language of the redirect page text ("Open in app" etc.): auto (each visitor's browser language, English if unsupported), en, es, de, fr, it, pt-BR, nl, sv, pl, tr, ru, id, vi, th, ja, zh, ko. Without an override the link follows the account setting in Link Settings (English unless changed). |
| param_forwarding | (optional) UTM / parameter forwarding for this link: which query parameters on the short link are passed on to the destination. Object: mode (all, off or custom), names (with custom: the parameter names to forward, a list or a comma-separated string; letters, digits, _ and -), tracking (with custom: true also forwards the common tracking parameters such as utm_*, gclid, fbclid). names and tracking only apply with mode custom. Left out, the link follows the account setting in Link Settings. custom with no usable name and tracking false is refused. |
curl --location --request POST 'https://linktw.in/api/url/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https:\/\/google.com",
"custom": "takeme-to-google",
"password": "mypass",
"expiry": "2023-11-11 12:00:00",
"clicklimit": 1000,
"expirationredirect": "https:\/\/example.com\/expired",
"note": "Internal campaign tracking note",
"display_title": "My Google Link",
"pixels": [
"My Facebook Pixel",
"My GTM Pixel"
],
"collections": [
"Marketing",
"Social Media"
],
"tags": [
"promo",
"summer"
],
"metatitle": "Not Google",
"metadescription": "Not Google description",
"metaimage": "https:\/\/www.mozilla.org\/media\/protocol\/img\/logos\/firefox\/browser\/og.4ad05d4125a5.png",
"geotarget": [
{
"location": "Canada",
"link": "https:\/\/google.ca"
},
{
"location": "United States",
"link": "https:\/\/google.us",
"state": "California"
}
],
"devicetarget": [
{
"device": "iPhone",
"link": "https:\/\/google.com\/iphone"
},
{
"device": "Android",
"link": "https:\/\/google.com\/android"
}
],
"languagetarget": [
{
"language": "en",
"link": "https:\/\/google.com"
},
{
"language": "fr",
"link": "https:\/\/google.ca"
}
],
"utmtarget": [
{
"param": "utm_source",
"value": "facebook",
"link": "https:\/\/example.com\/facebook-offer"
}
],
"abtesting": [
{
"link": "https:\/\/variant-a.example.com",
"percent": 50
},
{
"link": "https:\/\/variant-b.example.com",
"percent": 50
}
],
"parameters": [
{
"name": "aff",
"value": "3"
},
{
"name": "gtm_source",
"value": "api"
}
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'url' => 'https://google.com',
'custom' => 'takeme-to-google',
'password' => 'mypass',
'expiry' => '2023-11-11 12:00:00',
'clicklimit' => 1000,
'expirationredirect' => 'https://example.com/expired',
'note' => 'Internal campaign tracking note',
'display_title' => 'My Google Link',
'pixels' =>
array(
0 => 'My Facebook Pixel',
1 => 'My GTM Pixel',
),
'collections' =>
array(
0 => 'Marketing',
1 => 'Social Media',
),
'tags' =>
array(
0 => 'promo',
1 => 'summer',
),
'metatitle' => 'Not Google',
'metadescription' => 'Not Google description',
'metaimage' => 'https://www.mozilla.org/media/protocol/img/logos/firefox/browser/og.4ad05d4125a5.png',
'geotarget' =>
array(
0 =>
array(
'location' => 'Canada',
'link' => 'https://google.ca',
),
1 =>
array(
'location' => 'United States',
'link' => 'https://google.us',
'state' => 'California',
),
),
'devicetarget' =>
array(
0 =>
array(
'device' => 'iPhone',
'link' => 'https://google.com/iphone',
),
1 =>
array(
'device' => 'Android',
'link' => 'https://google.com/android',
),
),
'languagetarget' =>
array(
0 =>
array(
'language' => 'en',
'link' => 'https://google.com',
),
1 =>
array(
'language' => 'fr',
'link' => 'https://google.ca',
),
),
'utmtarget' =>
array(
0 =>
array(
'param' => 'utm_source',
'value' => 'facebook',
'link' => 'https://example.com/facebook-offer',
),
),
'abtesting' =>
array(
0 =>
array(
'link' => 'https://variant-a.example.com',
'percent' => 50,
),
1 =>
array(
'link' => 'https://variant-b.example.com',
'percent' => 50,
),
),
'parameters' =>
array(
0 =>
array(
'name' => 'aff',
'value' => '3',
),
1 =>
array(
'name' => 'gtm_source',
'value' => 'api',
),
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/url/add',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"url": "https:\/\/google.com",
"custom": "takeme-to-google",
"password": "mypass",
"expiry": "2023-11-11 12:00:00",
"clicklimit": 1000,
"expirationredirect": "https:\/\/example.com\/expired",
"note": "Internal campaign tracking note",
"display_title": "My Google Link",
"pixels": [
"My Facebook Pixel",
"My GTM Pixel"
],
"collections": [
"Marketing",
"Social Media"
],
"tags": [
"promo",
"summer"
],
"metatitle": "Not Google",
"metadescription": "Not Google description",
"metaimage": "https:\/\/www.mozilla.org\/media\/protocol\/img\/logos\/firefox\/browser\/og.4ad05d4125a5.png",
"geotarget": [
{
"location": "Canada",
"link": "https:\/\/google.ca"
},
{
"location": "United States",
"link": "https:\/\/google.us",
"state": "California"
}
],
"devicetarget": [
{
"device": "iPhone",
"link": "https:\/\/google.com\/iphone"
},
{
"device": "Android",
"link": "https:\/\/google.com\/android"
}
],
"languagetarget": [
{
"language": "en",
"link": "https:\/\/google.com"
},
{
"language": "fr",
"link": "https:\/\/google.ca"
}
],
"utmtarget": [
{
"param": "utm_source",
"value": "facebook",
"link": "https:\/\/example.com\/facebook-offer"
}
],
"abtesting": [
{
"link": "https:\/\/variant-a.example.com",
"percent": 50
},
{
"link": "https:\/\/variant-b.example.com",
"percent": 50
}
],
"parameters": [
{
"name": "aff",
"value": "3"
},
{
"name": "gtm_source",
"value": "api"
}
]
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 3,
"shorturl": "https:\/\/linktw.in\/google",
"title": "Google",
"description": "Search the world's information..."
}
https://linktw.in/api/url/:id/update
PUT is the normal update method and must use application/json. POST is required only when you upload an actual image file: use multipart/form-data and attach it as metaimage. You may include the other update fields in that same multipart request; array fields must be JSON-encoded strings. Both methods support /api/url/:id/update for a numeric ID and /api/url/update/:id for a full short URL such as https://linktw.in/abc123. Only send fields you want to change — omitted fields remain unchanged. For array fields, sending the field replaces all existing values. Send null to clear a field, [] to remove all items from an array field; in a multipart request every value is a string, so send the literal text null or [].
Restricted destinations: a link to a restricted destination (e.g. adult content platforms) on a shared domain fails with error_code: restricted_domain, plus offer (move, add or upgrade) and domains (your branded domains): use one of them as domain. When an update makes an existing link restricted, the link is switched off and its status becomes needs_domain.
The generated examples below use PUT + JSON. For a direct file upload, change the method to POST, remove the JSON Content-Type header, and use multipart/form-data (for example: -F "[email protected]").
| Parameter | Description |
|---|---|
| url | (optional) Long URL to update to |
| custom | (optional) Custom alias |
| password | (optional) Password protection. Send null to remove. |
| domain | (optional) Custom Domain (must match an already added branded domain) |
| expiry | (optional) Expiration for the link (e.g., 2024-09-28 23:11:16). Send null to remove. |
| clicklimit | (optional) Maximum number of clicks before link expires. Send null to remove. |
| expirationredirect | (optional) URL to redirect to after link expires. Send null to remove. |
| note | (optional) Internal note/description. Send null to remove. |
| display_title | (optional) Custom title for dashboard organization. Send null to remove. |
| geotarget | (optional) Geo targeting data (full replacement). Array of objects with location, link, and optional state fields. Send [] to clear all. The location must be a full country name (e.g., "United States", "Canada"). The optional state field allows targeting a specific state/region within the country (e.g., "California"). See full country and state list. |
| devicetarget | (optional) Device targeting data (full replacement). Array of objects with device and link fields. Send [] to clear all. |
| languagetarget | (optional) Language targeting data (full replacement). Array of objects with language and link fields. Send [] to clear all. |
| utmtarget | (optional) UTM targeting data (full replacement, order kept). Array of objects with param, value and link fields. Omit to keep, send [] to clear all. |
| abtesting | (optional) A/B testing variants (full replacement). Array of objects with link and optional percent fields. Send [] to clear all. |
| parameters | (optional) URL parameters (full replacement). Array of objects with name and value fields. Send [] to clear all. |
| metatitle | (optional) Meta title. Send null to remove. |
| metadescription | (optional) Meta description. Send null to remove. |
| metaimage | (optional) Social share preview image (og:image). With PUT + JSON, provide a publicly accessible .jpg, .jpeg, or .png URL, or send null to remove the uploaded image (with a custom title or description still set, the preview then uses the destination page's own image, as "Page image" does on the website), or send exactly "none" for a preview without an image (the website's "No image"; it switches the social preview on unless custompreview: false is sent too; update only). To upload image bytes directly, use POST + multipart/form-data and include the JPG/PNG file in the metaimage field (max 1MB). |
| custompreview | (optional) true turns the Social Media Preview switch on (the preview uses the destination page's own image when no custom image is set). false turns it off and removes the custom title, description and image. |
| pixels | (optional) Array of pixel IDs or names (full replacement). Send [] to remove all pixels. |
| collections | (optional) Array of collection IDs or names (full replacement). Send [] to remove from all collections. |
| tags | (optional) Tag names or IDs (full replacement). A new name becomes a tag of the workspace. Send [] to remove all tags. |
| bridge_override | (optional) 1 to override the account-wide redirect (bridge) page settings for this link, 0 to go back to the account defaults. Omit to keep the current settings. With 1, the five fields below that you omit keep their current value. |
| bridge_page | (optional, with bridge_override=1) 1 to show the bridge page ("Tap to Continue"), 0 to hide it and redirect fast. |
| bridge_auto_redirect | (optional, with bridge_override=1) 1 to auto-redirect after a delay, 0 to require the visitor to tap to continue. |
| bridge_redirect_delay | (optional, with bridge_override=1) Auto-redirect delay in seconds (1-30). |
| escape_inapp_browser | (optional, with bridge_override=1) 1 to escape in-app browsers and open the external browser when the app is not installed, 0 to stay in the in-app browser. |
| bridge_lang | (optional, with bridge_override=1) Redirect page language: auto, en, es, de, fr, it, pt-BR, nl, sv, pl, tr, ru, id, vi, th, ja, zh, ko. |
| music | (optional) Smart Music Link, for links to a music or podcast platform (music.available in Get a Single Link). Object: services (list of platform URLs, e.g. Spotify, Apple Music, YouTube Music; first URL per platform, in display order), auto_open (a service key such as spotify, or null for the picker only), title, artist, style (list or icons). Keys left out keep their values; services left out keep the current platforms, or the link's own URL. null or {"enabled": false} switches it off. Fails when the plan does not include Music Link or its limit is reached. |
| store | (optional) App Store Link, for links to an app store listing (store.available in Get a Single Link): routes each visitor to their device's store. Object: ios, android, huawei (needs android), mac, windows, chrome (each a listing URL on that store), fallback (any URL, for other devices; dropped if it fails the security checks). Keys left out keep their values. null or {"enabled": false} switches it off. The store routing appears in device with source store; it is not part of devicetarget. |
| param_forwarding | (optional) UTM / parameter forwarding for this link: which query parameters on the short link are passed on to the destination. Object: mode (all, off or custom), names (with custom: the parameter names to forward, a list or a comma-separated string; letters, digits, _ and -), tracking (with custom: true also forwards the common tracking parameters such as utm_*, gclid, fbclid). names and tracking only apply with mode custom. Keys left out keep their values. null makes the link follow the account setting in Link Settings again. custom with no usable name and tracking false is refused. |
| stock_monitor | (optional) Amazon Stock Monitor for this link (stock_monitor.available in Get a Single Link: an Amazon product link, a plan with Stock Monitor and the account switch on in the affiliate settings). Object: monitor (auto: follows the account, newest links first; on: always monitored, pinned; off: never), action (if out of stock: none = dashboard dot only, notify = daily summary email, product = switch to a replacement from alternatives, auto = switch to a related product; null = account default), alternatives (Amazon product links, in order of preference; product needs at least one), suppressed_oos (true: "See All Buying Options" counts as out of stock; null = account default). Keys left out keep their values. null puts the link back on the account defaults. The plan sets how many products can be monitored; pinned links go first. A pin past that limit is saved but not monitored. When stock_monitor is sent, the response includes it (as in Get a Single Link), so monitored, used and cap show the result. |
curl --location --request PUT 'https://linktw.in/api/url/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https:\/\/google.com",
"custom": "google",
"password": "mypass",
"expiry": "2024-12-31 23:59:59",
"clicklimit": 500,
"expirationredirect": "https:\/\/example.com\/link-expired",
"note": "Updated campaign note",
"display_title": "Updated Dashboard Title",
"pixels": [
"My Facebook Pixel",
"My GTM Pixel"
],
"collections": [
"Marketing",
"Q4 Campaign"
],
"tags": [
"promo"
],
"metatitle": "Updated Title",
"metadescription": "Updated description",
"geotarget": [
{
"location": "Canada",
"link": "https:\/\/google.ca"
},
{
"location": "United States",
"link": "https:\/\/google.us",
"state": "New York"
}
],
"devicetarget": [
{
"device": "iPhone",
"link": "https:\/\/google.com\/iphone"
},
{
"device": "Android",
"link": "https:\/\/google.com\/android"
}
],
"languagetarget": [
{
"language": "en",
"link": "https:\/\/google.com"
},
{
"language": "es",
"link": "https:\/\/google.es"
}
],
"abtesting": [
{
"link": "https:\/\/variant-a.example.com",
"percent": 70
},
{
"link": "https:\/\/variant-b.example.com",
"percent": 30
}
],
"parameters": [
{
"name": "utm_source",
"value": "api"
},
{
"name": "utm_campaign",
"value": "winter2024"
}
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/:id/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'url' => 'https://google.com',
'custom' => 'google',
'password' => 'mypass',
'expiry' => '2024-12-31 23:59:59',
'clicklimit' => 500,
'expirationredirect' => 'https://example.com/link-expired',
'note' => 'Updated campaign note',
'display_title' => 'Updated Dashboard Title',
'pixels' =>
array(
0 => 'My Facebook Pixel',
1 => 'My GTM Pixel',
),
'collections' =>
array(
0 => 'Marketing',
1 => 'Q4 Campaign',
),
'tags' =>
array(
0 => 'promo',
),
'metatitle' => 'Updated Title',
'metadescription' => 'Updated description',
'geotarget' =>
array(
0 =>
array(
'location' => 'Canada',
'link' => 'https://google.ca',
),
1 =>
array(
'location' => 'United States',
'link' => 'https://google.us',
'state' => 'New York',
),
),
'devicetarget' =>
array(
0 =>
array(
'device' => 'iPhone',
'link' => 'https://google.com/iphone',
),
1 =>
array(
'device' => 'Android',
'link' => 'https://google.com/android',
),
),
'languagetarget' =>
array(
0 =>
array(
'language' => 'en',
'link' => 'https://google.com',
),
1 =>
array(
'language' => 'es',
'link' => 'https://google.es',
),
),
'abtesting' =>
array(
0 =>
array(
'link' => 'https://variant-a.example.com',
'percent' => 70,
),
1 =>
array(
'link' => 'https://variant-b.example.com',
'percent' => 30,
),
),
'parameters' =>
array(
0 =>
array(
'name' => 'utm_source',
'value' => 'api',
),
1 =>
array(
'name' => 'utm_campaign',
'value' => 'winter2024',
),
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://linktw.in/api/url/:id/update',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"url": "https:\/\/google.com",
"custom": "google",
"password": "mypass",
"expiry": "2024-12-31 23:59:59",
"clicklimit": 500,
"expirationredirect": "https:\/\/example.com\/link-expired",
"note": "Updated campaign note",
"display_title": "Updated Dashboard Title",
"pixels": [
"My Facebook Pixel",
"My GTM Pixel"
],
"collections": [
"Marketing",
"Q4 Campaign"
],
"tags": [
"promo"
],
"metatitle": "Updated Title",
"metadescription": "Updated description",
"geotarget": [
{
"location": "Canada",
"link": "https:\/\/google.ca"
},
{
"location": "United States",
"link": "https:\/\/google.us",
"state": "New York"
}
],
"devicetarget": [
{
"device": "iPhone",
"link": "https:\/\/google.com\/iphone"
},
{
"device": "Android",
"link": "https:\/\/google.com\/android"
}
],
"languagetarget": [
{
"language": "en",
"link": "https:\/\/google.com"
},
{
"language": "es",
"link": "https:\/\/google.es"
}
],
"abtesting": [
{
"link": "https:\/\/variant-a.example.com",
"percent": 70
},
{
"link": "https:\/\/variant-b.example.com",
"percent": 30
}
],
"parameters": [
{
"name": "utm_source",
"value": "api"
},
{
"name": "utm_campaign",
"value": "winter2024"
}
]
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 3,
"shorturl": "https:\/\/linktw.in\/google",
"title": "Google",
"description": "Search the world's information..."
}
https://linktw.in/api/url/:id/delete
To delete a link, you need to send a DELETE request. You can use either DELETE /api/url/:id/delete (for numeric IDs) or DELETE /api/url/delete/:id (for both numeric IDs and full short URLs like https://linktw.in/abc123).
curl --location --request DELETE 'https://linktw.in/api/url/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/:id/delete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://linktw.in/api/url/:id/delete',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Link has been successfully deleted."
}
https://linktw.in/api/url/:id/move-domain
For links with the status needs_domain: links with adult, gambling or high-risk content, or to a restricted destination, are switched off on our shared domains but work on your own. This moves the link to one of your branded domains (restriction.domains) and switches it back on, like the Move button in the dashboard: status becomes active, or upgrade_required on the free plan when the destination is not on the approved list. The destination is checked again first. Refused with error 1 when the link is not needs_domain, when domain is not one of yours, or when the destination is now flagged. The short code stays when it is free on that domain, otherwise the link gets a new one (new_code: true). The old short URL stops working. Creating or updating a link to a restricted destination on a shared domain fails with error_code: restricted_domain, plus offer and domains.
| Parameter | Description |
|---|---|
| :id | (required) The link ID |
| domain | (optional) One of your branded domains, exactly as given in restriction.domains. Defaults to the first one. |
curl --location --request POST 'https://linktw.in/api/url/:id/move-domain' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"domain": "https:\/\/go.example.com"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/:id/move-domain",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'domain' => 'https://go.example.com',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/url/:id/move-domain',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"domain": "https:\/\/go.example.com"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 1,
"shorturl": "https:\/\/go.example.com\/googlecanada",
"domain": "https:\/\/go.example.com",
"new_code": false,
"status": "active",
"restriction": null
}
https://linktw.in/api/url/:id/cover
Set the cover image of a link: the artwork the Smart Music Link / podcast page shows (music.cover in Get a Single Link), also the link's image on bio pages. Send multipart/form-data with image (JPG, PNG or WebP, max 500 KB; square works best). Optional image_og: a 1200×1200 JPEG of the same crop, used when the link is shared (social previews); without it the cover itself is used. Send clear = 1 (form or JSON) to remove your upload and go back to the fetched artwork (not together with an image). An image over the size limit is refused with "The image is too large". Without a cover of your own, the music page uses the artwork fetched from the platform. The response returns cover (the image now shown, or null) and cover_custom (true when a cover is set on the link; false = the fetched artwork). For links that are not music or podcast links, music.cover is null.
| Parameter | Description |
|---|---|
| :id | (required) The link ID |
| image | (required unless clear is sent) The cover image file. |
| image_og | (optional) Share-sized JPEG of the same crop. |
| clear | (optional) 1 = remove your cover. |
curl --location --request POST 'https://linktw.in/api/url/:id/cover' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/:id/cover",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/url/:id/cover',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 1,
"cover": "https:\/\/linktw.in\/content\/images\/AbCdEf_bi_GhIjKl.webp",
"cover_custom": true
}
https://linktw.in/api/urls/delete
Delete multiple links in a single request. Send an array of link IDs to delete.
| Parameter | Description |
|---|---|
| ids | (required) Array of link IDs to delete |
curl --location --request POST 'https://linktw.in/api/urls/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"ids": [
101,
102,
103
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls/delete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'ids' =>
array(
0 => 101,
1 => 102,
2 => 103,
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/urls/delete',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"ids": [
101,
102,
103
]
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"deleted": [
101,
102,
103
],
"errors": []
}
https://linktw.in/api/urls/bulk/preview
See what a change would do to up to 500 links, without changing anything: how many change, a few before and after samples, and the links that cannot change. Send the same body to Apply a Bulk Edit.
| Parameter | Description |
|---|---|
| ids | (required) Array of link IDs, at most 500 |
| op | (required) What to change: destination, replace, utm, domain, expiry, clicklimit, pixels_add, pixels_remove, collection_add, collection_remove, tags_add or tags_remove |
| url | (destination) The new destination URL |
| find | (replace) The text to find in the destinations, replace the text to put in its place, match_case true to match capitals |
| utm_source | (utm) utm_source, utm_medium, utm_campaign, utm_term and utm_content, with utm_mode add (keep values already there) or replace |
| domain | (domain) One of your domains |
| expiry | (expiry) Date and time in your time zone, for example 2026-12-31 23:59. Empty removes the expiry. |
| clicklimit | (clicklimit) A number of clicks. 0 removes the limit. |
| pixels | (pixels_add, pixels_remove) Array of pixel IDs |
| collection | (collection_add, collection_remove) A collection ID |
| tags | (tags_add, tags_remove) Tag names or IDs. tags_add turns new names into tags. |
curl --location --request POST 'https://linktw.in/api/urls/bulk/preview' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"ids": [
101,
102,
103
],
"op": "utm",
"utm_mode": "add",
"utm_source": "newsletter",
"utm_campaign": "spring"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls/bulk/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'ids' =>
array(
0 => 101,
1 => 102,
2 => 103,
),
'op' => 'utm',
'utm_mode' => 'add',
'utm_source' => 'newsletter',
'utm_campaign' => 'spring',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/urls/bulk/preview',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"ids": [
101,
102,
103
],
"op": "utm",
"utm_mode": "add",
"utm_source": "newsletter",
"utm_campaign": "spring"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"op": "utm",
"label": "Add UTM parameters",
"selected": 3,
"found": 3,
"changing": 2,
"unchanged": 1,
"problems": 0,
"ids": [
101,
102
],
"samples": [
{
"id": 101,
"short": "linktw.in\/spring",
"title": "Spring sale",
"before": "https:\/\/example.com\/spring",
"after": "https:\/\/example.com\/spring?utm_source=newsletter&utm_campaign=spring"
}
],
"issues": [],
"chunk": 4
}
}
https://linktw.in/api/urls/bulk/apply
Apply a change to one chunk of links: at most chunk links per call (from the preview: 4 for destination, replace and utm, 25 for domain, expiry, click limit and pixels, 100 for the rest). The first call answers an edit_id: send it with every next chunk of the same change, so one undo puts them all back.
| Parameter | Description |
|---|---|
| ids | (required) The link IDs of this chunk |
| op | (required) The change, with its fields, as for Preview a Bulk Edit |
| edit_id | (optional) The edit_id of the first chunk, for every next chunk |
curl --location --request POST 'https://linktw.in/api/urls/bulk/apply' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"ids": [
101,
102
],
"op": "utm",
"utm_mode": "add",
"utm_source": "newsletter",
"utm_campaign": "spring"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls/bulk/apply",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'ids' =>
array(
0 => 101,
1 => 102,
),
'op' => 'utm',
'utm_mode' => 'add',
'utm_source' => 'newsletter',
'utm_campaign' => 'spring',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/urls/bulk/apply',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"ids": [
101,
102
],
"op": "utm",
"utm_mode": "add",
"utm_source": "newsletter",
"utm_campaign": "spring"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"edit_id": 58,
"changed": [
101,
102
],
"unchanged": [],
"failed": [],
"flagged": null
}
}
https://linktw.in/api/urls/bulk/undo
Put back the links of the last bulk change, within 24 hours, 25 links per call: call again while remaining is above 0. A link edited since keeps its newer values.
| Parameter | Description |
|---|---|
| edit_id | (optional) The edit_id to undo. Default: the last change. |
curl --location --request POST 'https://linktw.in/api/urls/bulk/undo' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"edit_id": 58
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls/bulk/undo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'edit_id' => 58,
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/urls/bulk/undo',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"edit_id": 58
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Undone.",
"data": {
"edit_id": 58,
"restored": 2,
"kept": 0,
"remaining": 0,
"done": true,
"issues": []
}
}
https://linktw.in/api/urls/bulk/last
The bulk change that can still be undone, or null.
curl --location --request GET 'https://linktw.in/api/urls/bulk/last' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls/bulk/last",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/urls/bulk/last',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"edit": {
"id": 58,
"op": "utm",
"label": "Add UTM parameters",
"changed": 2,
"created_at": "2026-11-12 10:00:00",
"expires_at": "2026-11-13 10:00:00"
}
}
}
https://linktw.in/api/tags
List the tags of your links, with how many links carry each, and the colors a tag can have. Filter links by tag with the tags parameter of List Links.
curl --location --request GET 'https://linktw.in/api/tags' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/tags",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/tags',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"tags": [
{
"id": 4,
"name": "promo",
"color": "#0967f2",
"links": 12
}
],
"colors": [
"#64748b",
"#0967f2",
"#0ca30c",
"#fab219",
"#d03b3b",
"#7c3aed",
"#db2777",
"#0891b2"
]
}
}
https://linktw.in/api/tag/add
Create a tag. If a tag with the same name exists, you get that tag.
| Parameter | Description |
|---|---|
| name | (required) The tag name, at most 40 characters |
| color | (optional) One of the colors of List Tags. Default: the color your tags use least. |
curl --location --request POST 'https://linktw.in/api/tag/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "summer",
"color": "#0ca30c"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/tag/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'name' => 'summer',
'color' => '#0ca30c',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/tag/add',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "summer",
"color": "#0ca30c"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Tag saved.",
"data": {
"tag": {
"id": 7,
"name": "summer",
"color": "#0ca30c"
}
}
}
https://linktw.in/api/tag/:id/update
Rename a tag or change its color. Every link that carries it shows the change.
| Parameter | Description |
|---|---|
| name | (optional) The new name |
| color | (optional) One of the colors of List Tags |
curl --location --request PUT 'https://linktw.in/api/tag/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "summer-2026"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/tag/:id/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'name' => 'summer-2026',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://linktw.in/api/tag/:id/update',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "summer-2026"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Tag saved.",
"data": {
"tag": {
"id": 7,
"name": "summer-2026",
"color": "#0ca30c"
}
}
}
https://linktw.in/api/tag/:id/delete
Delete a tag. It comes off every link; the links stay.
curl --location --request DELETE 'https://linktw.in/api/tag/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/tag/:id/delete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://linktw.in/api/tag/:id/delete',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Tag deleted."
}
https://linktw.in/api/domains?limit=2&page=1
Get all available domains for shortening links. This includes standard (platform-provided) domains and your branded (custom) domains. Use the isStandard field to distinguish between them.
| Parameter | Description |
|---|---|
| limit | (optional) Per page data result for branded domains |
| page | (optional) Current page request for branded domains |
curl --location --request GET 'https://linktw.in/api/domains?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/domains?limit=2&page=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/domains?limit=2&page=1',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": "0",
"data": {
"result": 4,
"perpage": 15,
"currentpage": 1,
"nextpage": null,
"maxpage": 1,
"domains": [
{
"id": "default",
"domain": "https:\/\/linktw.in",
"redirectroot": null,
"redirect404": null,
"isStandard": true
},
{
"id": "standard_abc123",
"domain": "https:\/\/short.link",
"redirectroot": null,
"redirect404": null,
"isStandard": true
},
{
"id": 1,
"domain": "https:\/\/mybrand.com",
"redirectroot": "https:\/\/mybrand.com\/home",
"redirect404": "https:\/\/mybrand.com\/404",
"isStandard": false
},
{
"id": 2,
"domain": "https:\/\/mycompany.io",
"redirectroot": "https:\/\/mycompany.io",
"redirect404": "https:\/\/mycompany.io\/not-found",
"isStandard": false
}
]
}
}
https://linktw.in/api/domain/add
A domain can be added using this endpoint. Please make sure the domain is correctly pointed to our server.
| Parameter | Description |
|---|---|
| domain | (required) Branded domain including http or https |
| redirectroot | (optional) Root redirect when someone visits your domain |
| redirect404 | (optional) Custom 404 redirect |
curl --location --request POST 'https://linktw.in/api/domain/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"domain": "https:\/\/domain1.com",
"redirectroot": "https:\/\/rootdomain.com",
"redirect404": "https:\/\/rootdomain.com\/404"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/domain/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'domain' => 'https://domain1.com',
'redirectroot' => 'https://rootdomain.com',
'redirect404' => 'https://rootdomain.com/404',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/domain/add',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"domain": "https:\/\/domain1.com",
"redirectroot": "https:\/\/rootdomain.com",
"redirect404": "https:\/\/rootdomain.com\/404"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 1
}
https://linktw.in/api/domain/:id/update
To update a branded domain, you need to send a valid data in JSON via a PUT request. The data must be sent as the raw body of your request as shown below. The example below shows all the parameters you can send but you are not required to send all (See table for more info).
| Parameter | Description |
|---|---|
| redirectroot | (optional) Root redirect when someone visits your domain |
| redirect404 | (optional) Custom 404 redirect |
curl --location --request PUT 'https://linktw.in/api/domain/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"redirectroot": "https:\/\/rootdomain-new.com",
"redirect404": "https:\/\/rootdomain-new.com\/404"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/domain/:id/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'redirectroot' => 'https://rootdomain-new.com',
'redirect404' => 'https://rootdomain-new.com/404',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://linktw.in/api/domain/:id/update',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"redirectroot": "https:\/\/rootdomain-new.com",
"redirect404": "https:\/\/rootdomain-new.com\/404"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Domain has been updated successfully."
}
https://linktw.in/api/domain/:id/delete
To delete a domain, you need to send a DELETE request.
curl --location --request DELETE 'https://linktw.in/api/domain/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/domain/:id/delete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://linktw.in/api/domain/:id/delete',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Domain has been deleted successfully."
}
https://linktw.in/api/pixels?limit=2&page=1
To get your pixels codes via the API, you can use this endpoint. You can also filter data (See table for more info).
| Parameter | Description |
|---|---|
| limit | (optional) Per page data result |
| page | (optional) Current page request |
curl --location --request GET 'https://linktw.in/api/pixels?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/pixels?limit=2&page=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/pixels?limit=2&page=1',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": "0",
"data": {
"result": 2,
"perpage": 2,
"currentpage": 1,
"nextpage": 1,
"maxpage": 1,
"pixels": [
{
"id": 1,
"type": "gtmpixel",
"name": "GTM Pixel",
"tag": "GA-123456789",
"event": null,
"date": "2023-11-10 18:00:00"
},
{
"id": 2,
"type": "fbpixel",
"name": "Facebook Pixel",
"tag": "1234567890123456",
"event": "Lead",
"date": "2023-11-10 18:10:00"
}
]
}
}
https://linktw.in/api/pixel/add
A pixel can be created using this endpoint. You need to send the pixel type and the tag.
| Parameter | Description |
|---|---|
| type | (required) gtmpixel | gapixel | fbpixel | adwordspixel | linkedinpixel | twitterpixel | adrollpixel | quorapixel | pinterest | bing | snapchat | reddit | tiktok |
| name | (required) Custom name for your pixel |
| tag | (required) The tag for the pixel |
| event | (optional, Facebook only) Standard event to fire in addition to PageView on every link click. One of: Lead, CompleteRegistration, ViewContent, Search, AddToCart, AddToWishlist, InitiateCheckout, AddPaymentInfo, Purchase, Subscribe, StartTrial, Contact, Schedule, SubmitApplication, Donate. Defaults to PageView only. |
curl --location --request POST 'https://linktw.in/api/pixel/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "fbpixel",
"name": "My Facebook Pixel",
"tag": "1234567890123456",
"event": "Lead"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/pixel/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'type' => 'fbpixel',
'name' => 'My Facebook Pixel',
'tag' => '1234567890123456',
'event' => 'Lead',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/pixel/add',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"type": "fbpixel",
"name": "My Facebook Pixel",
"tag": "1234567890123456",
"event": "Lead"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 1
}
https://linktw.in/api/pixel/:id/update
To update a pixel, you need to send a valid data in JSON via a PUT request. The data must be sent as the raw body of your request as shown below. The example below shows all the parameters you can send but you are not required to send all (See table for more info).
| Parameter | Description |
|---|---|
| name | (optional) Custom name for your pixel |
| tag | (required) The tag for the pixel |
| event | (optional, Facebook only) Standard event to fire in addition to PageView. Send PageView (or omit) for PageView only. See "Create a Pixel" for the full list of allowed values. |
curl --location --request PUT 'https://linktw.in/api/pixel/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "My Facebook Pixel",
"tag": "1234567890123456",
"event": "Lead"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/pixel/:id/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'name' => 'My Facebook Pixel',
'tag' => '1234567890123456',
'event' => 'Lead',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://linktw.in/api/pixel/:id/update',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "My Facebook Pixel",
"tag": "1234567890123456",
"event": "Lead"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Pixel has been updated successfully."
}
https://linktw.in/api/pixel/:id/delete
To delete a pixel, you need to send a DELETE request.
curl --location --request DELETE 'https://linktw.in/api/pixel/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/pixel/:id/delete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://linktw.in/api/pixel/:id/delete',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Pixel has been deleted successfully."
}
https://linktw.in/api/pixel/:id?limit=15&page=1
To get a single pixel with its assigned links via the API, you can use this endpoint. Returns the pixel details and a paginated list of links that have this pixel assigned.
| Parameter | Description |
|---|---|
| :id | (required) Pixel ID |
| limit | (optional) Per page data result |
| page | (optional) Current page request |
curl --location --request GET 'https://linktw.in/api/pixel/:id?limit=15&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/pixel/:id?limit=15&page=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/pixel/:id?limit=15&page=1',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"result": 15,
"perpage": 15,
"currentpage": 1,
"nextpage": 2,
"maxpage": 3,
"pixel": {
"id": 1,
"type": "gtmpixel",
"name": "GTM Pixel",
"tag": "GTM-XXXXX",
"event": null,
"date": "2024-01-15 12:00:00"
},
"links": [
{
"id": 101,
"title": "Example Link",
"shorturl": "https:\/\/linktw.in\/abc123",
"longurl": "https:\/\/example.com",
"clicks": 150,
"date": "2024-01-10"
}
]
}
}
https://linktw.in/api/pixel/:id/links
Add or remove multiple links to/from a pixel in a single request. Send an array of link IDs to add and/or remove.
| Parameter | Description |
|---|---|
| :id | (required) Pixel ID |
| add | (optional) Array of link IDs to add this pixel to |
| remove | (optional) Array of link IDs to remove this pixel from |
curl --location --request POST 'https://linktw.in/api/pixel/:id/links' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"add": [
101,
102,
103
],
"remove": [
50,
51
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/pixel/:id/links",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'add' =>
array(
0 => 101,
1 => 102,
2 => 103,
),
'remove' =>
array(
0 => 50,
1 => 51,
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/pixel/:id/links',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"add": [
101,
102,
103
],
"remove": [
50,
51
]
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"pixel_id": 1,
"added": [
101,
102,
103
],
"removed": [
50,
51
],
"errors": []
}
https://linktw.in/api/qr?limit=2&page=1
To get your QR codes via the API, you can use this endpoint. You can also filter data (See table for more info).
| Parameter | Description |
|---|---|
| limit | (optional) Per page data result |
| page | (optional) Current page request |
curl --location --request GET 'https://linktw.in/api/qr?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/qr?limit=2&page=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/qr?limit=2&page=1',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": "0",
"data": {
"result": 2,
"perpage": 2,
"currentpage": 1,
"nextpage": 1,
"maxpage": 1,
"qrs": [
{
"id": 2,
"link": "https:\/\/linktw.in\/qr\/a2d5e",
"scans": 0,
"name": "Google",
"date": "2023-11-10 18:01:43"
},
{
"id": 1,
"link": "https:\/\/linktw.in\/qr\/b9edfe",
"scans": 5,
"name": "Google Canada",
"date": "2023-11-10 18:00:25"
}
]
}
}
https://linktw.in/api/qr/:id
To get details for a single QR code via the API, you can use this endpoint.
curl --location --request GET 'https://linktw.in/api/qr/:id' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/qr/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/qr/:id',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"details": {
"id": 1,
"link": "https:\/\/linktw.in\/qr\/b9edfe",
"scans": 5,
"name": "Google Canada",
"date": "2023-11-10 18:00:25"
},
"data": {
"clicks": 1,
"uniqueClicks": 1,
"topCountries": {
"Unknown": "1"
},
"topReferrers": {
"Direct, email and other": "1"
},
"topBrowsers": {
"Chrome": "1"
},
"topOs": {
"Windows 10": "1"
},
"socialCount": {
"facebook": 0,
"twitter": 0,
"instagram": 0
}
}
}
https://linktw.in/api/qr/add
To create a QR Code, you need to send a valid data in JSON via a POST request. The data must be sent as the raw body of your request as shown below. The example below shows all the parameters you can send but you are not required to send all (See table for more info).
| Parameter | Description |
|---|---|
| type | (required) text | vcard | link | email | phone | sms | wifi |
| data | (required) Data to be embedded inside the QR code. The data can be string or array depending on the type |
| background | (optional) RGB color e.g. rgb(255,255,255) |
| foreground | (optional) RGB color e.g. rgb(0,0,0) |
| logo | (optional) Path to the logo either png or jpg |
curl --location --request POST 'https://linktw.in/api/qr/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "link",
"data": "https:\/\/google.com",
"background": "rgb(255,255,255)",
"foreground": "rgb(0,0,0)",
"logo": "https:\/\/site.com\/logo.png"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/qr/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'type' => 'link',
'data' => 'https://google.com',
'background' => 'rgb(255,255,255)',
'foreground' => 'rgb(0,0,0)',
'logo' => 'https://site.com/logo.png',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/qr/add',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"type": "link",
"data": "https:\/\/google.com",
"background": "rgb(255,255,255)",
"foreground": "rgb(0,0,0)",
"logo": "https:\/\/site.com\/logo.png"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 3,
"link": "https:\/\/linktw.in\/qr\/a58f79"
}
https://linktw.in/api/qr/:id/update
To update a QR Code, you need to send a valid data in JSON via a PUT request. The data must be sent as the raw body of your request as shown below. The example below shows all the parameters you can send but you are not required to send all (See table for more info).
| Parameter | Description |
|---|---|
| data | (required) Data to be embedded inside the QR code. The data can be string or array depending on the type |
| background | (optional) RGB color e.g. rgb(255,255,255) |
| foreground | (optional) RGB color e.g. rgb(0,0,0) |
| logo | (optional) Path to the logo either png or jpg |
curl --location --request PUT 'https://linktw.in/api/qr/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "link",
"data": "https:\/\/google.com",
"background": "rgb(255,255,255)",
"foreground": "rgb(0,0,0)",
"logo": "https:\/\/site.com\/logo.png"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/qr/:id/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'type' => 'link',
'data' => 'https://google.com',
'background' => 'rgb(255,255,255)',
'foreground' => 'rgb(0,0,0)',
'logo' => 'https://site.com/logo.png',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://linktw.in/api/qr/:id/update',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"type": "link",
"data": "https:\/\/google.com",
"background": "rgb(255,255,255)",
"foreground": "rgb(0,0,0)",
"logo": "https:\/\/site.com\/logo.png"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "QR has been updated successfully."
}
https://linktw.in/api/qr/:id/delete
To delete a QR code, you need to send a DELETE request.
curl --location --request DELETE 'https://linktw.in/api/qr/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/qr/:id/delete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://linktw.in/api/qr/:id/delete',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "QR Code has been deleted successfully."
}
https://linktw.in/api/collections?limit=2&page=1
To get your collections via the API, you can use this endpoint. You can also filter data (See table for more info).
| Parameter | Description |
|---|---|
| limit | (optional) Per page data result |
| page | (optional) Current page request |
curl --location --request GET 'https://linktw.in/api/collections?limit=2&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/collections?limit=2&page=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/collections?limit=2&page=1',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": "0",
"data": {
"result": 2,
"perpage": 2,
"currentpage": 1,
"nextpage": 1,
"maxpage": 1,
"collections": [
{
"id": 1,
"name": "Social Media",
"description": "All social media links",
"color": "#1E88E5",
"public": false,
"rotator": false,
"list": "https:\/\/domain.com\/u\/admin\/social-media-1",
"starred": true,
"views": 150,
"clicks": 5420
},
{
"id": 2,
"name": "Marketing Campaign",
"description": "Q4 Marketing Campaign",
"color": "#00897B",
"public": true,
"rotator": "https:\/\/domain.com\/r\/marketing-campaign",
"list": "https:\/\/domain.com\/u\/admin\/marketing-campaign-2",
"starred": false,
"views": 300,
"clicks": 12580
}
]
}
}
https://linktw.in/api/collection/:id?limit=1&page=1
To get items in a selected collection via the API, you can use this endpoint. You can also filter data (See table for more info).
| Parameter | Description |
|---|---|
| limit | (optional) Per page data result |
| page | (optional) Current page request |
curl --location --request GET 'https://linktw.in/api/collection/:id?limit=1&page=1' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/collection/:id?limit=1&page=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/collection/:id?limit=1&page=1',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": "0",
"data": {
"result": 2,
"perpage": 2,
"currentpage": 1,
"nextpage": 1,
"maxpage": 1,
"items": [
{
"type": "links",
"id": 1,
"title": "My Sample Link",
"preview": "https:\/\/google.com",
"link": "https:\/\/linktw.in\/google",
"date": "2024-05-12"
},
{
"type": "bio",
"id": 1,
"title": "My Sample Bio",
"preview": "https:\/\/linktw.in\/mybio",
"link": "https:\/\/linktw.in\/mybio",
"date": "2024-06-01"
},
{
"type": "qr",
"id": 1,
"title": "My QR Code",
"preview": "https:\/\/example.com",
"link": "https:\/\/linktw.in\/qr\/1",
"date": "2024-06-15"
}
]
}
}
https://linktw.in/api/collection/add
A collection can be added using this endpoint.
| Parameter | Description |
|---|---|
| name | (required) Collection name |
| slug | (optional) Rotator Slug |
| description | (optional) Collection description |
| color | (optional) Collection badge color (HEX) |
| public | (optional) Access (true or false) |
| starred | (optional) Star the collection or not (true or false) |
curl --location --request POST 'https://linktw.in/api/collection/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "NewCollection",
"slug": "new-collection",
"description": "My new collection",
"color": "#1E88E5",
"public": true,
"starred": true
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/collection/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'name' => 'NewCollection',
'slug' => 'new-collection',
'description' => 'My new collection',
'color' => '#1E88E5',
'public' => true,
'starred' => true,
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/collection/add',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "NewCollection",
"slug": "new-collection",
"description": "My new collection",
"color": "#1E88E5",
"public": true,
"starred": true
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 3,
"name": "New Collection",
"public": true,
"rotator": "https:\/\/domain.com\/r\/new-collection",
"list": "https:\/\/domain.com\/u\/admin\/new-collection-3"
}
https://linktw.in/api/collection/:collectionid/assign/:itemid
A link can be assigned to any collection by sending a request with the collection id and link id.
| Parameter | Description |
|---|---|
| :collectionid | (required) Collection ID |
| :itemid | (required) Link ID |
curl --location --request POST 'https://linktw.in/api/collection/:collectionid/assign/:itemid' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/collection/:collectionid/assign/:itemid",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/collection/:collectionid/assign/:itemid',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Link successfully added to the collection."
}
https://linktw.in/api/collection/:id/links
Add or remove multiple links to/from a collection in a single request. Send an array of link IDs to add and/or remove.
| Parameter | Description |
|---|---|
| :id | (required) Collection ID |
| add | (optional) Array of link IDs to add to the collection |
| remove | (optional) Array of link IDs to remove from the collection |
curl --location --request POST 'https://linktw.in/api/collection/:id/links' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"add": [
101,
102,
103
],
"remove": [
50,
51
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/collection/:id/links",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'add' =>
array(
0 => 101,
1 => 102,
2 => 103,
),
'remove' =>
array(
0 => 50,
1 => 51,
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/collection/:id/links',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"add": [
101,
102,
103
],
"remove": [
50,
51
]
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"collection_id": 5,
"added": [
101,
102,
103
],
"removed": [
50,
51
],
"errors": []
}
https://linktw.in/api/collection/:id/update
To update a collection, you need to send a valid data in JSON via a PUT request. The data must be sent as the raw body of your request as shown below. The example below shows all the parameters you can send but you are not required to send all (See table for more info).
| Parameter | Description |
|---|---|
| name | (optional) Collection name |
| slug | (optional) Rotator Slug |
| description | (optional) Collection description |
| color | (optional) Collection badge color (HEX) |
| public | (optional) Access (true or false) |
| starred | (optional) Star the collection or not (true or false) |
curl --location --request PUT 'https://linktw.in/api/collection/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Updated Collection",
"description": "Updated collection description",
"color": "#FF5722",
"public": false,
"starred": true
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/collection/:id/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'name' => 'Updated Collection',
'description' => 'Updated collection description',
'color' => '#FF5722',
'public' => false,
'starred' => true,
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://linktw.in/api/collection/:id/update',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Updated Collection",
"description": "Updated collection description",
"color": "#FF5722",
"public": false,
"starred": true
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Collection has been updated successfully."
}
https://linktw.in/api/collection/:id/delete
To delete a collection, you need to send a DELETE request. All items will be unassigned as well.
curl --location --request DELETE 'https://linktw.in/api/collection/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/collection/:id/delete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://linktw.in/api/collection/:id/delete',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Collection has been deleted successfully."
}
Caching: Statistics endpoints use intelligent caching that automatically invalidates when new click data arrives. This means you always get fresh data while minimizing server load. Repeated requests with no new clicks will return cached results instantly.
https://linktw.in/api/statistics/dashboard?period=1m&timezone=America%2FNew_York
Get aggregated statistics for your account, including KPIs (total clicks, unique clicks, top referrer, top country), links created, and performance metrics for the dashboard view. Chart data format varies by period: 1d returns 25 hourly entries with partial hours at start/end, other periods return complete time series with 0 clicks for empty periods. For periods longer than 90 days, data is grouped by month. All date/time values in the response will be adjusted to the specified timezone.
Hard Restrictions: The date range is automatically limited by: (1) Plan retention limit, (2) Account creation date, (3) Oldest link creation date. You cannot query data before any of these limits.
| Parameter | Description |
|---|---|
| period | (optional) Time period: 1d (1 day), 1w (1 week), 1m (1 month), 1y (1 year), or max (all time). Default: 1m |
| timezone | (optional) Timezone for date calculations and display (e.g., "America/New_York", "Europe/London", "Asia/Bangkok"). If not provided, uses the user's default timezone or UTC as fallback. Must be a valid timezone from PHP's timezone database. |
curl --location --request GET 'https://linktw.in/api/statistics/dashboard?period=1m&timezone=America%2FNew_York' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"period": "1w",
"timezone": "Europe\/London"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/statistics/dashboard?period=1m&timezone=America%2FNew_York",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'period' => '1w',
'timezone' => 'Europe/London',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/statistics/dashboard?period=1m&timezone=America%2FNew_York',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"period": "1w",
"timezone": "Europe\/London"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"totalClicks": 15420,
"totalUniqueClicks": 12340,
"topReferrer": "Direct",
"topReferrerClicks": 5234,
"topCountry": "United States",
"topCountryCode": "US",
"topCountryClicks": 4521,
"totalLinks": 156,
"performanceGrowth": 12.5,
"chartData": [
{
"date": "2025-06-14 10:00",
"clicks": 45
},
{
"date": "2025-06-14 11:00",
"clicks": 62
},
{
"date": "2025-06-14 12:00",
"clicks": 89
}
],
"topPerformingLinks": [
{
"id": 123,
"shortUrl": "http:\/\/linktwin.com\/abc123",
"longUrl": "https:\/\/example.com\/my-product-landing-page",
"title": "My Product Landing Page",
"display_title": "Summer Campaign Link",
"clicks": 1250,
"uniqueClicks": 987
}
]
}
}
https://linktw.in/api/statistics/detailed?date_range=30d&collections=%5B1%2C3%5D&timezone=Europe%2FLondon
Get comprehensive statistics including KPIs (total clicks, unique clicks, top referrer, top country), dashboard metrics, plus detailed breakdowns by countries, referrers, browsers, devices, languages, cities, and day trends (hourly/daily click distribution). Breakdown lists return the top 9 items plus an "Other" category aggregating all remaining items (useful for pie charts). This endpoint combines both dashboard data and detailed analytics in a single response. Chart data format varies by period: 1d returns 25 hourly entries with partial hours at start/end, other periods return complete time series with 0 clicks for empty periods. For periods longer than 90 days, data is grouped by month. When using timezone parameter, date boundaries are calculated based on the specified timezone. You can filter results by one or more collections using their IDs or names.
Numbers match the website statistics page: bio page views are not counted as clicks (they are returned separately as bioViews), and referrers are grouped by source (e.g. "Instagram"), with clicks from your bio pages listed as "@alias" (type "bio"). allTimeClicks and allTimeUniqueClicks cover all time, not the date range.
Hard Restrictions: The date range is automatically limited by: (1) Plan retention limit, (2) Account creation date, (3) Oldest link creation date (or oldest link in filtered collections). You cannot query data before any of these limits.
Click filter: the f_ parameters narrow every number to the matching clicks, like the Filter button on the website statistics pages. Several values of one parameter count any of them, several parameters must all match. While filtered, allTimeClicks and allTimeUniqueClicks are null because they cannot be filtered; filters returns the filter used ({} without one). A filtered request that takes too long is answered with HTTP 503 and code filter_timeout: try a shorter date range.
| Parameter | Description |
|---|---|
| date_range | (optional) Date range: 1d (last 24 hours), 7d, 30d or 1y (that many days including today), max, or custom. Default: 30d |
| start_date | (optional) Start date in YYYY-MM-DD or ISO 8601 format (required if date_range is custom) |
| end_date | (optional) End date in YYYY-MM-DD or ISO 8601 format (required if date_range is custom) |
| collection_id | (optional) Filter statistics by a single collection ID (for backward compatibility) |
| collections | (optional) Filter statistics by one or more collection IDs or names. Can be a single value, comma-separated string, or JSON array. Example: [1,2,3] or ["Marketing","Social Media"] |
| timezone | (optional) Timezone for date calculations (e.g., "America/New_York", "Europe/London", "Asia/Bangkok"). If not provided, uses the user's default timezone or UTC as fallback. Must be a valid timezone from PHP's timezone database. |
| f_country[] | (optional) Click filter: only clicks from these countries, values as shown in the dashboard's statistics filter. Repeat the parameter for several values. |
| f_referrer[] | (optional) Click filter: only clicks from these sources, values as shown in the dashboard's statistics filter (for example instagram.com, or direct for clicks without a referrer). |
| f_os[] | (optional) Click filter: only clicks from these operating systems. |
| f_browser[] | (optional) Click filter: only clicks from these browsers. |
| f_language[] | (optional) Click filter: only clicks with these browser languages (for example en). |
curl --location --request GET 'https://linktw.in/api/statistics/detailed?date_range=30d&collections=%5B1%2C3%5D&timezone=Europe%2FLondon' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"date_range": "custom",
"start_date": "2025-01-01",
"end_date": "2025-06-14",
"collections": [
1,
3
],
"timezone": "America\/New_York"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/statistics/detailed?date_range=30d&collections=%5B1%2C3%5D&timezone=Europe%2FLondon",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'date_range' => 'custom',
'start_date' => '2025-01-01',
'end_date' => '2025-06-14',
'collections' =>
array(
0 => 1,
1 => 3,
),
'timezone' => 'America/New_York',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/statistics/detailed?date_range=30d&collections=%5B1%2C3%5D&timezone=Europe%2FLondon',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"date_range": "custom",
"start_date": "2025-01-01",
"end_date": "2025-06-14",
"collections": [
1,
3
],
"timezone": "America\/New_York"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"totalClicks": 15420,
"totalUniqueClicks": 12340,
"topReferrer": "Direct",
"topReferrerClicks": 5234,
"topCountry": "United States",
"topCountryCode": "US",
"topCountryClicks": 4521,
"allTimeClicks": 98210,
"allTimeUniqueClicks": 70412,
"bioViews": 2310,
"totalLinks": 156,
"performanceGrowth": 12.5,
"chartData": [
{
"date": "2025-01-01",
"clicks": 342
},
{
"date": "2025-01-02",
"clicks": 421
},
"\/\/ ... continues for all days in range ..."
],
"topPerformingLinks": [
{
"id": 123,
"shortUrl": "linktwin.com\/abc123",
"longUrl": "https:\/\/example.com\/product-page",
"title": "Product Landing Page",
"display_title": "Q1 Promo Link",
"clicks": 3542,
"uniqueClicks": 2987
},
"\/\/ ... up to 5 top performing links ..."
],
"topCountries": [
{
"country": "United States",
"countryCode": "US",
"count": 5423
},
{
"country": "Canada",
"countryCode": "CA",
"count": 2341
},
"\/\/ ... up to 9 countries ...",
{
"country": "Other",
"countryCode": null,
"count": 1245
}
],
"topReferrers": [
{
"domain": "Direct",
"count": 4521,
"label": "Direct traffic",
"host": null,
"icon": "https:\/\/linktwin.com\/static\/images\/direct.svg",
"type": "direct"
},
{
"domain": "Google",
"count": 3201,
"label": "Google",
"host": "google.com",
"icon": "https:\/\/linktwin.com\/static\/images\/google.svg",
"type": "domain"
},
{
"domain": "@mybio",
"count": 1288,
"label": "@mybio",
"host": null,
"icon": "https:\/\/linktwin.com\/static\/images\/bio-page.svg",
"type": "bio"
},
"\/\/ ... up to 9 referrers ...",
{
"domain": "Other",
"count": 892,
"label": "Other",
"host": null,
"icon": null,
"type": "other"
}
],
"topBrowsers": [
{
"browser": "Chrome",
"count": 8923
},
{
"browser": "Safari",
"count": 3421
},
"\/\/ ... up to 9 browsers ...",
{
"browser": "Other",
"count": 456
}
],
"topDevices": [
{
"os": "Windows 10",
"count": 6234
},
{
"os": "iOS",
"count": 4521
},
"\/\/ ... up to 9 devices ...",
{
"os": "Other",
"count": 321
}
],
"topLanguages": [
{
"language": "English",
"languageCode": "en",
"count": 10234
},
{
"language": "Spanish",
"languageCode": "es",
"count": 2341
},
"\/\/ ... up to 9 languages ...",
{
"language": "Other",
"languageCode": null,
"count": 567
}
],
"topCities": [
{
"city": "New York",
"country": "United States",
"countryCode": "US",
"count": 1523
},
{
"city": "Los Angeles",
"country": "United States",
"countryCode": "US",
"count": 1234
},
"\/\/ ... up to 9 cities ...",
{
"city": "Other",
"country": null,
"countryCode": null,
"count": 789
}
],
"dayTrend": {
"hourlyTrend": [
{
"hour": 0,
"label": "00:00",
"clicks": 45,
"uniqueClicks": 32
},
{
"hour": 1,
"label": "01:00",
"clicks": 23,
"uniqueClicks": 18
},
"\/\/ ... data for all 24 hours ...",
{
"hour": 23,
"label": "23:00",
"clicks": 67,
"uniqueClicks": 51
}
],
"dailyTrend": [
{
"day": 0,
"label": "Sunday",
"clicks": 234,
"uniqueClicks": 189
},
{
"day": 1,
"label": "Monday",
"clicks": 456,
"uniqueClicks": 367
},
"\/\/ ... data for all 7 days ...",
{
"day": 6,
"label": "Saturday",
"clicks": 345,
"uniqueClicks": 278
}
],
"summary": {
"totalClicks": 2456,
"totalUniqueClicks": 1987,
"peakHour": {
"hour": 14,
"label": "14:00",
"clicks": 234,
"uniqueClicks": 189
},
"peakDay": {
"day": 3,
"label": "Wednesday",
"clicks": 567,
"uniqueClicks": 456
},
"timezone": "Europe\/London",
"period": "30d",
"from": "2025-01-01 00:00:00",
"to": "2025-01-31 23:59:59"
}
},
"filters": {
"country": [
"Germany"
],
"referrer": [
"instagram.com"
]
}
}
}
https://linktw.in/api/statistics/link/:id?date_range=30d&timezone=Asia/Bangkok
Get detailed statistics for a specific link, including click data, geographic distribution, referrers, devices, browsers, languages, cities, day trends (hourly/daily click distribution), and recent activity (5 most recent clicks). You can pass either the link ID (e.g., 123) or the full short URL (e.g., https://linktw.in/abc123). Chart data format varies by period: 1d returns 25 hourly entries with partial hours at start/end, other periods return complete time series with 0 clicks for empty periods. For periods longer than 90 days, data is grouped by month. All date/time values in the response will be adjusted to the specified timezone. For free plan users, the response also includes missedClicks (total clicks that exceeded the plan limit).
Hard Restrictions: The date range is automatically limited by: (1) Plan retention limit, (2) Account creation date, (3) Link creation date. You cannot query data before any of these limits.
Click filter: the f_ parameters narrow every number to the matching clicks, like the Filter button on the website statistics pages. Several values of one parameter count any of them, several parameters must all match. While filtered, allTimeClicks and allTimeUniqueClicks are null because they cannot be filtered; filters returns the filter used ({} without one). A filtered request that takes too long is answered with HTTP 503 and code filter_timeout: try a shorter date range.
| Parameter | Description |
|---|---|
| date_range | (required) Date range: 1d (last 24 hours), 7d, 30d or 1y (that many days including today), max, or custom |
| start_date | (optional) Start date in YYYY-MM-DD or ISO 8601 format (required if date_range is custom) |
| end_date | (optional) End date in YYYY-MM-DD or ISO 8601 format (required if date_range is custom) |
| timezone | (optional) Timezone for date calculations and display (e.g., "America/New_York", "Europe/London", "Asia/Bangkok"). If not provided, uses the user's default timezone or UTC as fallback. Must be a valid timezone from PHP's timezone database. |
| f_country[] | (optional) Click filter: only clicks from these countries, values as shown in the dashboard's statistics filter. Repeat the parameter for several values. |
| f_referrer[] | (optional) Click filter: only clicks from these sources, values as shown in the dashboard's statistics filter (for example instagram.com, or direct for clicks without a referrer). |
| f_os[] | (optional) Click filter: only clicks from these operating systems. |
| f_browser[] | (optional) Click filter: only clicks from these browsers. |
| f_language[] | (optional) Click filter: only clicks with these browser languages (for example en). |
curl --location --request GET 'https://linktw.in/api/statistics/link/:id?date_range=30d&timezone=Asia/Bangkok' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"date_range": "1d",
"timezone": "Asia\/Bangkok"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/statistics/link/:id?date_range=30d&timezone=Asia/Bangkok",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'date_range' => '1d',
'timezone' => 'Asia/Bangkok',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/statistics/link/:id?date_range=30d&timezone=Asia/Bangkok',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"date_range": "1d",
"timezone": "Asia\/Bangkok"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"link": {
"id": 180,
"shortUrl": "linktwin.com\/abc123",
"longUrl": "https:\/\/example.com\/product-page",
"title": "Product Landing Page",
"display_title": "Main Product Link",
"absoluteClicks": 5234,
"createdAt": "2024-12-01 10:30:00"
},
"totalClicks": 523,
"totalUniqueClicks": 421,
"topReferrer": "google.com",
"topReferrerClicks": 156,
"topCountry": "United States",
"topCountryCode": "US",
"topCountryClicks": 234,
"performanceGrowth": 15.4,
"missedClicks": 42,
"chartData": [
{
"date": "2025-05-15",
"clicks": 23
},
{
"date": "2025-05-16",
"clicks": 18
},
{
"date": "2025-05-17",
"clicks": 0
},
"\/\/ ... all days in the range included, even with 0 clicks ..."
],
"topCountries": [
{
"country": "United States",
"countryCode": "US",
"count": 234
},
{
"country": "Canada",
"countryCode": "CA",
"count": 89
},
"\/\/ ... up to 9 countries ...",
{
"country": "Other",
"countryCode": null,
"count": 45
}
],
"topReferrers": [
{
"domain": "Google",
"count": 156,
"label": "Google",
"host": "google.com",
"icon": "https:\/\/linktwin.com\/static\/images\/google.svg",
"type": "domain"
},
{
"domain": "@mybio",
"count": 98,
"label": "@mybio",
"host": null,
"icon": "https:\/\/linktwin.com\/static\/images\/bio-page.svg",
"type": "bio"
},
"\/\/ ... up to 9 referrers ...",
{
"domain": "Other",
"count": 32,
"label": "Other",
"host": null,
"icon": null,
"type": "other"
}
],
"topBrowsers": [
{
"browser": "Chrome",
"count": 312
},
{
"browser": "Safari",
"count": 134
},
"\/\/ ... up to 9 browsers ...",
{
"browser": "Other",
"count": 21
}
],
"topDevices": [
{
"os": "iOS",
"count": 234
},
{
"os": "Android",
"count": 189
},
"\/\/ ... up to 9 devices ...",
{
"os": "Other",
"count": 15
}
],
"topLanguages": [
{
"language": "English",
"languageCode": "en",
"count": 423
},
{
"language": "French",
"languageCode": "fr",
"count": 67
},
"\/\/ ... up to 9 languages ...",
{
"language": "Other",
"languageCode": null,
"count": 18
}
],
"topCities": [
{
"city": "New York",
"country": "United States",
"countryCode": "US",
"count": 89
},
{
"city": "London",
"country": "United Kingdom",
"countryCode": "GB",
"count": 67
},
"\/\/ ... up to 9 cities ...",
{
"city": "Other",
"country": null,
"countryCode": null,
"count": 28
}
],
"dayTrend": {
"hourlyTrend": [
{
"hour": 0,
"label": "00:00",
"clicks": 12,
"uniqueClicks": 9
},
{
"hour": 1,
"label": "01:00",
"clicks": 8,
"uniqueClicks": 6
},
"\/\/ ... data for all 24 hours ...",
{
"hour": 23,
"label": "23:00",
"clicks": 15,
"uniqueClicks": 11
}
],
"dailyTrend": [
{
"day": 0,
"label": "Sunday",
"clicks": 67,
"uniqueClicks": 52
},
{
"day": 1,
"label": "Monday",
"clicks": 89,
"uniqueClicks": 71
},
"\/\/ ... data for all 7 days ...",
{
"day": 6,
"label": "Saturday",
"clicks": 78,
"uniqueClicks": 61
}
],
"summary": {
"totalClicks": 523,
"totalUniqueClicks": 421,
"peakHour": {
"hour": 14,
"label": "14:00",
"clicks": 45,
"uniqueClicks": 36
},
"peakDay": {
"day": 2,
"label": "Tuesday",
"clicks": 112,
"uniqueClicks": 89
},
"timezone": "Asia\/Bangkok",
"period": "30d",
"from": "2025-04-15 00:00:00",
"to": "2025-05-15 23:59:59"
}
},
"recentActivity": [
{
"date": "2025-05-15 14:32:18",
"country": "United States",
"countryCode": "US",
"city": "New York",
"os": "iOS",
"browser": "Safari",
"referrer": "https:\/\/facebook.com\/post\/123",
"referrerDomain": "facebook.com",
"language": "English",
"languageCode": "en",
"missedClick": false
},
{
"date": "2025-05-15 13:21:05",
"country": "Germany",
"countryCode": "DE",
"city": "Berlin",
"os": "Windows",
"browser": "Chrome",
"referrer": null,
"referrerDomain": null,
"language": "German",
"languageCode": "de",
"missedClick": false
},
"\/\/ ... up to 5 recent clicks ..."
]
}
}
https://linktw.in/api/statistics/daytrend?timezone=America%2FNew_York
Get hourly and daily click distribution to identify peak activity times. This endpoint shows when users are most active throughout the day (by hour) and week (by day of week), helping you optimize your content scheduling and marketing campaigns. Returns click data for each hour (0-23) and each day of the week (Sunday-Saturday).
Hard Restrictions: The date range is automatically limited by: (1) Plan retention limit, (2) Account creation date, (3) Oldest link creation date. You cannot query data before any of these limits.
| Parameter | Description |
|---|---|
| period | (optional) Time period for statistics. Options: "1d" (24 hours), "7d" or "1w" (7 days), "30d" or "1m" (30 days, default), "1y" (365 days), "max" (all time), "custom" (requires start_date and end_date) |
| start_date | (optional) Start date for custom period (Y-m-d format, e.g., "2025-01-01"). Required when period is "custom" |
| end_date | (optional) End date for custom period (Y-m-d format, e.g., "2025-01-31"). Required when period is "custom" |
| timezone | (optional) Timezone for hour calculations (e.g., "America/New_York", "Europe/London", "Asia/Bangkok"). If not provided, uses the user's default timezone or UTC as fallback. Must be a valid timezone from PHP's timezone database. |
| collection_id | (optional) Filter statistics by a single collection ID (for backward compatibility) |
| collections | (optional) Filter statistics by one or more collection IDs or names. Can be a single value, comma-separated string, or JSON array. Example: [1,2,3] or ["Marketing","Social Media"] |
curl --location --request GET 'https://linktw.in/api/statistics/daytrend?timezone=America%2FNew_York' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"period": "30d",
"timezone": "Europe\/Berlin",
"collections": [
"Marketing",
"Social Media"
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/statistics/daytrend?timezone=America%2FNew_York",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'period' => '30d',
'timezone' => 'Europe/Berlin',
'collections' =>
array(
0 => 'Marketing',
1 => 'Social Media',
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/statistics/daytrend?timezone=America%2FNew_York',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"period": "30d",
"timezone": "Europe\/Berlin",
"collections": [
"Marketing",
"Social Media"
]
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"hourlyTrend": [
{
"hour": 0,
"label": "00:00",
"clicks": 145,
"uniqueClicks": 98
},
{
"hour": 1,
"label": "01:00",
"clicks": 87,
"uniqueClicks": 54
},
"\/\/ ... data for all 24 hours ...",
{
"hour": 23,
"label": "23:00",
"clicks": 234,
"uniqueClicks": 156
}
],
"dailyTrend": [
{
"day": 0,
"label": "Sunday",
"clicks": 1234,
"uniqueClicks": 890
},
{
"day": 1,
"label": "Monday",
"clicks": 1567,
"uniqueClicks": 1123
},
"\/\/ ... data for all 7 days ...",
{
"day": 6,
"label": "Saturday",
"clicks": 1345,
"uniqueClicks": 967
}
],
"summary": {
"totalClicks": 12043,
"totalUniqueClicks": 8765,
"peakHour": {
"hour": 15,
"label": "15:00",
"clicks": 1043,
"uniqueClicks": 789
},
"peakDay": {
"day": 3,
"label": "Wednesday",
"clicks": 2156,
"uniqueClicks": 1567
},
"timezone": "Europe\/Berlin",
"period": "30d",
"from": "2025-01-01 00:00:00",
"to": "2025-01-31 23:59:59"
}
}
}
Get events the moment they happen: LinkTwin sends a signed POST request with JSON to your address for each event you subscribe to. Subscribe and unsubscribe with these endpoints (REST hooks, as Zapier and Make do), or on the Webhooks page of your dashboard.
Every request carries the headers X-LinkTwin-Event, X-LinkTwin-Delivery and X-LinkTwin-Signature (t=timestamp,v1=signature, an HMAC-SHA256 of the timestamp, a dot and the raw body, keyed with the signing secret). Drop duplicates by the event id. Failed deliveries are tried again for up to a day; a webhook that keeps failing is turned off.
API keys: you can make several keys on the same page, each with Full access or Read only. A read-only key answers 403 to every request other than GET. Your original key keeps working as the Default key.
https://linktw.in/api/webhooks
List the webhooks of your account. Signing secrets are never listed.
curl --location --request GET 'https://linktw.in/api/webhooks' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/webhooks',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"result": 1,
"limit": 25,
"webhooks": [
{
"id": 5,
"name": "Zapier",
"url": "https:\/\/hooks.zapier.com\/hooks\/standard\/123\/abc",
"events": [
"link.clicked"
],
"filters": {
"collection_ids": [
7
]
},
"status": "active",
"source": "api",
"failures": 0,
"disabled_reason": null,
"disabled_at": null,
"last_delivery_at": "2026-11-12T10:15:02+00:00",
"last_status": 200,
"created_at": "2026-11-12T09:00:00+00:00"
}
]
}
}
https://linktw.in/api/webhooks
Create a webhook. The answer carries its signing secret once: keep it to check the X-LinkTwin-Signature header.
| Parameter | Description |
|---|---|
| url | (required) The https address that receives the events |
| events | (required) A list of events, for example ["link.clicked"]. See List Events. |
| name | (optional) A name to tell your webhooks apart |
| filters | (optional) {"link_ids": [...], "collection_ids": [...]}: only these links, or links in these collections |
curl --location --request POST 'https://linktw.in/api/webhooks' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https:\/\/example.com\/linktwin-hook",
"events": [
"link.created",
"link.clicked"
],
"name": "My server",
"filters": {
"collection_ids": [
7
]
}
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'url' => 'https://example.com/linktwin-hook',
'events' =>
array(
0 => 'link.created',
1 => 'link.clicked',
),
'name' => 'My server',
'filters' =>
array(
'collection_ids' =>
array(
0 => 7,
),
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/webhooks',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"url": "https:\/\/example.com\/linktwin-hook",
"events": [
"link.created",
"link.clicked"
],
"name": "My server",
"filters": {
"collection_ids": [
7
]
}
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"id": 6,
"name": "My server",
"url": "https:\/\/example.com\/linktwin-hook",
"events": [
"link.created",
"link.clicked"
],
"filters": {
"collection_ids": [
7
]
},
"status": "active",
"source": "api",
"created_at": "2026-11-12T09:00:00+00:00",
"secret": "whsec_3f9a..."
}
}
https://linktw.in/api/webhooks/:id
Get one webhook.
curl --location --request GET 'https://linktw.in/api/webhooks/:id' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/webhooks/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/webhooks/:id',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
null
https://linktw.in/api/webhooks/:id
Delete a webhook (unsubscribe). Its delivery log is deleted too.
curl --location --request DELETE 'https://linktw.in/api/webhooks/:id' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/webhooks/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://linktw.in/api/webhooks/:id',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Webhook deleted."
}
https://linktw.in/api/webhooks/:id/test
Send a sample of the webhook's first event to its address now, marked "test": true, and get the status code and the response time.
curl --location --request POST 'https://linktw.in/api/webhooks/:id/test' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/webhooks/:id/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/webhooks/:id/test',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"delivered": true,
"status": 200,
"duration_ms": 182
},
"message": "HTTP 200 in 182 ms"
}
https://linktw.in/api/webhooks/events
Every event you can subscribe to, with a sample of its data: link.created, link.clicked (QR code scans have "qr": true) and email.captured (emails left on bio pages).
curl --location --request GET 'https://linktw.in/api/webhooks/events' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/webhooks/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/webhooks/events',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"events": [
{
"event": "link.clicked",
"name": "New click",
"description": "Someone clicks a link or scans a QR code.",
"sample": {
"link_id": 123,
"alias": "spring-sale",
"short_url": "https:\/\/linktw.in\/spring-sale",
"url": "https:\/\/example.com\/spring-sale",
"collections": [
7
],
"country": "United States",
"city": "Austin",
"device": "iOS",
"browser": "Safari",
"referrer": "https:\/\/www.instagram.com\/",
"language": "en",
"qr": false,
"qr_id": null,
"bio_id": null,
"clicked_at": "2026-11-12T10:15:00+00:00"
}
}
]
}
}
https://linktw.in/api/webhooks/events/link.clicked/recent
The latest events of one kind, newest first, exactly as they were sent. Before anything has happened you get one sample built from your latest link, or an example ("sample": true). Zapier and Make show these as sample data.
| Parameter | Description |
|---|---|
| :event | (required) The event, for example link.clicked |
| limit | (optional) How many, from 1 to 25 (default 3) |
curl --location --request GET 'https://linktw.in/api/webhooks/events/link.clicked/recent' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/webhooks/events/link.clicked/recent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/webhooks/events/link.clicked/recent',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"event": "link.clicked",
"sample": false,
"events": [
{
"id": "evt_9812",
"event": "link.clicked",
"created_at": "2026-11-12T10:15:00+00:00",
"account_id": 42,
"test": false,
"data": {
"link_id": 123,
"short_url": "https:\/\/linktw.in\/spring-sale",
"country": "United States",
"device": "iOS"
}
}
]
}
}