Une clé API est requise pour que les requêtes soient traitées par le système. Une fois qu'un utilisateur s'inscrit, une clé API est automatiquement générée pour cet utilisateur. La clé API doit être envoyée avec chaque requête (voir l'exemple complet ci-dessous). Si la clé API n'est pas envoyée ou a expiré, une erreur sera renvoyée. Veillez à garder votre clé API secrète pour éviter les abus.
Pour vous authentifier auprès du système API, vous devez envoyer votre clé API en tant que jeton d'autorisation avec chaque requête. Vous pouvez voir un exemple de code ci-dessous.
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);
});
Notre API dispose d'un limiteur de débit pour se protéger contre les pics de requêtes et maximiser sa stabilité. Notre limiteur de débit est actuellement plafonné à 120 requêtes par 1 minute.
Plusieurs en-têtes seront envoyés avec la réponse et peuvent être examinés pour déterminer diverses informations sur la requête.
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 119
X-RateLimit-Reset: TIMESTAMP
Toutes les réponses de l'API sont renvoyées au format JSON par défaut. Pour convertir ces données en données exploitables, la fonction appropriée doit être utilisée selon le langage. En PHP, la fonction json_decode() peut être utilisée pour convertir les données en objet (par défaut) ou en tableau (en définissant le deuxième paramètre sur true). Il est très important de vérifier la clé d'erreur car elle indique s'il y a eu une erreur ou non. Vous pouvez également vérifier le code d'en-tête.
{
"error": 1,
"message": "An error occurred"
}
Tous les champs de date et heure dans les réponses de l'API sont renvoyés dans le fuseau horaire configuré de votre compte. Vous pouvez définir votre fuseau horaire dans les paramètres de votre compte. Si aucun fuseau horaire n'est configuré, les dates sont par défaut en UTC.
Vous pouvez également remplacer le fuseau horaire de votre compte par requête en ajoutant un ?timezone= paramètre de requête pour la plupart des points d'accès (par ex., ?timezone=America/New_York).
Les champs de date sont formatés en YYYY-MM-DD HH:MM:SS (ex. 2024-01-15 14:30:00).
Le point de terminaison Compte retourne timezone_offset qui est le décalage UTC actuel en minutes pour votre fuseau horaire configuré. Cela tient compte de l'heure d'été et peut être utilisé pour convertir des dates vers d'autres fuseaux horaires. Par exemple, -300 signifie UTC-5 (heure normale de l'Est), 60 signifie UTC+1 (heure d'Europe centrale).
{
"settings": {
"timezone": "America/New_York",
"timezone_offset": -300
},
"date": "2024-01-15 14:30:00"
}
Le champ location du tableau geotarget doit utiliser le nom complet exact du pays, tel qu'indiqué ci-dessous. Les noms de pays sont sensibles à la casse. Cliquez sur un pays pour voir ses états/régions disponibles pour le champ facultatif state.
| Code | Nom du pays (à utiliser dans 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, upgrade_required (free plan, destination not on the approved list: upgrade to switch it on), needs_domain (switched off for adult, gambling or high-risk content, or a restricted destination, on a shared domain: it works on your own domain, see restriction and Move a Link to Your Domain), verify_email (the account has not confirmed its email yet: visitors see a "confirm your email" page instead of the destination) or disabled. statuses lists every reason the link is not live, in the order to fix them, since an unconfirmed email stacks with the link's own state (e.g. ["verify_email", "upgrade_required"]; a live link has ["active"]). restriction is null unless the status is needs_domain: reason (adult, gambling, high_risk, restricted_domain), offer (move: you have a branded domain, add: your plan includes branded domains, upgrade: it does not) and domains (your branded domains). type is the redirect mode as stored (direct, frame, splash, overlay-…), null when not set.
| Paramètre | Description |
|---|---|
| limit | (optionnel) Nombre de résultats par page |
| page | (optionnel) Page actuelle demandée |
| order | (optionnel) Trier les données : date, date_desc, date_asc, clicks_desc, clicks_asc, name_asc, name_desc |
| search | (optionnel) Rechercher des liens par alias, alias personnalisé, URL, méta-titre, titre personnalisé ou description. Prend en charge l'expansion des alias de domaine (ex. : "youtube" correspond à youtube.com et youtu.be) |
| date_from | (optionnel) Filtrer par date de début (format Y-m-d ou ISO 8601, ex. : 2025-01-01 ou 2025-01-01T00:00:00.000Z) |
| date_to | (optionnel) Filtrer par date de fin (format Y-m-d ou ISO 8601, ex. : 2025-01-31 ou 2025-01-31T23:59:59.999Z) |
| collections | (optionnel) Tableau d'identifiants ou de noms de collections pour filtrer les liens. Utilisez soit uniquement des identifiants, soit uniquement des noms, pas un mélange. Exemple : [1,2,3] ou ["Marketing","Social Media"] |
| tags | (facultatif) Noms ou ID de tags pour filtrer les liens, séparés par des virgules ou sous forme de tableau. Exemple : promo,summer ou [4,7] |
| tags_mode | (facultatif) any (par défaut) : liens avec au moins un des tags. all : liens avec tous les tags. |
| timezone | (optionnel) Fuseau horaire pour les champs de date dans la réponse (ex. : America/New_York, Europe/London). Remplace le paramètre de fuseau horaire du compte. Par défaut UTC si non spécifié. |
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,
"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": {
"reason": "adult",
"offer": "move",
"domains": [
"https:\/\/go.example.com"
]
},
"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, upgrade_required (free plan, destination not on the approved list: upgrade to switch it on), needs_domain (switched off for adult, gambling or high-risk content, or a restricted destination, on a shared domain: it works on your own domain, see restriction and Move a Link to Your Domain), verify_email (the account has not confirmed its email yet: visitors see a "confirm your email" page instead of the destination) or disabled. restriction is null unless the status is needs_domain: reason (adult, gambling, high_risk, restricted_domain), offer (move: you have a branded domain, add: your plan includes branded domains, upgrade: it does not) and domains (your branded domains).
| Paramètre | Description |
|---|---|
| :id | (requis) L'identifiant du lien (ex. : 123) ou l'URL courte complète (ex. : https://linktw.in/abc123) |
| timezone | (optionnel) Fuseau horaire pour les champs de date dans la réponse (ex. : America/New_York, Europe/London). Remplace le paramètre de fuseau horaire du compte. Par défaut UTC si non spécifié. |
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,
"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.
| Paramètre | Description |
|---|---|
| url | (requis) URL longue à raccourcir. |
| custom | (optionnel) Alias personnalisé à la place d'un alias aléatoire. |
| password | (optionnel) Protection par mot de passe |
| domain | (optionnel) Domaine personnalisé (doit correspondre à un domaine de marque déjà ajouté) |
| expiry | (optionnel) Expiration du lien, exemple : 2024-09-28 23:11:16 |
| clicklimit | (optionnel) Nombre maximum de clics avant l'expiration du lien (entier) |
| expirationredirect | (optionnel) URL vers laquelle rediriger après l'expiration du lien (par date ou limite de clics) |
| note | (optionnel) Note/description interne pour ce lien (non visible par les visiteurs) |
| display_title | (optionnel) Titre personnalisé pour organiser ce lien dans votre tableau de bord. Il est uniquement à titre de référence et n'affecte pas og:title ni l'aperçu du lien. |
| geotarget | (optionnel) Données de ciblage géographique. Tableau d'objets avec les champs location, link et state optionnel. Le champ location doit être un nom de pays complet (ex. : "United States", "Canada"). Le champ state optionnel permet de cibler un état/région spécifique dans le pays (ex. : "California"). Voir la liste complète des pays et états. |
| devicetarget | (optionnel) Données de ciblage par appareil. Tableau d'objets avec les champs device et link. |
| languagetarget | (optionnel) Données de ciblage par langue. Tableau d'objets avec les champs language et link. |
| 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 | (optionnel) Variantes de test A/B. Tableau d'objets avec les champs link et percent optionnel. |
| parameters | (optionnel) Paramètres URL à ajouter. Tableau d'objets avec les champs name et value. |
| metatitle | (optionnel) Méta-titre |
| metadescription | (optionnel) Méta-description |
| metaimage | (optionnel) Image d'aperçu pour le partage sur les réseaux sociaux (og:image). Deux formats sont acceptés : (1) JSON : fournissez une URL publique se terminant par .jpg, .jpeg ou .png, par ex. "metaimage": "https://example.com/image.jpg" ; (2) Téléversement de fichier : envoyez la requête en multipart/form-data et incluez le fichier image dans un champ nommé metaimage. Les deux formats exigent du JPG/JPEG ou du PNG, 1 Mo maximum. |
| 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 | (optionnel) Tableau d'identifiants ou de noms de pixels à associer au lien. Utilisez soit uniquement des identifiants, soit uniquement des noms, pas un mélange. |
| collections | (optionnel) Tableau d'identifiants ou de noms de collections auxquelles ajouter le lien. Utilisez soit uniquement des identifiants, soit uniquement des noms, pas un mélange. |
| tags | (facultatif) Tags du lien : un tableau ou une chaîne séparée par des virgules de noms ou d'ID de tags. Un nouveau nom devient un tag de l'espace de travail. |
| 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 | (optionnel, nécessite bridge_override=1) 1 pour afficher la page de transition (« Appuyer pour continuer »), 0 pour la masquer et rediriger rapidement. |
| bridge_auto_redirect | (optionnel, nécessite bridge_override=1) 1 pour rediriger automatiquement après un délai, 0 pour que le visiteur doive appuyer pour continuer. |
| bridge_redirect_delay | (optionnel, nécessite bridge_override=1) Délai de redirection automatique en secondes (1-30). |
| escape_inapp_browser | (optionnel, nécessite bridge_override=1) Lorsque l'application de destination n'est pas installée : 1 pour quitter les navigateurs intégrés (Facebook/Instagram/TikTok) et ouvrir dans le navigateur externe, 0 pour rester dans le navigateur intégré. |
| 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.
Les exemples générés ci-dessous utilisent PUT + JSON. Pour téléverser directement un fichier, remplacez la méthode par POST, supprimez l'en-tête Content-Type JSON et utilisez multipart/form-data (par exemple : -F "[email protected]").
| Paramètre | Description |
|---|---|
| url | (optionnel) URL longue vers laquelle mettre à jour |
| custom | (optionnel) Alias personnalisé |
| password | (optionnel) Protection par mot de passe. Envoyez null pour supprimer. |
| domain | (optionnel) Domaine personnalisé (doit correspondre à un domaine de marque déjà ajouté) |
| expiry | (optionnel) Expiration du lien (ex. : 2024-09-28 23:11:16). Envoyez null pour supprimer. |
| clicklimit | (optionnel) Nombre maximum de clics avant l'expiration du lien. Envoyez null pour supprimer. |
| expirationredirect | (optionnel) URL vers laquelle rediriger après l'expiration du lien. Envoyez null pour supprimer. |
| note | (optionnel) Note/description interne. Envoyez null pour supprimer. |
| display_title | (optionnel) Titre personnalisé pour l'organisation du tableau de bord. Envoyez null pour supprimer. |
| geotarget | (optionnel) Données de ciblage géographique (remplacement complet). Tableau d'objets avec les champs location, link et state optionnel. Envoyez [] pour tout effacer. Le champ location doit être un nom de pays complet (ex. : "United States", "Canada"). Le champ state optionnel permet de cibler un état/région spécifique dans le pays (ex. : "California"). Voir la liste complète des pays et états. |
| devicetarget | (optionnel) Données de ciblage par appareil (remplacement complet). Tableau d'objets avec les champs device et link. Envoyez [] pour tout effacer. |
| languagetarget | (optionnel) Données de ciblage par langue (remplacement complet). Tableau d'objets avec les champs language et link. Envoyez [] pour tout effacer. |
| 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 | (optionnel) Variantes de test A/B (remplacement complet). Tableau d'objets avec les champs link et percent optionnel. Envoyez [] pour tout effacer. |
| parameters | (optionnel) Paramètres URL (remplacement complet). Tableau d'objets avec les champs name et value. Envoyez [] pour tout effacer. |
| metatitle | (optionnel) Méta-titre. Envoyez null pour supprimer. |
| metadescription | (optionnel) Méta-description. Envoyez null pour supprimer. |
| 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 | (optionnel) Tableau d'identifiants ou de noms de pixels (remplacement complet). Envoyez [] pour supprimer tous les pixels. |
| collections | (optionnel) Tableau d'identifiants ou de noms de collections (remplacement complet). Envoyez [] pour retirer de toutes les collections. |
| tags | (facultatif) Noms ou ID de tags (remplacement complet). Un nouveau nom devient un tag de l'espace de travail. Envoyez [] pour retirer tous les 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
Pour supprimer un lien, vous devez envoyer une requête DELETE. Vous pouvez utiliser soit DELETE /api/url/:id/delete (pour les identifiants numériques) soit DELETE /api/url/delete/:id (pour les identifiants numériques et les URL courtes complètes comme 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.
| Paramètre | 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.
| Paramètre | 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
Supprimer plusieurs liens en une seule requête. Envoyez un tableau d'identifiants de liens à supprimer.
| Paramètre | Description |
|---|---|
| ids | (requis) Tableau d'identifiants de liens à supprimer |
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
Voyez ce qu'une modification ferait sur jusqu'à 500 liens, sans rien changer : combien changent, quelques exemples avant et après, et les liens qui ne peuvent pas changer. Envoyez le même corps à Appliquer une modification groupée.
| Paramètre | Description |
|---|---|
| ids | (obligatoire) Tableau d'identifiants de liens, 500 au maximum |
| op | (obligatoire) Ce qu'il faut changer : destination, replace, utm, domain, expiry, clicklimit, pixels_add, pixels_remove, collection_add, collection_remove, tags_add ou tags_remove |
| url | (destination) La nouvelle URL de destination |
| find | (replace) Le texte à chercher dans les destinations, replace le texte à mettre à sa place, match_case true pour respecter les majuscules |
| utm_source | (utm) utm_source, utm_medium, utm_campaign, utm_term et utm_content, avec utm_mode add (garde les valeurs déjà présentes) ou replace |
| domain | (domain) Un de vos domaines |
| expiry | (expiry) Date et heure dans votre fuseau horaire, par exemple 2026-12-31 23:59. Vide retire l'expiration. |
| clicklimit | (clicklimit) Un nombre de clics. 0 retire la limite. |
| pixels | (pixels_add, pixels_remove) Tableau d'identifiants de pixels |
| collection | (collection_add, collection_remove) Un identifiant de collection |
| tags | (tags_add, tags_remove) Noms ou identifiants de tags. tags_add transforme les nouveaux noms en 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
Applique une modification à un lot de liens : au maximum chunk liens par appel (selon l'aperçu : 4 pour destination, replace et utm, 25 pour domain, expiry, limite de clics et pixels, 100 pour le reste). Le premier appel renvoie un edit_id : envoyez-le avec chaque lot suivant de la même modification, ainsi une seule annulation les rétablit tous.
| Paramètre | Description |
|---|---|
| ids | (obligatoire) Les identifiants de liens de ce lot |
| op | (obligatoire) La modification, avec ses champs, comme pour Aperçu d'une modification groupée |
| edit_id | (facultatif) L'edit_id du premier lot, pour chaque lot suivant |
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
Rétablit les liens de la dernière modification groupée, dans les 24 heures, 25 liens par appel : rappelez tant que remaining est supérieur à 0. Un lien modifié depuis garde ses valeurs plus récentes.
| Paramètre | Description |
|---|---|
| edit_id | (facultatif) L'edit_id à annuler. Par défaut : la dernière modification. |
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
La modification groupée qui peut encore être annulée, ou 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
Liste les tags de vos liens, avec le nombre de liens qui portent chacun, et les couleurs qu'un tag peut avoir. Filtrez les liens par tag avec le paramètre tags de Lister les liens.
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
Crée un tag. Si un tag du même nom existe, vous recevez ce tag.
| Paramètre | Description |
|---|---|
| name | (obligatoire) Le nom du tag, 40 caractères au maximum |
| color | (facultatif) Une des couleurs de Lister les tags. Par défaut : la couleur la moins utilisée par vos tags. |
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
Renommez un tag ou changez sa couleur. Chaque lien qui le porte affiche le changement.
| Paramètre | Description |
|---|---|
| name | (facultatif) Le nouveau nom |
| color | (facultatif) Une des couleurs de Lister les 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
Supprime un tag. Il est retiré de chaque lien ; les liens restent.
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
Obtenir tous les domaines disponibles pour le raccourcissement des liens. Cela inclut les domaines standard (fournis par la plateforme) et vos domaines de marque (personnalisés). Utilisez le champ isStandard pour les distinguer.
| Paramètre | Description |
|---|---|
| limit | (optionnel) Nombre de résultats par page pour les domaines de marque |
| page | (optionnel) Page actuelle demandée pour les domaines de marque |
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
Un domaine peut être ajouté via cet endpoint. Veuillez vous assurer que le domaine pointe correctement vers notre serveur.
| Paramètre | Description |
|---|---|
| domain | (requis) Domaine de marque incluant http ou https |
| redirectroot | (optionnel) Redirection racine quand quelqu'un visite votre domaine |
| redirect404 | (optionnel) Redirection 404 personnalisée |
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
Pour mettre à jour un domaine de marque, vous devez envoyer des données valides en JSON via une requête PUT. Les données doivent être envoyées dans le corps brut de votre requête comme indiqué ci-dessous. L'exemple ci-dessous montre tous les paramètres que vous pouvez envoyer, mais vous n'êtes pas obligé de tous les envoyer (voir le tableau pour plus d'informations).
| Paramètre | Description |
|---|---|
| redirectroot | (optionnel) Redirection racine quand quelqu'un visite votre domaine |
| redirect404 | (optionnel) Redirection 404 personnalisée |
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
Pour supprimer un domaine, vous devez envoyer une requête DELETE.
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
Pour obtenir vos codes de pixels via l'API, vous pouvez utiliser cet endpoint. Vous pouvez également filtrer les données (voir le tableau pour plus d'informations).
| Paramètre | Description |
|---|---|
| limit | (optionnel) Nombre de résultats par page |
| page | (optionnel) Page actuelle demandée |
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
Un pixel peut être créé via cet endpoint. Vous devez envoyer le type de pixel et le tag.
| Paramètre | Description |
|---|---|
| type | (required) gtmpixel | gapixel | fbpixel | adwordspixel | linkedinpixel | twitterpixel | adrollpixel | quorapixel | pinterest | bing | snapchat | reddit | tiktok |
| name | (requis) Nom personnalisé pour votre pixel |
| tag | (requis) Le tag du pixel |
| event | (optionnel, Facebook uniquement) Événement standard à déclencher en plus de PageView à chaque clic sur le lien. Valeurs possibles : Lead, CompleteRegistration, ViewContent, Search, AddToCart, AddToWishlist, InitiateCheckout, AddPaymentInfo, Purchase, Subscribe, StartTrial, Contact, Schedule, SubmitApplication, Donate. Par défaut : PageView uniquement. |
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
Pour mettre à jour un pixel, vous devez envoyer des données valides en JSON via une requête PUT. Les données doivent être envoyées dans le corps brut de votre requête comme indiqué ci-dessous. L'exemple ci-dessous montre tous les paramètres que vous pouvez envoyer, mais vous n'êtes pas obligé de tous les envoyer (voir le tableau pour plus d'informations).
| Paramètre | Description |
|---|---|
| name | (optionnel) Nom personnalisé pour votre pixel |
| tag | (requis) Le tag du pixel |
| event | (optionnel, Facebook uniquement) Événement standard à déclencher en plus de PageView. Envoyez PageView (ou omettez le champ) pour PageView uniquement. Consultez « Créer un pixel » pour la liste complète des valeurs autorisées. |
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
Pour supprimer un pixel, vous devez envoyer une requête DELETE.
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
Pour obtenir un pixel unique avec ses liens associés via l'API, vous pouvez utiliser cet endpoint. Retourne les détails du pixel et une liste paginée des liens auxquels ce pixel est assigné.
| Paramètre | Description |
|---|---|
| :id | (requis) Identifiant du pixel |
| limit | (optionnel) Nombre de résultats par page |
| page | (optionnel) Page actuelle demandée |
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
Ajouter ou supprimer plusieurs liens d'un pixel en une seule requête. Envoyez un tableau d'identifiants de liens à ajouter et/ou supprimer.
| Paramètre | Description |
|---|---|
| :id | (requis) Identifiant du pixel |
| add | (optionnel) Tableau d'identifiants de liens auxquels ajouter ce pixel |
| remove | (optionnel) Tableau d'identifiants de liens desquels retirer ce pixel |
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
Pour obtenir vos codes QR via l'API, vous pouvez utiliser cet endpoint. Vous pouvez également filtrer les données (voir le tableau pour plus d'informations).
| Paramètre | Description |
|---|---|
| limit | (optionnel) Nombre de résultats par page |
| page | (optionnel) Page actuelle demandée |
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
Pour obtenir les détails d'un code QR unique via l'API, vous pouvez utiliser cet 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
Pour créer un code QR, vous devez envoyer des données valides en JSON via une requête POST. Les données doivent être envoyées dans le corps brut de votre requête comme indiqué ci-dessous. L'exemple ci-dessous montre tous les paramètres que vous pouvez envoyer, mais vous n'êtes pas obligé de tous les envoyer (voir le tableau pour plus d'informations).
| Paramètre | Description |
|---|---|
| type | (requis) text | vcard | link | email | phone | sms | wifi |
| data | (requis) Données à intégrer dans le code QR. Les données peuvent être une chaîne de caractères ou un tableau selon le type |
| background | (optionnel) Couleur RGB, ex. : rgb(255,255,255) |
| foreground | (optionnel) Couleur RGB, ex. : rgb(0,0,0) |
| logo | (optionnel) Chemin vers le logo en format png ou 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
Pour mettre à jour un code QR, vous devez envoyer des données valides en JSON via une requête PUT. Les données doivent être envoyées dans le corps brut de votre requête comme indiqué ci-dessous. L'exemple ci-dessous montre tous les paramètres que vous pouvez envoyer, mais vous n'êtes pas obligé de tous les envoyer (voir le tableau pour plus d'informations).
| Paramètre | Description |
|---|---|
| data | (requis) Données à intégrer dans le code QR. Les données peuvent être une chaîne de caractères ou un tableau selon le type |
| background | (optionnel) Couleur RGB, ex. : rgb(255,255,255) |
| foreground | (optionnel) Couleur RGB, ex. : rgb(0,0,0) |
| logo | (optionnel) Chemin vers le logo en format png ou 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
Pour supprimer un code QR, vous devez envoyer une requête DELETE.
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
Pour obtenir vos collections via l'API, vous pouvez utiliser cet endpoint. Vous pouvez également filtrer les données (voir le tableau pour plus d'informations).
| Paramètre | Description |
|---|---|
| limit | (optionnel) Nombre de résultats par page |
| page | (optionnel) Page actuelle demandée |
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
Pour obtenir les éléments d'une collection sélectionnée via l'API, vous pouvez utiliser cet endpoint. Vous pouvez également filtrer les données (voir le tableau pour plus d'informations).
| Paramètre | Description |
|---|---|
| limit | (optionnel) Nombre de résultats par page |
| page | (optionnel) Page actuelle demandée |
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
Une collection peut être ajoutée via cet endpoint.
| Paramètre | Description |
|---|---|
| name | (requis) Nom de la collection |
| slug | (optionnel) Slug du rotateur |
| description | (optionnel) Description de la collection |
| color | (optionnel) Couleur du badge de la collection (HEX) |
| public | (optionnel) Accès (true ou false) |
| starred | (optionnel) Mettre la collection en favori ou non (true ou 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
Un lien peut être assigné à n'importe quelle collection en envoyant une requête avec l'identifiant de la collection et l'identifiant du lien.
| Paramètre | Description |
|---|---|
| :collectionid | (requis) Identifiant de la collection |
| :itemid | (requis) Identifiant du lien |
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
Ajouter ou supprimer plusieurs liens d'une collection en une seule requête. Envoyez un tableau d'identifiants de liens à ajouter et/ou supprimer.
| Paramètre | Description |
|---|---|
| :id | (requis) Identifiant de la collection |
| add | (optionnel) Tableau d'identifiants de liens à ajouter à la collection |
| remove | (optionnel) Tableau d'identifiants de liens à retirer de la 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
Pour mettre à jour une collection, vous devez envoyer des données valides en JSON via une requête PUT. Les données doivent être envoyées dans le corps brut de votre requête comme indiqué ci-dessous. L'exemple ci-dessous montre tous les paramètres que vous pouvez envoyer, mais vous n'êtes pas obligé de tous les envoyer (voir le tableau pour plus d'informations).
| Paramètre | Description |
|---|---|
| name | (optionnel) Nom de la collection |
| slug | (optionnel) Slug du rotateur |
| description | (optionnel) Description de la collection |
| color | (optionnel) Couleur du badge de la collection (HEX) |
| public | (optionnel) Accès (true ou false) |
| starred | (optionnel) Mettre la collection en favori ou non (true ou 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
Pour supprimer une collection, vous devez envoyer une requête DELETE. Tous les éléments seront également désassignés.
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."
}
Mise en cache : Les endpoints de statistiques utilisent une mise en cache intelligente qui s'invalide automatiquement à l'arrivée de nouvelles données de clics. Cela garantit des données toujours à jour tout en minimisant la charge serveur. Les requêtes répétées sans nouveaux clics retourneront instantanément des résultats en cache.
https://linktw.in/api/statistics/dashboard?period=1m&timezone=America%2FNew_York
Obtenir des statistiques agrégées pour votre compte, incluant les KPI (total de clics, clics uniques, principal référent, principal pays), les liens créés et les métriques de performance pour la vue du tableau de bord. Le format des données de graphique varie selon la période : 1d retourne 25 entrées horaires avec des heures partielles au début/fin, les autres périodes retournent des séries temporelles complètes avec 0 clic pour les périodes vides. Pour les périodes supérieures à 90 jours, les données sont regroupées par mois. Toutes les valeurs de date/heure dans la réponse seront ajustées au fuseau horaire spécifié.
Restrictions strictes : La plage de dates est automatiquement limitée par : (1) La limite de rétention du forfait, (2) La date de création du compte, (3) La date de création du lien le plus ancien. Vous ne pouvez pas interroger des données antérieures à ces limites.
| Paramètre | Description |
|---|---|
| period | (optionnel) Période : 1d (1 jour), 1w (1 semaine), 1m (1 mois), 1y (1 an) ou max (tout le temps). Par défaut : 1m |
| timezone | (optionnel) Fuseau horaire pour le calcul et l'affichage des dates (par ex. "America/New_York", "Europe/London", "Asia/Bangkok"). S'il n'est pas fourni, le fuseau horaire par défaut de l'utilisateur est utilisé, ou UTC à défaut. Doit être un fuseau horaire valide de la base de données des fuseaux horaires de PHP. |
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.
Filtre de clics : les paramètres f_ limitent chaque chiffre aux clics correspondants, comme le bouton Filtre des pages de statistiques du site. Plusieurs valeurs d'un paramètre comptent chacune d'elles, plusieurs paramètres doivent tous correspondre. Tant qu'un filtre est actif, allTimeClicks et allTimeUniqueClicks valent null car ils ne peuvent pas être filtrés ; filters renvoie le filtre utilisé ({} sans filtre). Une requête filtrée trop longue reçoit HTTP 503 avec le code filter_timeout : essayez une période plus courte.
| Paramètre | 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 | (optionnel) Date de début au format YYYY-MM-DD ou ISO 8601 (requis si date_range est custom) |
| end_date | (optionnel) Date de fin au format YYYY-MM-DD ou ISO 8601 (requis si date_range est custom) |
| collection_id | (optionnel) Filtrer les statistiques par un seul identifiant de collection (pour la compatibilité ascendante) |
| collections | (optionnel) Filtrer les statistiques par un ou plusieurs identifiants ou noms de collections. Peut être une valeur unique, une chaîne séparée par des virgules ou un tableau JSON. Exemple : [1,2,3] ou ["Marketing","Social Media"] |
| timezone | (optionnel) Fuseau horaire pour le calcul des dates (par ex. "America/New_York", "Europe/London", "Asia/Bangkok"). S'il n'est pas fourni, le fuseau horaire par défaut de l'utilisateur est utilisé, ou UTC à défaut. Doit être un fuseau horaire valide de la base de données des fuseaux horaires de PHP. |
| f_country[] | (facultatif) Filtre de clics : uniquement les clics de ces pays, tels que listés par Options de filtre des statistiques. Répétez le paramètre pour plusieurs valeurs. |
| f_referrer[] | (facultatif) Filtre de clics : uniquement les clics de ces sources, telles que listées par Options de filtre des statistiques (par exemple instagram.com, ou direct pour les clics sans référent). |
| f_os[] | (facultatif) Filtre de clics : uniquement les clics de ces systèmes d'exploitation. |
| f_browser[] | (facultatif) Filtre de clics : uniquement les clics de ces navigateurs. |
| f_language[] | (facultatif) Filtre de clics : uniquement les clics avec ces langues de navigateur (par exemple 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
Obtenir des statistiques détaillées pour un lien spécifique, incluant les données de clics, la distribution géographique, les référents, les appareils, les navigateurs, les langues, les villes, les tendances journalières (distribution horaire/quotidienne des clics) et l'activité récente (5 clics les plus récents). Vous pouvez passer soit l'identifiant du lien (ex. : 123) soit l'URL courte complète (ex. : https://linktw.in/abc123). Le format des données de graphique varie selon la période : 1d retourne 25 entrées horaires avec des heures partielles au début/fin, les autres périodes retournent des séries temporelles complètes avec 0 clic pour les périodes vides. Pour les périodes supérieures à 90 jours, les données sont regroupées par mois. Toutes les valeurs de date/heure dans la réponse seront ajustées au fuseau horaire spécifié. Pour les utilisateurs du forfait gratuit, la réponse inclut également missedClicks (total des clics qui ont dépassé la limite du forfait).
Restrictions strictes : La plage de dates est automatiquement limitée par : (1) La limite de rétention du forfait, (2) La date de création du compte, (3) La date de création du lien. Vous ne pouvez pas interroger des données antérieures à ces limites.
Filtre de clics : les paramètres f_ limitent chaque chiffre aux clics correspondants, comme le bouton Filtre des pages de statistiques du site. Plusieurs valeurs d'un paramètre comptent chacune d'elles, plusieurs paramètres doivent tous correspondre. Tant qu'un filtre est actif, allTimeClicks et allTimeUniqueClicks valent null car ils ne peuvent pas être filtrés ; filters renvoie le filtre utilisé ({} sans filtre). Une requête filtrée trop longue reçoit HTTP 503 avec le code filter_timeout : essayez une période plus courte.
| Paramètre | Description |
|---|---|
| date_range | (required) Date range: 1d (last 24 hours), 7d, 30d or 1y (that many days including today), max, or custom |
| start_date | (optionnel) Date de début au format YYYY-MM-DD ou ISO 8601 (requis si date_range est custom) |
| end_date | (optionnel) Date de fin au format YYYY-MM-DD ou ISO 8601 (requis si date_range est custom) |
| timezone | (optionnel) Fuseau horaire pour le calcul et l'affichage des dates (par ex. "America/New_York", "Europe/London", "Asia/Bangkok"). S'il n'est pas fourni, le fuseau horaire par défaut de l'utilisateur est utilisé, ou UTC à défaut. Doit être un fuseau horaire valide de la base de données des fuseaux horaires de PHP. |
| f_country[] | (facultatif) Filtre de clics : uniquement les clics de ces pays, tels que listés par Options de filtre des statistiques. Répétez le paramètre pour plusieurs valeurs. |
| f_referrer[] | (facultatif) Filtre de clics : uniquement les clics de ces sources, telles que listées par Options de filtre des statistiques (par exemple instagram.com, ou direct pour les clics sans référent). |
| f_os[] | (facultatif) Filtre de clics : uniquement les clics de ces systèmes d'exploitation. |
| f_browser[] | (facultatif) Filtre de clics : uniquement les clics de ces navigateurs. |
| f_language[] | (facultatif) Filtre de clics : uniquement les clics avec ces langues de navigateur (par exemple 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/filter-options?dimension=country&date_range=30d
Les valeurs qu'un filtre de clics peut prendre sur la période, avec leurs clics, pour construire un filtre : les listes du bouton Filtre des pages de statistiques du site (jusqu'à 100, les plus cliquées d'abord). Renvoyez une valeur en f_
| Paramètre | Description |
|---|---|
| dimension | (obligatoire) country, referrer, os, browser ou language |
| link | (facultatif) ID du lien ou URL courte : les valeurs des clics de ce lien au lieu de celles du compte |
| 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 | (optionnel) Date de début au format YYYY-MM-DD ou ISO 8601 (requis si date_range est custom) |
| end_date | (optionnel) Date de fin au format YYYY-MM-DD ou ISO 8601 (requis si date_range est custom) |
| collections | (optionnel) Filtrer les statistiques par un ou plusieurs identifiants ou noms de collections. Peut être une valeur unique, une chaîne séparée par des virgules ou un tableau JSON. Exemple : [1,2,3] ou ["Marketing","Social Media"] |
| timezone | (optionnel) Fuseau horaire pour le calcul des dates (par ex. "America/New_York", "Europe/London", "Asia/Bangkok"). S'il n'est pas fourni, le fuseau horaire par défaut de l'utilisateur est utilisé, ou UTC à défaut. Doit être un fuseau horaire valide de la base de données des fuseaux horaires de PHP. |
| f_country[] | (facultatif) Filtre de clics : uniquement les clics de ces pays, tels que listés par Options de filtre des statistiques. Répétez le paramètre pour plusieurs valeurs. |
| f_referrer[] | (facultatif) Filtre de clics : uniquement les clics de ces sources, telles que listées par Options de filtre des statistiques (par exemple instagram.com, ou direct pour les clics sans référent). |
| f_os[] | (facultatif) Filtre de clics : uniquement les clics de ces systèmes d'exploitation. |
| f_browser[] | (facultatif) Filtre de clics : uniquement les clics de ces navigateurs. |
| f_language[] | (facultatif) Filtre de clics : uniquement les clics avec ces langues de navigateur (par exemple en). |
curl --location --request GET 'https://linktw.in/api/statistics/filter-options?dimension=country&date_range=30d' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"dimension": "referrer",
"date_range": "30d",
"f_country": [
"Germany"
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/statistics/filter-options?dimension=country&date_range=30d",
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(
'dimension' => 'referrer',
'date_range' => '30d',
'f_country' =>
array(
0 => 'Germany',
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/statistics/filter-options?dimension=country&date_range=30d',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"dimension": "referrer",
"date_range": "30d",
"f_country": [
"Germany"
]
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": [
{
"value": "instagram.com",
"label": "Instagram",
"count": 812,
"icon": "https:\/\/linktw.in\/static\/images\/instagram.svg"
},
{
"value": "direct",
"label": "Direct traffic",
"count": 301,
"icon": "https:\/\/linktw.in\/static\/images\/direct.svg"
},
"\/\/ ... for dimension=country: {\"value\": \"germany\", \"label\": \"Germany\", \"count\": 1203, \"code\": \"de\"} ..."
]
}
https://linktw.in/api/statistics/daytrend?timezone=America%2FNew_York
Obtenir la distribution horaire et quotidienne des clics pour identifier les périodes de pointe d'activité. Cet endpoint indique quand les utilisateurs sont les plus actifs au cours de la journée (par heure) et de la semaine (par jour de la semaine), vous aidant à optimiser la planification de votre contenu et vos campagnes marketing. Retourne les données de clics pour chaque heure (0-23) et chaque jour de la semaine (dimanche-samedi).
Restrictions strictes : La plage de dates est automatiquement limitée par : (1) La limite de rétention du forfait, (2) La date de création du compte, (3) La date de création du lien le plus ancien. Vous ne pouvez pas interroger des données antérieures à ces limites.
| Paramètre | Description |
|---|---|
| period | (optionnel) Période pour les statistiques. Options : "1d" (24 heures), "7d" ou "1w" (7 jours), "30d" ou "1m" (30 jours, par défaut), "1y" (365 jours), "max" (tout le temps), "custom" (nécessite start_date et end_date) |
| start_date | (optionnel) Date de début pour la période personnalisée (format Y-m-d, ex. : "2025-01-01"). Requis lorsque la période est "custom" |
| end_date | (optionnel) Date de fin pour la période personnalisée (format Y-m-d, ex. : "2025-01-31"). Requis lorsque la période est "custom" |
| timezone | (optionnel) Fuseau horaire pour le calcul des heures (par ex. "America/New_York", "Europe/London", "Asia/Bangkok"). S'il n'est pas fourni, le fuseau horaire par défaut de l'utilisateur est utilisé, ou UTC à défaut. Doit être un fuseau horaire valide de la base de données des fuseaux horaires de PHP. |
| collection_id | (optionnel) Filtrer les statistiques par un seul identifiant de collection (pour la compatibilité ascendante) |
| collections | (optionnel) Filtrer les statistiques par un ou plusieurs identifiants ou noms de collections. Peut être une valeur unique, une chaîne séparée par des virgules ou un tableau JSON. Exemple : [1,2,3] ou ["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"
}
}
}
Recevez les événements dès qu'ils se produisent : LinkTwin envoie une requête POST signée en JSON à votre adresse pour chaque événement auquel vous êtes abonné. Abonnez-vous et désabonnez-vous avec ces endpoints (REST hooks, comme le font Zapier et Make) ou sur la page Webhooks de votre tableau de bord.
Chaque requête porte les en-têtes X-LinkTwin-Event, X-LinkTwin-Delivery et X-LinkTwin-Signature (t=timestamp,v1=signature, un HMAC-SHA256 de l'horodatage, d'un point et du corps brut, avec le secret de signature comme clé). Écartez les doublons grâce à l'id de l'événement. Les envois en échec sont retentés pendant un jour au plus ; un webhook qui continue d'échouer est désactivé.
Clés API : vous pouvez créer plusieurs clés sur la même page, chacune en Accès complet ou en Lecture seule. Une clé en lecture seule répond 403 à toute requête autre que GET. Votre clé d'origine continue de fonctionner comme Clé par défaut.
https://linktw.in/api/webhooks
Liste les webhooks de votre compte. Les secrets de signature ne sont jamais listés.
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
Crée un webhook. La réponse contient son secret de signature une seule fois : conservez-le pour vérifier l'en-tête X-LinkTwin-Signature.
| Paramètre | Description |
|---|---|
| url | (obligatoire) L'adresse https qui reçoit les événements |
| events | (obligatoire) Une liste d'événements, par exemple ["link.clicked"]. Voir Lister les événements. |
| name | (facultatif) Un nom pour distinguer vos webhooks |
| filters | (facultatif) {"link_ids": [...], "collection_ids": [...]} : uniquement ces liens, ou les liens de ces 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
Obtient un 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
Supprime un webhook (désabonnement). Son journal des envois est aussi supprimé.
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
Envoie maintenant à son adresse un exemple du premier événement du webhook, marqué "test": true, et renvoie le code de statut et le temps de réponse.
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
Tous les événements auxquels vous pouvez vous abonner, avec un exemple de leurs données : link.created, link.clicked (les scans de QR code ont "qr": true) et email.captured (e-mails laissés sur les pages bio).
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
Les derniers événements d'un type, du plus récent au plus ancien, tels qu'ils ont été envoyés. Tant que rien ne s'est produit, vous recevez un exemple construit à partir de votre dernier lien, ou un exemple générique ("sample": true). Zapier et Make les affichent comme données d'exemple.
| Paramètre | Description |
|---|---|
| :event | (obligatoire) L'événement, par exemple link.clicked |
| limit | (facultatif) Combien, de 1 à 25 (3 par défaut) |
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"
}
}
]
}
}