Una chiave API è necessaria affinché le richieste vengano elaborate dal sistema. Alla registrazione, una chiave API viene generata automaticamente. La chiave deve essere inviata con ogni richiesta (vedi esempio sotto). Se non inviata o scaduta, si verificherà un errore. Mantieni segreta la tua chiave API per prevenire abusi.
Per autenticarti con il sistema API, devi inviare la tua chiave API come token di autorizzazione con ogni richiesta. Puoi vedere il codice di esempio qui sotto.
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);
});
La nostra API ha un limitatore di frequenza per proteggersi da picchi di richieste e massimizzare la stabilità. Il nostro limitatore è attualmente impostato a 120 richieste per 1 minuto.
Diversi header verranno inviati insieme alla risposta e possono essere esaminati per determinare varie informazioni sulla richiesta.
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 119
X-RateLimit-Reset: TIMESTAMP
Tutte le risposte API vengono restituite in formato JSON per impostazione predefinita. Per convertire questi dati in dati utilizzabili, è necessario usare la funzione appropriata in base al linguaggio. In PHP, json_decode() converte i dati in un oggetto (predefinito) o un array (secondo parametro su true). È importante controllare la chiave error che indica se si è verificato un errore. Puoi anche controllare il codice header.
{
"error": 1,
"message": "An error occurred"
}
Tutti i campi data è ora nelle risposte API sono nel fuso orario configurato del tuo account. Puoi impostare il fuso orario nelle impostazioni. Se non configurato, le date sono in UTC.
Puoi anche sovrascrivere il fuso orario del tuo account per singola richiesta aggiungendo un ?timezone= parametro di query per la maggior parte degli endpoint (es. ?timezone=America/New_York).
I campi data sono formattati come YYYY-MM-DD HH:MM:SS (es. 2024-01-15 14:30:00).
L'endpoint Account restituisce timezone_offset che è l'offset UTC corrente in minuti per il fuso orario configurato. Questo tiene conto dell'ora legale e può essere usato per convertire le date in altri fusi orari. Ad esempio, -300 significa UTC-5 (Eastern Standard Time), 60 significa UTC+1 (Central European Time).
{
"settings": {
"timezone": "America/New_York",
"timezone_offset": -300
},
"date": "2024-01-15 14:30:00"
}
Il location campo in geotarget l'array deve usare il nome completo esatto del paese come mostrato di seguito. I nomi dei paesi sono sensibili alle maiuscole. Clicca su qualsiasi paese per vedere le regioni disponibili per l'opzionale state campo.
| Codice | Nome paese (usa questo in location) | |
|---|---|---|
AD |
Andorra | |
AF |
Afghanistan | |
AG |
Antigua and Barbuda | |
AI |
Anguilla | |
AL |
Albania | |
AM |
Armenia | |
AN |
Netherlands Antilles | |
AO |
Angola | |
AQ |
Antarctica | |
AR |
Argentina | |
AS |
American Samoa | |
AT |
Austria | |
AU |
Australia | |
AW |
Aruba | |
AX |
Åland | |
AZ |
Azerbaijan | |
BA |
Bosnia and Herzegovina | |
BB |
Barbados | |
BD |
Bangladesh | |
BE |
Belgium | |
BF |
Burkina Faso | |
BG |
Bulgaria | |
BH |
Bahrain | |
BI |
Burundi | |
BJ |
Benin | |
BL |
Saint Barthélemy | |
BM |
Bermuda | |
BN |
Brunei | |
BO |
Bolivia | |
BQ |
Bonaire, Sint Eustatius and Saba | |
BR |
Brazil | |
BS |
Bahamas | |
BT |
Bhutan | |
BV |
Bouvet Island | |
BW |
Botswana | |
BY |
Belarus | |
BZ |
Belize | |
CA |
Canada | |
CC |
Cocos [Keeling] Islands | |
CD |
DR Congo | |
CF |
Central African Republic | |
CG |
Congo Republic | |
CH |
Switzerland | |
CI |
Ivory Coast | |
CK |
Cook Islands | |
CL |
Chile | |
CM |
Cameroon | |
CN |
China | |
CO |
Colombia | |
CR |
Costa Rica | |
CS |
Serbia and Montenegro | |
CU |
Cuba | |
CV |
Cabo Verde | |
CW |
Curaçao | |
CX |
Christmas Island | |
CY |
Cyprus | |
CZ |
Czechia | |
DE |
Germany | |
DJ |
Djibouti | |
DK |
Denmark | |
DM |
Dominica | |
DO |
Dominican Republic | |
DZ |
Algeria | |
EC |
Ecuador | |
EE |
Estonia | |
EG |
Egypt | |
EH |
Western Sahara | |
ER |
Eritrea | |
ES |
Spain | |
ET |
Ethiopia | |
FI |
Finland | |
FJ |
Fiji | |
FK |
Falkland Islands | |
FM |
Micronesia | |
FO |
Faroe Islands | |
FR |
France | |
GA |
Gabon | |
GB |
United Kingdom | |
GD |
Grenada | |
GE |
Georgia | |
GF |
French Guiana | |
GG |
Guernsey | |
GH |
Ghana | |
GI |
Gibraltar | |
GL |
Greenland | |
GM |
Gambia | |
GN |
Guinea | |
GP |
Guadeloupe | |
GQ |
Equatorial Guinea | |
GR |
Greece | |
GS |
South Georgia and South Sandwich Islands | |
GT |
Guatemala | |
GU |
Guam | |
GW |
Guinea-Bissau | |
GY |
Guyana | |
HK |
Hong Kong | |
HM |
Heard Island and McDonald Islands | |
HN |
Honduras | |
HR |
Croatia | |
HT |
Haiti | |
HU |
Hungary | |
ID |
Indonesia | |
IE |
Ireland | |
IL |
Israel | |
IM |
Isle of Man | |
IN |
India | |
IO |
British Indian Ocean Territory | |
IQ |
Iraq | |
IR |
Iran | |
IS |
Iceland | |
IT |
Italy | |
JE |
Jersey | |
JM |
Jamaica | |
JO |
Jordan | |
JP |
Japan | |
KE |
Kenya | |
KG |
Kyrgyzstan | |
KH |
Cambodia | |
KI |
Kiribati | |
KM |
Comoros | |
KN |
St Kitts and Nevis | |
KP |
North Korea | |
KR |
South Korea | |
KW |
Kuwait | |
KY |
Cayman Islands | |
KZ |
Kazakhstan | |
LA |
Laos | |
LB |
Lebanon | |
LC |
Saint Lucia | |
LI |
Liechtenstein | |
LK |
Sri Lanka | |
LR |
Liberia | |
LS |
Lesotho | |
LT |
Lithuania | |
LU |
Luxembourg | |
LV |
Latvia | |
LY |
Libya | |
MA |
Morocco | |
MC |
Monaco | |
MD |
Moldova | |
ME |
Montenegro | |
MF |
Saint Martin | |
MG |
Madagascar | |
MH |
Marshall Islands | |
MK |
North Macedonia | |
ML |
Mali | |
MM |
Myanmar | |
MN |
Mongolia | |
MO |
Macao | |
MP |
Northern Mariana Islands | |
MQ |
Martinique | |
MR |
Mauritania | |
MS |
Montserrat | |
MT |
Malta | |
MU |
Mauritius | |
MV |
Maldives | |
MW |
Malawi | |
MX |
Mexico | |
MY |
Malaysia | |
MZ |
Mozambique | |
NA |
Namibia | |
NC |
New Caledonia | |
NE |
Niger | |
NF |
Norfolk Island | |
NG |
Nigeria | |
NI |
Nicaragua | |
NL |
Netherlands | |
NO |
Norway | |
NP |
Nepal | |
NR |
Nauru | |
NU |
Niue | |
NZ |
New Zealand | |
OM |
Oman | |
PA |
Panama | |
PE |
Peru | |
PF |
French Polynesia | |
PG |
Papua New Guinea | |
PH |
Philippines | |
PK |
Pakistan | |
PL |
Poland | |
PM |
Saint Pierre and Miquelon | |
PN |
Pitcairn Islands | |
PR |
Puerto Rico | |
PS |
Palestine | |
PT |
Portugal | |
PW |
Palau | |
PY |
Paraguay | |
QA |
Qatar | |
RE |
Réunion | |
RO |
Romania | |
RS |
Serbia | |
RU |
Russia | |
RW |
Rwanda | |
SA |
Saudi Arabia | |
SB |
Solomon Islands | |
SC |
Seychelles | |
SD |
Sudan | |
SE |
Sweden | |
SG |
Singapore | |
SH |
Saint Helena | |
SI |
Slovenia | |
SJ |
Svalbard and Jan Mayen | |
SK |
Slovakia | |
SL |
Sierra Leone | |
SM |
San Marino | |
SN |
Senegal | |
SO |
Somalia | |
SR |
Suriname | |
SS |
South Sudan | |
ST |
São Tomé and Príncipe | |
SV |
El Salvador | |
SX |
Sint Maarten | |
SY |
Syria | |
SZ |
Eswatini | |
TC |
Turks and Caicos Islands | |
TD |
Chad | |
TF |
French Southern Territories | |
TG |
Togo | |
TH |
Thailand | |
TJ |
Tajikistan | |
TK |
Tokelau | |
TL |
Timor-Leste | |
TM |
Turkmenistan | |
TN |
Tunisia | |
TO |
Tonga | |
TR |
Turkey | |
TT |
Trinidad and Tobago | |
TV |
Tuvalu | |
TW |
Taiwan | |
TZ |
Tanzania | |
AE |
United Arab Emirates | |
UA |
Ukraine | |
UG |
Uganda | |
UM |
U.S. Minor Outlying Islands | |
US |
United States | |
UY |
Uruguay | |
UZ |
Uzbekistan | |
VA |
Vatican City | |
VC |
St Vincent and Grenadines | |
VE |
Venezuela | |
VG |
British Virgin Islands | |
VI |
U.S. Virgin Islands | |
VN |
Vietnam | |
VU |
Vanuatu | |
WF |
Wallis and Futuna | |
WS |
Samoa | |
XK |
Kosovo | |
YE |
Yemen | |
YT |
Mayotte | |
ZA |
South Africa | |
ZM |
Zambia | |
ZW |
Zimbabwe |
"geotarget": [
{"location": "Canada", "link": "https://example.ca"},
{"location": "United States", "link": "https://example.us", "state": "California"},
{"location": "United Kingdom", "link": "https://example.co.uk"}
]
https://linktw.in/api/urls?limit=2&page=1&order=date&collections=%5B1%2C2%5D
Per ottenere i tuoi link tramite l'API, puoi usare questo endpoint. Puoi anche filtrare i dati (vedi la tabella per maggiori informazioni). Se il tuo piano ha un limite di click, la risposta include un oggetto usage con il conteggio attuale dei click, il limite e i giorni rimanenti prima del reset del periodo di fatturazione. Questo campo è omesso per i piani illimitati.
Click mancati: Il campo missedclicks per link e missed_clicks nell'oggetto usage vengono restituiti solo per gli utenti del piano gratuito (che hanno limiti di click).
| Parametro | Descrizione |
|---|---|
| limit | (opzionale) Risultati per pagina |
| page | (opzionale) Pagina corrente richiesta |
| order | (opzionale) Ordina dati: date, date_desc, date_asc, clicks_desc, clicks_asc, name_asc, name_desc |
| search | (opzionale) Cerca link per alias, alias personalizzato, URL, meta titolo, titolo personalizzato o descrizione. Supporta l'espansione degli alias di dominio (es. "youtube" corrisponde a youtube.com e youtu.be) |
| date_from | (opzionale) Filtra per data di inizio (formato Y-m-d o ISO 8601, es. 2025-01-01 o 2025-01-01T00:00:00.000Z) |
| date_to | (opzionale) Filtra per data di fine (formato Y-m-d o ISO 8601, es. 2025-01-31 o 2025-01-31T23:59:59.999Z) |
| collections | (opzionale) Array di ID o nomi di collezioni per filtrare i link. Usa solo ID o solo nomi, non misti. Esempio: [1,2,3] o ["Marketing","Social Media"] |
| timezone | (opzionale) Fuso orario per i campi data nella risposta (es. America/New_York, Europe/London). Sostituisce l'impostazione del fuso orario dell'account. Predefinito UTC se non specificato. |
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",
"collections": [
{
"id": 1,
"name": "Marketing",
"description": "All marketing campaign links",
"color": "#1E88E5"
},
{
"id": 3,
"name": "Social Media",
"description": "Social media platform links",
"color": "#43A047"
}
],
"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,
"collections": [],
"pixels": [],
"date": "2023-11-10 18:00:25"
}
],
"usage": {
"clicks": 1250,
"clicks_limit": 50000,
"clicks_reset_days": 22
}
}
}
https://linktw.in/api/url/:id
Per ottenere i dettagli di un singolo link tramite l'API, puoi usare questo endpoint. Puoi passare l'ID del link oppure l'URL abbreviata completa.
| Parametro | Descrizione |
|---|---|
| :id | (obbligatorio) L'ID del link (es. 123) o l'URL abbreviata completa (es. https://linktw.in/abc123) |
| timezone | (opzionale) Fuso orario per i campi data nella risposta (es. America/New_York, Europe/London). Sostituisce l'impostazione del fuso orario dell'account. Predefinito UTC se non specificato. |
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"
},
"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
}
],
"date": "2023-11-10 18:01:43",
"collections": [
{
"id": 1,
"name": "Marketing",
"description": "All marketing campaign links",
"color": "#FF6B6B"
},
{
"id": 3,
"name": "Social Media",
"description": "Social media platform links",
"color": "#4ECDC4"
}
],
"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
Per creare un link, invia i dati come JSON (corpo raw, Content-Type: application/json) oppure come multipart/form-data (obbligatorio per caricare direttamente un file immagine). L'esempio seguente mostra tutti i parametri disponibili — solo url è obbligatorio.
| Parametro | Descrizione |
|---|---|
| url | (obbligatorio) URL lunga da abbreviare. |
| custom | (opzionale) Alias personalizzato al posto di uno casuale. |
| password | (opzionale) Protezione con password |
| domain | (opzionale) Dominio personalizzato (deve corrispondere a un dominio brandizzato già aggiunto) |
| expiry | (opzionale) Scadenza del link, esempio: 2024-09-28 23:11:16 |
| clicklimit | (opzionale) Numero massimo di click prima della scadenza del link (intero) |
| expirationredirect | (opzionale) URL a cui reindirizzare dopo la scadenza del link (per data o limite di click) |
| note | (opzionale) Nota/descrizione interna per questo link (non visibile ai visitatori) |
| display_title | (opzionale) Titolo personalizzato per organizzare questo link nella dashboard. È solo a titolo di riferimento e non influisce su og:title o sull'anteprima del link. |
| geotarget | (opzionale) Dati di geo-targeting. Array di oggetti con i campi location, link è state opzionale. Il campo location deve essere un nome di paese completo (es. "United States", "Canada"). Il campo state opzionale consente di targettizzare uno stato/regione specifico nel paese (es. "California"). Vedi l'elenco completo dei paesi e stati. |
| devicetarget | (opzionale) Dati di targeting per dispositivo. Array di oggetti con i campi device e link. |
| languagetarget | (opzionale) Dati di targeting per lingua. Array di oggetti con i campi language e link. |
| abtesting | (opzionale) Varianti di test A/B. Array di oggetti con i campi link e percent opzionale. |
| parameters | (opzionale) Parametri URL da aggiungere. Array di oggetti con i campi name e value. |
| metatitle | (opzionale) Meta titolo |
| metadescription | (opzionale) Meta descrizione |
| metaimage | (opzionale) Immagine di anteprima per i social (og:image). Accetta due formati: (1) JSON: fornisci un URL pubblico che termini in .jpg, .jpeg o .png — es. "metaimage": "https://example.com/image.jpg"; (2) Caricamento file: invia la richiesta come multipart/form-data e includi il file immagine in un campo chiamato metaimage. Entrambi i formati richiedono JPG/JPEG o PNG, massimo 500KB. |
| pixels | (opzionale) Array di ID o nomi di pixel da associare al link. Usa solo ID o solo nomi, non misti. |
| collections | (opzionale) Array di ID o nomi di collezioni a cui aggiungere il link. Usa solo ID o solo nomi, non misti. |
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"
],
"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"
}
],
"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',
),
'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',
),
),
'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"
],
"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"
}
],
"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
Per aggiornare un link, invia i dati come JSON (Content-Type: application/json) tramite una richiesta PUT, oppure come multipart/form-data (obbligatorio per caricare direttamente un file immagine). Invia solo i campi che vuoi modificare — i campi omessi rimangono invariati. Per i campi array, inviare il campo sostituisce tutti i valori esistenti. Invia null per svuotare un campo, [] per rimuovere tutti gli elementi da un campo array.
| Parametro | Descrizione |
|---|---|
| url | (opzionale) URL lunga a cui aggiornare |
| custom | (opzionale) Alias personalizzato |
| password | (opzionale) Protezione con password. Invia null per rimuovere. |
| domain | (opzionale) Dominio personalizzato (deve corrispondere a un dominio brandizzato già aggiunto) |
| expiry | (opzionale) Scadenza del link (es. 2024-09-28 23:11:16). Invia null per rimuovere. |
| clicklimit | (opzionale) Numero massimo di click prima della scadenza del link. Invia null per rimuovere. |
| expirationredirect | (opzionale) URL a cui reindirizzare dopo la scadenza del link. Invia null per rimuovere. |
| note | (opzionale) Nota/descrizione interna. Invia null per rimuovere. |
| display_title | (opzionale) Titolo personalizzato per l'organizzazione della dashboard. Invia null per rimuovere. |
| geotarget | (opzionale) Dati di geo-targeting (sostituzione completa). Array di oggetti con i campi location, link è state opzionale. Invia [] per cancellare tutto. Il campo location deve essere un nome di paese completo (es. "United States", "Canada"). Il campo state opzionale consente di targettizzare uno stato/regione specifico nel paese (es. "California"). Vedi l'elenco completo dei paesi e stati. |
| devicetarget | (opzionale) Dati di targeting per dispositivo (sostituzione completa). Array di oggetti con i campi device e link. Invia [] per cancellare tutto. |
| languagetarget | (opzionale) Dati di targeting per lingua (sostituzione completa). Array di oggetti con i campi language e link. Invia [] per cancellare tutto. |
| abtesting | (opzionale) Varianti di test A/B (sostituzione completa). Array di oggetti con i campi link e percent opzionale. Invia [] per cancellare tutto. |
| parameters | (opzionale) Parametri URL (sostituzione completa). Array di oggetti con i campi name e value. Invia [] per cancellare tutto. |
| metatitle | (opzionale) Meta titolo. Invia null per rimuovere. |
| metadescription | (opzionale) Meta descrizione. Invia null per rimuovere. |
| metaimage | (opzionale) Immagine di anteprima per i social (og:image). Accetta due formati: (1) JSON: fornisci un URL pubblico che termini in .jpg, .jpeg o .png; (2) Caricamento file: invia la richiesta come multipart/form-data e includi il file immagine in un campo chiamato metaimage. Entrambi i formati richiedono JPG/JPEG o PNG, massimo 500KB. Invia null (solo JSON) per rimuovere l'immagine corrente. |
| pixels | (opzionale) Array di ID o nomi di pixel (sostituzione completa). Invia [] per rimuovere tutti i pixel. |
| collections | (opzionale) Array di ID o nomi di collezioni (sostituzione completa). Invia [] per rimuovere da tutte le collezioni. |
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"
],
"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',
),
'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"
],
"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
Per eliminare un link, devi inviare una richiesta DELETE. Puoi usare DELETE /api/url/:id/delete (per ID numerici) oppure DELETE /api/url/delete/:id (per ID numerici e URL abbreviate complete come 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/urls/delete
Elimina più link con una singola richiesta. Invia un array di ID link da eliminare.
| Parametro | Descrizione |
|---|---|
| ids | (obbligatorio) Array di ID link da eliminare |
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/domains?limit=2&page=1
Ottieni tutti i domini disponibili per abbreviare i link. Questo include i domini standard (forniti dalla piattaforma) e i tuoi domini brandizzati (personalizzati). Usa il campo isStandard per distinguerli.
| Parametro | Descrizione |
|---|---|
| limit | (opzionale) Risultati per pagina per i domini brandizzati |
| page | (opzionale) Pagina corrente richiesta per i domini brandizzati |
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 dominio può essere aggiunto usando questo endpoint. Assicurati che il dominio punti correttamente al nostro server.
| Parametro | Descrizione |
|---|---|
| domain | (obbligatorio) Dominio brandizzato incluso http o https |
| redirectroot | (opzionale) Reindirizzamento root quando qualcuno visita il tuo dominio |
| redirect404 | (opzionale) Reindirizzamento 404 personalizzato |
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
Per aggiornare un dominio brandizzato, devi inviare dati validi in JSON tramite una richiesta PUT. I dati devono essere inviati nel corpo grezzo della richiesta come mostrato di seguito. L'esempio mostra tutti i parametri che puoi inviare, ma non è obbligatorio inviarli tutti (vedi la tabella per maggiori informazioni).
| Parametro | Descrizione |
|---|---|
| redirectroot | (opzionale) Reindirizzamento root quando qualcuno visita il tuo dominio |
| redirect404 | (opzionale) Reindirizzamento 404 personalizzato |
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
Per eliminare un dominio, devi inviare una richiesta 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
Per ottenere i tuoi codici pixel tramite l'API, puoi usare questo endpoint. Puoi anche filtrare i dati (vedi la tabella per maggiori informazioni).
| Parametro | Descrizione |
|---|---|
| limit | (opzionale) Risultati per pagina |
| page | (opzionale) Pagina corrente richiesta |
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",
"date": "2023-11-10 18:00:00"
},
{
"id": 2,
"type": "twitterpixel",
"name": "Twitter Pixel",
"tag": "1234567",
"date": "2023-11-10 18:10:00"
}
]
}
}
https://linktw.in/api/pixel/add
Un pixel può essere creato usando questo endpoint. Devi inviare il tipo di pixel e il tag.
| Parametro | Descrizione |
|---|---|
| type | (required) gtmpixel | gapixel | fbpixel | adwordspixel | linkedinpixel | twitterpixel | adrollpixel | quorapixel | pinterest | bing | snapchat | reddit | tiktok |
| name | (obbligatorio) Nome personalizzato per il tuo pixel |
| tag | (obbligatorio) Il tag del pixel |
curl --location --request POST 'https://linktw.in/api/pixel/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "gtmpixel",
"name": "My GTM",
"tag": "GTM-ABCDE"
}'
$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' => 'gtmpixel',
'name' => 'My GTM',
'tag' => 'GTM-ABCDE',
)),
));
$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": "gtmpixel",
"name": "My GTM",
"tag": "GTM-ABCDE"
}),
};
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
Per aggiornare un pixel, devi inviare dati validi in JSON tramite una richiesta PUT. I dati devono essere inviati nel corpo grezzo della richiesta come mostrato di seguito. L'esempio mostra tutti i parametri che puoi inviare, ma non è obbligatorio inviarli tutti (vedi la tabella per maggiori informazioni).
| Parametro | Descrizione |
|---|---|
| name | (opzionale) Nome personalizzato per il tuo pixel |
| tag | (obbligatorio) Il tag del pixel |
curl --location --request PUT 'https://linktw.in/api/pixel/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "My GTM",
"tag": "GTM-ABCDE"
}'
$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 GTM',
'tag' => 'GTM-ABCDE',
)),
));
$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 GTM",
"tag": "GTM-ABCDE"
}),
};
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
Per eliminare un pixel, devi inviare una richiesta 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
Per ottenere un singolo pixel con i link assegnati tramite l'API, puoi usare questo endpoint. Restituisce i dettagli del pixel e un elenco paginato di link a cui è assegnato questo pixel.
| Parametro | Descrizione |
|---|---|
| :id | (obbligatorio) ID del pixel |
| limit | (opzionale) Risultati per pagina |
| page | (opzionale) Pagina corrente richiesta |
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",
"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
Aggiungi o rimuovi più link da un pixel con una singola richiesta. Invia un array di ID link da aggiungere e/o rimuovere.
| Parametro | Descrizione |
|---|---|
| :id | (obbligatorio) ID del pixel |
| add | (opzionale) Array di ID link a cui aggiungere questo pixel |
| remove | (opzionale) Array di ID link da cui rimuovere questo 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
Per ottenere i tuoi codici QR tramite l'API, puoi usare questo endpoint. Puoi anche filtrare i dati (vedi la tabella per maggiori informazioni).
| Parametro | Descrizione |
|---|---|
| limit | (opzionale) Risultati per pagina |
| page | (opzionale) Pagina corrente richiesta |
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
Per ottenere i dettagli di un singolo codice QR tramite l'API, puoi usare questo 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
Per creare un codice QR, devi inviare dati validi in JSON tramite una richiesta POST. I dati devono essere inviati nel corpo grezzo della richiesta come mostrato di seguito. L'esempio mostra tutti i parametri che puoi inviare, ma non è obbligatorio inviarli tutti (vedi la tabella per maggiori informazioni).
| Parametro | Descrizione |
|---|---|
| type | (obbligatorio) text | vcard | link | email | phone | sms | wifi |
| data | (obbligatorio) Dati da incorporare nel codice QR. I dati possono essere una stringa o un array a seconda del tipo |
| background | (opzionale) Colore RGB, es. rgb(255,255,255) |
| foreground | (opzionale) Colore RGB, es. rgb(0,0,0) |
| logo | (opzionale) Percorso del logo in formato png o 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
Per aggiornare un codice QR, devi inviare dati validi in JSON tramite una richiesta PUT. I dati devono essere inviati nel corpo grezzo della richiesta come mostrato di seguito. L'esempio mostra tutti i parametri che puoi inviare, ma non è obbligatorio inviarli tutti (vedi la tabella per maggiori informazioni).
| Parametro | Descrizione |
|---|---|
| data | (obbligatorio) Dati da incorporare nel codice QR. I dati possono essere una stringa o un array a seconda del tipo |
| background | (opzionale) Colore RGB, es. rgb(255,255,255) |
| foreground | (opzionale) Colore RGB, es. rgb(0,0,0) |
| logo | (opzionale) Percorso del logo in formato png o 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
Per eliminare un codice QR, devi inviare una richiesta 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
Per ottenere le tue collezioni tramite l'API, puoi usare questo endpoint. Puoi anche filtrare i dati (vedi la tabella per maggiori informazioni).
| Parametro | Descrizione |
|---|---|
| limit | (opzionale) Risultati per pagina |
| page | (opzionale) Pagina corrente richiesta |
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
Per ottenere gli elementi di una collezione selezionata tramite l'API, puoi usare questo endpoint. Puoi anche filtrare i dati (vedi la tabella per maggiori informazioni).
| Parametro | Descrizione |
|---|---|
| limit | (opzionale) Risultati per pagina |
| page | (opzionale) Pagina corrente richiesta |
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
Una collezione può essere aggiunta usando questo endpoint.
| Parametro | Descrizione |
|---|---|
| name | (obbligatorio) Nome della collezione |
| slug | (opzionale) Slug del rotatore |
| description | (opzionale) Descrizione della collezione |
| color | (opzionale) Colore del badge della collezione (HEX) |
| public | (opzionale) Accesso (true o false) |
| starred | (opzionale) Contrassegna la collezione come preferita o meno (true o 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 link può essere assegnato a qualsiasi collezione inviando una richiesta con l'ID della collezione e l'ID del link.
| Parametro | Descrizione |
|---|---|
| :collectionid | (obbligatorio) ID della collezione |
| :itemid | (obbligatorio) ID del link |
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
Aggiungi o rimuovi più link da una collezione con una singola richiesta. Invia un array di ID link da aggiungere e/o rimuovere.
| Parametro | Descrizione |
|---|---|
| :id | (obbligatorio) ID della collezione |
| add | (opzionale) Array di ID link da aggiungere alla collezione |
| remove | (opzionale) Array di ID link da rimuovere dalla collezione |
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
Per aggiornare una collezione, devi inviare dati validi in JSON tramite una richiesta PUT. I dati devono essere inviati nel corpo grezzo della richiesta come mostrato di seguito. L'esempio mostra tutti i parametri che puoi inviare, ma non è obbligatorio inviarli tutti (vedi la tabella per maggiori informazioni).
| Parametro | Descrizione |
|---|---|
| name | (opzionale) Nome della collezione |
| slug | (opzionale) Slug del rotatore |
| description | (opzionale) Descrizione della collezione |
| color | (opzionale) Colore del badge della collezione (HEX) |
| public | (opzionale) Accesso (true o false) |
| starred | (opzionale) Contrassegna la collezione come preferita o meno (true o 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
Per eliminare una collezione, devi inviare una richiesta DELETE. Tutti gli elementi verranno rimossi dall'assegnazione.
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."
}