Se requiere una clave de API para que las solicitudes sean procesadas por el sistema. Una vez que un usuario se registra, se genera automáticamente una clave de API para este usuario. La clave de API debe enviarse con cada solicitud (ver ejemplo completo a continuación). Si la clave de API no se envía o ha expirado, habrá un error. Asegúrate de mantener tu clave de API en secreto para prevenir abusos.
Para autenticarte con el sistema API, necesitas enviar tu clave API como token de autorización con cada solicitud. Puedes ver codigo de ejemplo a continuacion.
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);
});
Nuestra API tiene un limitador de uso para proteger contra picos de solicitudes y maximizar su estabilidad. Nuestro limitador está actualmente configurado en 120 solicitudes por 1 minuto.
Se enviaran varios encabezados junto con la respuesta y estos pueden examinarse para determinar diversa información sobre la solicitud.
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 119
X-RateLimit-Reset: TIMESTAMP
Todas las respuestas de la API se devuelven en formato JSON por defecto. Para convertir esto en datos utilizables, se deberá usar la función apropiada según el lenguaje. En PHP, la función json_decode() se puede usar para convertir los datos en un objeto (por defecto) o un array (establece el segundo parámetro en true). Es muy importante verificar la clave de error ya que proporciona información sobre si hubo un error o no. También puedes verificar el código de cabecera.
{
"error": 1,
"message": "An error occurred"
}
Todos los campos de fecha y hora en las respuestas de la API se devuelven en la zona horaria configurada de tu cuenta. Puedes establecer tu zona horaria en la configuración de tu cuenta. Si no se configura ninguna zona horaria, las fechas se predeterminan a UTC.
Tambien puedes anular la zona horaria de tu cuenta por solicitud agregando un ?timezone= parametro de consulta a la mayoria de los endpoints (ej., ?timezone=America/New_York).
Los campos de fecha están formateados como YYYY-MM-DD HH:MM:SS (ej. 2024-01-15 14:30:00).
El endpoint de cuenta devuelve timezone_offset que es el desplazamiento UTC actual en minutos para tu zona horaria configurada. Esto tiene en cuenta el horario de verano y puede usarse para convertir fechas a otras zonas horarias. Por ejemplo, -300 significa UTC-5 (hora estandar del este), 60 significa UTC+1 (hora central europea).
{
"settings": {
"timezone": "America/New_York",
"timezone_offset": -300
},
"date": "2024-01-15 14:30:00"
}
El location campo en el geotarget el array debe usar el nombre completo exacto del país como se muestra a continuación. Los nombres de países distinguen entre mayúsculas y minúsculas. Haz clic en cualquier país para ver sus estados/regiones disponibles para el opciónal state campo.
| Código | Nombre del país (usa esto en 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
Para obtener tus enlaces a través de la API, puedes usar este endpoint. También puedes filtrar datos (consulta la tabla para más información). Si tu plan tiene un límite de clics, la respuesta incluye un objeto usage con tu recuento actual de clics, el límite y los días hasta que se reinicia el período de facturación. Este campo se omite para planes ilimitados.
Clics perdidos: El campo missedclicks por enlace y missed_clicks en el objeto usage solo se devuelven para usuarios del plan gratuito (que tienen límites de clics).
| Parámetro | Descripción |
|---|---|
| limit | (opcional) Resultados por página |
| page | (opcional) Página actual solicitada |
| order | (opcional) Ordenar datos: date, date_desc, date_asc, clicks_desc, clicks_asc, name_asc, name_desc |
| search | (opcional) Buscar enlaces por alias, alias personalizado, URL, meta título, título personalizado o descripción. Admite expansión de alias de dominio (p. ej., "youtube" coincide con youtube.com y youtu.be) |
| date_from | (opcional) Filtrar por fecha de inicio (formato Y-m-d o ISO 8601, p. ej., 2025-01-01 o 2025-01-01T00:00:00.000Z) |
| date_to | (opcional) Filtrar por fecha de fin (formato Y-m-d o ISO 8601, p. ej., 2025-01-31 o 2025-01-31T23:59:59.999Z) |
| collections | (opcional) Array de IDs o nombres de colecciones para filtrar enlaces. Usa solo IDs o solo nombres, no mezclados. Ejemplo: [1,2,3] o ["Marketing","Social Media"] |
| timezone | (opcional) Zona horaria para los campos de fecha en la respuesta (p. ej., America/New_York, Europe/London). Anula la configuración de zona horaria de la cuenta. Por defecto es UTC si no se especifica. |
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
Para obtener detalles de un enlace individual a través de la API, puedes usar este endpoint. Puedes pasar el ID del enlace o la URL corta completa.
| Parámetro | Descripción |
|---|---|
| :id | (requerido) El ID del enlace (p. ej., 123) o la URL corta completa (p. ej., https://linktw.in/abc123) |
| timezone | (opcional) Zona horaria para los campos de fecha en la respuesta (p. ej., America/New_York, Europe/London). Anula la configuración de zona horaria de la cuenta. Por defecto es UTC si no se especifica. |
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
Para crear un enlace, envía tus datos como JSON (cuerpo sin formato, Content-Type: application/json) o como multipart/form-data (requerido al subir un archivo de imagen directamente). El ejemplo a continuación muestra todos los parámetros disponibles — solo url es obligatorio.
| Parámetro | Descripción |
|---|---|
| url | (requerido) URL larga a acortar. |
| custom | (opcional) Alias personalizado en lugar de alias aleatorio. |
| password | (opcional) Protección con contraseña |
| domain | (opcional) Dominio personalizado (debe coincidir con un dominio de marca ya añadido) |
| expiry | (opcional) Expiración del enlace, ejemplo: 2024-09-28 23:11:16 |
| clicklimit | (opcional) Número máximo de clics antes de que el enlace expire (entero) |
| expirationredirect | (opcional) URL de redirección después de que el enlace expire (por fecha o límite de clics) |
| note | (opcional) Nota/descripción interna para este enlace (no visible para los visitantes) |
| display_title | (opcional) Título personalizado para organizar este enlace en tu panel. Es solo para tu referencia y no afecta a og:title ni a la vista previa del enlace. |
| geotarget | (opcional) Datos de segmentación geográfica. Array de objetos con los campos location, link y state opcional. La location debe ser el nombre completo del país (p. ej., "United States", "Canada"). El campo state opcional permite segmentar una región/estado específico dentro del país (p. ej., "California"). Ver la lista completa de países y estados. |
| devicetarget | (opcional) Datos de segmentación por dispositivo. Array de objetos con los campos device y link. |
| languagetarget | (opcional) Datos de segmentación por idioma. Array de objetos con los campos language y link. |
| abtesting | (opcional) Variantes de pruebas A/B. Array de objetos con los campos link y percent opcional. |
| parameters | (opcional) Parámetros de URL a añadir. Array de objetos con los campos name y value. |
| metatitle | (opcional) Meta título |
| metadescription | (opcional) Meta descripción |
| metaimage | (opcional) Imagen de vista previa para redes sociales (og:image). Acepta dos formatos: (1) JSON: proporciona una URL pública que termine en .jpg, .jpeg o .png — p. ej. "metaimage": "https://example.com/image.jpg"; (2) Subida de archivo: envía la solicitud como multipart/form-data e incluye el archivo de imagen en un campo llamado metaimage. Ambos formatos requieren JPG/JPEG o PNG, máximo 500KB. |
| pixels | (opcional) Array de IDs o nombres de píxeles para adjuntar al enlace. Usa solo IDs o solo nombres, no mezclados. |
| collections | (opcional) Array de IDs o nombres de colecciones para añadir el enlace. Usa solo IDs o solo nombres, no mezclados. |
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
Para actualizar un enlace, envía tus datos como JSON (Content-Type: application/json) mediante una solicitud PUT, o como multipart/form-data (requerido al subir un archivo de imagen directamente). Solo envía los campos que deseas cambiar — los campos omitidos permanecen sin cambios. Para campos de tipo array, enviar el campo reemplaza todos los valores existentes. Envía null para limpiar un campo, [] para eliminar todos los elementos de un campo array.
| Parámetro | Descripción |
|---|---|
| url | (opcional) URL larga a la que actualizar |
| custom | (opcional) Alias personalizado |
| password | (opcional) Protección con contraseña. Envía null para eliminar. |
| domain | (opcional) Dominio personalizado (debe coincidir con un dominio de marca ya añadido) |
| expiry | (opcional) Expiración del enlace (p. ej., 2024-09-28 23:11:16). Envía null para eliminar. |
| clicklimit | (opcional) Número máximo de clics antes de que el enlace expire. Envía null para eliminar. |
| expirationredirect | (opcional) URL de redirección después de que el enlace expire. Envía null para eliminar. |
| note | (opcional) Nota/descripción interna. Envía null para eliminar. |
| display_title | (opcional) Título personalizado para organización en el panel. Envía null para eliminar. |
| geotarget | (opcional) Datos de segmentación geográfica (reemplazo completo). Array de objetos con los campos location, link y state opcional. Envía [] para limpiar todo. La location debe ser el nombre completo del país (p. ej., "United States", "Canada"). El campo state opcional permite segmentar una región/estado específico dentro del país (p. ej., "California"). Ver la lista completa de países y estados. |
| devicetarget | (opcional) Datos de segmentación por dispositivo (reemplazo completo). Array de objetos con los campos device y link. Envía [] para limpiar todo. |
| languagetarget | (opcional) Datos de segmentación por idioma (reemplazo completo). Array de objetos con los campos language y link. Envía [] para limpiar todo. |
| abtesting | (opcional) Variantes de pruebas A/B (reemplazo completo). Array de objetos con los campos link y percent opcional. Envía [] para limpiar todo. |
| parameters | (opcional) Parámetros de URL (reemplazo completo). Array de objetos con los campos name y value. Envía [] para limpiar todo. |
| metatitle | (opcional) Meta título. Envía null para eliminar. |
| metadescription | (opcional) Meta descripción. Envía null para eliminar. |
| metaimage | (opcional) Imagen de vista previa para redes sociales (og:image). Acepta dos formatos: (1) JSON: proporciona una URL pública que termine en .jpg, .jpeg o .png; (2) Subida de archivo: envía la solicitud como multipart/form-data e incluye el archivo de imagen en un campo llamado metaimage. Ambos formatos requieren JPG/JPEG o PNG, máximo 500KB. Envía null (solo JSON) para eliminar la imagen actual. |
| pixels | (opcional) Array de IDs o nombres de píxeles (reemplazo completo). Envía [] para eliminar todos los píxeles. |
| collections | (opcional) Array de IDs o nombres de colecciones (reemplazo completo). Envía [] para eliminar de todas las colecciones. |
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
Para eliminar un enlace, debes enviar una solicitud DELETE. Puedes usar DELETE /api/url/:id/delete (para IDs numéricos) o DELETE /api/url/delete/:id (para IDs numéricos y URLs cortas completas como 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 múltiples enlaces en una sola solicitud. Envía un array de IDs de enlaces a eliminar.
| Parámetro | Descripción |
|---|---|
| ids | (requerido) Array de IDs de enlaces a eliminar |
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
Obtén todos los dominios disponibles para acortar enlaces. Esto incluye los dominios estándar (proporcionados por la plataforma) y tus dominios de marca (personalizados). Usa el campo isStandard para distinguir entre ellos.
| Parámetro | Descripción |
|---|---|
| limit | (opcional) Resultados por página para dominios de marca |
| page | (opcional) Página actual solicitada para dominios de marca |
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
Se puede añadir un dominio usando este endpoint. Asegúrate de que el dominio apunte correctamente a nuestro servidor.
| Parámetro | Descripción |
|---|---|
| domain | (requerido) Dominio de marca incluyendo http o https |
| redirectroot | (opcional) Redirección raíz cuando alguien visita tu dominio |
| redirect404 | (opcional) Redirección 404 personalizada |
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
Para actualizar un dominio de marca, debes enviar datos válidos en JSON mediante una solicitud PUT. Los datos deben enviarse como el cuerpo sin formato de tu solicitud, como se muestra a continuación. El ejemplo muestra todos los parámetros que puedes enviar, pero no es obligatorio enviarlos todos (consulta la tabla para más información).
| Parámetro | Descripción |
|---|---|
| redirectroot | (opcional) Redirección raíz cuando alguien visita tu dominio |
| redirect404 | (opcional) Redirección 404 personalizada |
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
Para eliminar un dominio, debes enviar una solicitud 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
Para obtener tus códigos de píxeles a través de la API, puedes usar este endpoint. También puedes filtrar datos (consulta la tabla para más información).
| Parámetro | Descripción |
|---|---|
| limit | (opcional) Resultados por página |
| page | (opcional) Página actual solicitada |
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
Se puede crear un píxel usando este endpoint. Debes enviar el tipo de píxel y la etiqueta.
| Parámetro | Descripción |
|---|---|
| type | (required) gtmpixel | gapixel | fbpixel | adwordspixel | linkedinpixel | twitterpixel | adrollpixel | quorapixel | pinterest | bing | snapchat | reddit | tiktok |
| name | (requerido) Nombre personalizado para tu píxel |
| tag | (requerido) La etiqueta para el píxel |
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
Para actualizar un píxel, debes enviar datos válidos en JSON mediante una solicitud PUT. Los datos deben enviarse como el cuerpo sin formato de tu solicitud, como se muestra a continuación. El ejemplo muestra todos los parámetros que puedes enviar, pero no es obligatorio enviarlos todos (consulta la tabla para más información).
| Parámetro | Descripción |
|---|---|
| name | (opcional) Nombre personalizado para tu píxel |
| tag | (requerido) La etiqueta para el píxel |
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
Para eliminar un píxel, debes enviar una solicitud 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
Para obtener un píxel individual con sus enlaces asignados a través de la API, puedes usar este endpoint. Devuelve los detalles del píxel y una lista paginada de enlaces que tienen este píxel asignado.
| Parámetro | Descripción |
|---|---|
| :id | (requerido) ID del píxel |
| limit | (opcional) Resultados por página |
| page | (opcional) Página actual solicitada |
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
Añade o elimina múltiples enlaces a/de un píxel en una sola solicitud. Envía un array de IDs de enlaces para añadir y/o eliminar.
| Parámetro | Descripción |
|---|---|
| :id | (requerido) ID del píxel |
| add | (opcional) Array de IDs de enlaces a los que añadir este píxel |
| remove | (opcional) Array de IDs de enlaces de los que eliminar este píxel |
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
Para obtener tus códigos QR a través de la API, puedes usar este endpoint. También puedes filtrar datos (consulta la tabla para más información).
| Parámetro | Descripción |
|---|---|
| limit | (opcional) Resultados por página |
| page | (opcional) Página actual solicitada |
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
Para obtener detalles de un código QR individual a través de la API, puedes usar este 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
Para crear un código QR, debes enviar datos válidos en JSON mediante una solicitud POST. Los datos deben enviarse como el cuerpo sin formato de tu solicitud, como se muestra a continuación. El ejemplo muestra todos los parámetros que puedes enviar, pero no es obligatorio enviarlos todos (consulta la tabla para más información).
| Parámetro | Descripción |
|---|---|
| type | (requerido) text | vcard | link | email | phone | sms | wifi |
| data | (requerido) Datos a incrustar dentro del código QR. Los datos pueden ser una cadena o un array según el tipo |
| background | (opcional) Color RGB, p. ej. rgb(255,255,255) |
| foreground | (opcional) Color RGB, p. ej. rgb(0,0,0) |
| logo | (opcional) Ruta al logotipo en 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
Para actualizar un código QR, debes enviar datos válidos en JSON mediante una solicitud PUT. Los datos deben enviarse como el cuerpo sin formato de tu solicitud, como se muestra a continuación. El ejemplo muestra todos los parámetros que puedes enviar, pero no es obligatorio enviarlos todos (consulta la tabla para más información).
| Parámetro | Descripción |
|---|---|
| data | (requerido) Datos a incrustar dentro del código QR. Los datos pueden ser una cadena o un array según el tipo |
| background | (opcional) Color RGB, p. ej. rgb(255,255,255) |
| foreground | (opcional) Color RGB, p. ej. rgb(0,0,0) |
| logo | (opcional) Ruta al logotipo en 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
Para eliminar un código QR, debes enviar una solicitud 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
Para obtener tus colecciones a través de la API, puedes usar este endpoint. También puedes filtrar datos (consulta la tabla para más información).
| Parámetro | Descripción |
|---|---|
| limit | (opcional) Resultados por página |
| page | (opcional) Página actual solicitada |
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
Para obtener los elementos de una colección seleccionada a través de la API, puedes usar este endpoint. También puedes filtrar datos (consulta la tabla para más información).
| Parámetro | Descripción |
|---|---|
| limit | (opcional) Resultados por página |
| page | (opcional) Página actual solicitada |
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
Se puede añadir una colección usando este endpoint.
| Parámetro | Descripción |
|---|---|
| name | (requerido) Nombre de la colección |
| slug | (opcional) Slug del rotador |
| description | (opcional) Descripción de la colección |
| color | (opcional) Color de insignia de la colección (HEX) |
| public | (opcional) Acceso (true o false) |
| starred | (opcional) Destacar la colección o no (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
Se puede asignar un enlace a cualquier colección enviando una solicitud con el ID de la colección y el ID del enlace.
| Parámetro | Descripción |
|---|---|
| :collectionid | (requerido) ID de la colección |
| :itemid | (requerido) ID del enlace |
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
Añade o elimina múltiples enlaces a/de una colección en una sola solicitud. Envía un array de IDs de enlaces para añadir y/o eliminar.
| Parámetro | Descripción |
|---|---|
| :id | (requerido) ID de la colección |
| add | (opcional) Array de IDs de enlaces para añadir a la colección |
| remove | (opcional) Array de IDs de enlaces para eliminar de la colección |
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
Para actualizar una colección, debes enviar datos válidos en JSON mediante una solicitud PUT. Los datos deben enviarse como el cuerpo sin formato de tu solicitud, como se muestra a continuación. El ejemplo muestra todos los parámetros que puedes enviar, pero no es obligatorio enviarlos todos (consulta la tabla para más información).
| Parámetro | Descripción |
|---|---|
| name | (opcional) Nombre de la colección |
| slug | (opcional) Slug del rotador |
| description | (opcional) Descripción de la colección |
| color | (opcional) Color de insignia de la colección (HEX) |
| public | (opcional) Acceso (true o false) |
| starred | (opcional) Destacar la colección o no (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
Para eliminar una colección, debes enviar una solicitud DELETE. Todos los elementos también serán desasignados.
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."
}