API-Referenz für Entwickler

Erste Schritte

Ein API-Schlüssel ist erforderlich, damit Anfragen vom System verarbeitet werden. Sobald sich ein Nutzer registriert, wird automatisch ein API-Schlüssel generiert. Der API-Schlüssel muss mit jeder Anfrage gesendet werden (siehe vollständiges Beispiel unten). Wenn der API-Schlüssel nicht gesendet wird oder abgelaufen ist, tritt ein Fehler auf. Bitte halten Sie Ihren API-Schlüssel geheim, um Missbrauch zu verhindern.

Authentifizierung

Zur Authentifizierung mit dem API-System müssen Sie Ihren API-Schlüssel als Autorisierungstoken mit jeder Anfrage senden. Unten finden Sie Beispielcode.

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);
});
Ratenbegrenzung

Unsere API hat eine Ratenbegrenzung zum Schutz vor Anfragespitzen, um maximale Stabilität zu gewährleisten. Unsere Ratenbegrenzung ist derzeit auf 120 Anfragen pro 1 Minute begrenzt.

Mehrere Header werden zusammen mit der Antwort gesendet und können untersucht werden, um verschiedene Informationen über die Anfrage zu ermitteln.

X-RateLimit-Limit: 120
X-RateLimit-Remaining: 119
X-RateLimit-Reset: TIMESTAMP
Antwortverarbeitung

Alle API-Antworten werden standardmäßig im JSON-Format zurückgegeben. Um diese in nutzbare Daten umzuwandeln, muss je nach Programmiersprache die entsprechende Funktion verwendet werden. In PHP kann die Funktion json_decode() verwendet werden, um die Daten in ein Objekt (Standard) oder Array (zweiten Parameter auf true setzen) umzuwandeln. Es ist sehr wichtig, den Error-Schlüssel zu prüfen, da dieser Informationen darüber liefert, ob ein Fehler aufgetreten ist oder nicht. Sie können auch den Header-Code überprüfen.

{
    "error": 1,
    "message": "An error occurred"
}
Datum & Uhrzeit

Alle Datums- und Zeitfelder in API-Antworten werden in der für Ihr Konto konfigurierten Zeitzone zurückgegeben. Sie können Ihre Zeitzone in Ihren Kontoeinstellungen festlegen. Wenn keine Zeitzone konfiguriert ist, werden Daten standardmäßig in UTC angezeigt.

Sie koennen auch die Zeitzone Ihres Kontos pro Anfrage ueberschreiben, indem Sie ein ?timezone= Query-Parameter für die meisten Endpunkte (z. B. ?timezone=America/New_York).

Datumsfelder sind formatiert als YYYY-MM-DD HH:MM:SS (z. B. 2024-01-15 14:30:00).

Der Konto-Endpunkt gibt zurück timezone_offset was der aktuelle UTC-Offset in Minuten für Ihre konfigurierte Zeitzone ist. Dies berücksichtigt die Sommerzeit und kann zur Umrechnung von Daten in andere Zeitzonen verwendet werden. Zum Beispiel bedeutet -300 UTC-5 (Eastern Standard Time), 60 bedeutet UTC+1 (Mitteleuropäische Zeit).

{
    "settings": {
        "timezone": "America/New_York",
        "timezone_offset": -300
    },
    "date": "2024-01-15 14:30:00"
}

Referenztabellen

Geo-Targeting-Länderliste

Das location Feld in der/dem geotarget Array muss verwenden genauer vollständiger Ländername wie unten gezeigt. Ländernamen sind groß- und kleinschreibungsabhängig. Klicken Sie auf ein Land, um die verfügbaren Bundesländer/Regionen für das optionale state Feld.

CodeLändername (verwenden Sie dies 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
Beispielnutzung:
"geotarget": [
  {"location": "Canada", "link": "https://example.ca"},
  {"location": "United States", "link": "https://example.us", "state": "California"},
  {"location": "United Kingdom", "link": "https://example.co.uk"}
]

1. Links


2. Domänen

Alle Domänen auflisten
GET https://linktw.in/api/domains?limit=2&page=1

Alle verfügbaren Domänen zum Kürzen von Links abrufen. Dies umfasst Standard-Domänen (von der Plattform bereitgestellt) und Ihre Branded- (benutzerdefinierten) Domänen. Verwenden Sie das Feld isStandard, um zwischen ihnen zu unterscheiden.

ParameterBeschreibung
limit (optional) Ergebnisse pro Seite für Branded-Domänen
page (optional) Aktuelle Seitenanfrage für Branded-Domänen
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);
});
Server-Antwort
{
    "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
            }
        ]
    }
}
Eine Branded-Domäne erstellen
POST https://linktw.in/api/domain/add

Eine Domäne kann über diesen Endpoint hinzugefügt werden. Bitte stellen Sie sicher, dass die Domäne korrekt auf unseren Server zeigt.

ParameterBeschreibung
domain (erforderlich) Branded-Domäne einschließlich http oder https
redirectroot (optional) Root-Weiterleitung, wenn jemand Ihre Domäne besucht
redirect404 (optional) Benutzerdefinierte 404-Weiterleitung
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);
});
Server-Antwort
{
    "error": 0,
    "id": 1
}
Domain aktualisieren
PUT https://linktw.in/api/domain/:id/update

Um eine Branded-Domäne zu aktualisieren, müssen Sie gültige Daten als JSON über eine PUT-Anfrage senden. Die Daten müssen als roher Body Ihrer Anfrage gesendet werden, wie unten gezeigt. Das folgende Beispiel zeigt alle Parameter, die Sie senden können, aber Sie müssen nicht alle senden (siehe Tabelle für weitere Informationen).

ParameterBeschreibung
redirectroot (optional) Root-Weiterleitung, wenn jemand Ihre Domäne besucht
redirect404 (optional) Benutzerdefinierte 404-Weiterleitung
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);
});
Server-Antwort
{
    "error": 0,
    "message": "Domain has been updated successfully."
}
Domain löschen
DELETE https://linktw.in/api/domain/:id/delete

Um eine Domäne zu löschen, müssen Sie eine DELETE-Anfrage senden.

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);
});
Server-Antwort
{
    "error": 0,
    "message": "Domain has been deleted successfully."
}

3. Pixel

Pixel auflisten
GET https://linktw.in/api/pixels?limit=2&page=1

Um Ihre Pixel-Codes über die API abzurufen, können Sie diesen Endpoint verwenden. Sie können auch Daten filtern (siehe Tabelle für weitere Informationen).

ParameterBeschreibung
limit (optional) Ergebnisse pro Seite
page (optional) Aktuelle Seitenanfrage
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);
});
Server-Antwort
{
    "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"
            }
        ]
    }
}
Einen Pixel erstellen
POST https://linktw.in/api/pixel/add

Ein Pixel kann über diesen Endpoint erstellt werden. Sie müssen den Pixel-Typ und den Tag senden.

ParameterBeschreibung
type (required) gtmpixel | gapixel | fbpixel | adwordspixel | linkedinpixel | twitterpixel | adrollpixel | quorapixel | pinterest | bing | snapchat | reddit | tiktok
name (erforderlich) Benutzerdefinierter Name für Ihren Pixel
tag (erforderlich) Der Tag für den 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);
});
Server-Antwort
{
    "error": 0,
    "id": 1
}
Pixel aktualisieren
PUT https://linktw.in/api/pixel/:id/update

Um einen Pixel zu aktualisieren, müssen Sie gültige Daten als JSON über eine PUT-Anfrage senden. Die Daten müssen als roher Body Ihrer Anfrage gesendet werden, wie unten gezeigt. Das folgende Beispiel zeigt alle Parameter, die Sie senden können, aber Sie müssen nicht alle senden (siehe Tabelle für weitere Informationen).

ParameterBeschreibung
name (optional) Benutzerdefinierter Name für Ihren Pixel
tag (erforderlich) Der Tag für den 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);
});
Server-Antwort
{
    "error": 0,
    "message": "Pixel has been updated successfully."
}
Pixel löschen
DELETE https://linktw.in/api/pixel/:id/delete

Um einen Pixel zu löschen, müssen Sie eine DELETE-Anfrage senden.

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);
});
Server-Antwort
{
    "error": 0,
    "message": "Pixel has been deleted successfully."
}
Einzelnen Pixel abrufen
GET https://linktw.in/api/pixel/:id?limit=15&page=1

Um einen einzelnen Pixel mit seinen zugewiesenen Links über die API abzurufen, können Sie diesen Endpoint verwenden. Gibt die Pixel-Details und eine paginierte Liste der Links zurück, denen dieser Pixel zugewiesen ist.

ParameterBeschreibung
:id (erforderlich) Pixel-ID
limit (optional) Ergebnisse pro Seite
page (optional) Aktuelle Seitenanfrage
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);
});
Server-Antwort
{
    "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"
            }
        ]
    }
}
POST https://linktw.in/api/pixel/:id/links

Mehrere Links in einer einzigen Anfrage einem Pixel hinzufügen oder daraus entfernen. Senden Sie ein Array von Link-IDs zum Hinzufügen und/oder Entfernen.

ParameterBeschreibung
:id (erforderlich) Pixel-ID
add (optional) Array von Link-IDs, denen dieser Pixel hinzugefügt werden soll
remove (optional) Array von Link-IDs, aus denen dieser Pixel entfernt werden soll
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);
});
Server-Antwort
{
    "error": 0,
    "pixel_id": 1,
    "added": [
        101,
        102,
        103
    ],
    "removed": [
        50,
        51
    ],
    "errors": []
}

4. QR-Codes

QR-Codes auflisten
GET https://linktw.in/api/qr?limit=2&page=1

Um Ihre QR-Codes über die API abzurufen, können Sie diesen Endpoint verwenden. Sie können auch Daten filtern (siehe Tabelle für weitere Informationen).

ParameterBeschreibung
limit (optional) Ergebnisse pro Seite
page (optional) Aktuelle Seitenanfrage
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);
});
Server-Antwort
{
    "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"
            }
        ]
    }
}
Einen einzelnen QR-Code abrufen
GET https://linktw.in/api/qr/:id

Um Details zu einem einzelnen QR-Code über die API abzurufen, können Sie diesen Endpoint verwenden.

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);
});
Server-Antwort
{
    "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
        }
    }
}
Einen QR-Code erstellen
POST https://linktw.in/api/qr/add

Um einen QR-Code zu erstellen, müssen Sie gültige Daten als JSON über eine POST-Anfrage senden. Die Daten müssen als roher Body Ihrer Anfrage gesendet werden, wie unten gezeigt. Das folgende Beispiel zeigt alle Parameter, die Sie senden können, aber Sie müssen nicht alle senden (siehe Tabelle für weitere Informationen).

ParameterBeschreibung
type (erforderlich) text | vcard | link | email | phone | sms | wifi
data (erforderlich) In den QR-Code einzubettende Daten. Die Daten können je nach Typ eine Zeichenkette oder ein Array sein
background (optional) RGB-Farbe, z. B. rgb(255,255,255)
foreground (optional) RGB-Farbe, z. B. rgb(0,0,0)
logo (optional) Pfad zum Logo im Format png oder 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);
});
Server-Antwort
{
    "error": 0,
    "id": 3,
    "link": "https:\/\/linktw.in\/qr\/a58f79"
}
QR-Code aktualisieren
PUT https://linktw.in/api/qr/:id/update

Um einen QR-Code zu aktualisieren, müssen Sie gültige Daten als JSON über eine PUT-Anfrage senden. Die Daten müssen als roher Body Ihrer Anfrage gesendet werden, wie unten gezeigt. Das folgende Beispiel zeigt alle Parameter, die Sie senden können, aber Sie müssen nicht alle senden (siehe Tabelle für weitere Informationen).

ParameterBeschreibung
data (erforderlich) In den QR-Code einzubettende Daten. Die Daten können je nach Typ eine Zeichenkette oder ein Array sein
background (optional) RGB-Farbe, z. B. rgb(255,255,255)
foreground (optional) RGB-Farbe, z. B. rgb(0,0,0)
logo (optional) Pfad zum Logo im Format png oder 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);
});
Server-Antwort
{
    "error": 0,
    "message": "QR has been updated successfully."
}
Einen QR-Code löschen
DELETE https://linktw.in/api/qr/:id/delete

Um einen QR-Code zu löschen, müssen Sie eine DELETE-Anfrage senden.

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);
});
Server-Antwort
{
    "error": 0,
    "message": "QR Code has been deleted successfully."
}

5. Collections

Collections auflisten
GET https://linktw.in/api/collections?limit=2&page=1

Um Ihre Collections über die API abzurufen, können Sie diesen Endpoint verwenden. Sie können auch Daten filtern (siehe Tabelle für weitere Informationen).

ParameterBeschreibung
limit (optional) Ergebnisse pro Seite
page (optional) Aktuelle Seitenanfrage
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);
});
Server-Antwort
{
    "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
            }
        ]
    }
}
Einzelne Collection abrufen
GET https://linktw.in/api/collection/:id?limit=1&page=1

Um Elemente in einer ausgewählten Collection über die API abzurufen, können Sie diesen Endpoint verwenden. Sie können auch Daten filtern (siehe Tabelle für weitere Informationen).

ParameterBeschreibung
limit (optional) Ergebnisse pro Seite
page (optional) Aktuelle Seitenanfrage
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);
});
Server-Antwort
{
    "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"
            }
        ]
    }
}
Sammlung erstellen
POST https://linktw.in/api/collection/add

Eine Collection kann über diesen Endpoint hinzugefügt werden.

ParameterBeschreibung
name (erforderlich) Collection-Name
slug (optional) Rotator-Slug
description (optional) Collection-Beschreibung
color (optional) Badge-Farbe der Collection (HEX)
public (optional) Zugriff (true oder false)
starred (optional) Collection als Favorit markieren oder nicht (true oder 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);
});
Server-Antwort
{
    "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"
}
POST https://linktw.in/api/collection/:collectionid/assign/:itemid

Ein Link kann einer beliebigen Collection zugewiesen werden, indem eine Anfrage mit der Collection-ID und der Link-ID gesendet wird.

ParameterBeschreibung
:collectionid (erforderlich) Collection-ID
:itemid (erforderlich) Link-ID
curl --location --request POST 'https://linktw.in/api/collection/:collectionid/assign/:itemid' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://linktw.in/api/collection/:collectionid/assign/:itemid",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ],
    
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://linktw.in/api/collection/:collectionid/assign/:itemid',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
Server-Antwort
{
    "error": 0,
    "message": "Link successfully added to the collection."
}
POST https://linktw.in/api/collection/:id/links

Mehrere Links in einer einzigen Anfrage einer Collection hinzufügen oder daraus entfernen. Senden Sie ein Array von Link-IDs zum Hinzufügen und/oder Entfernen.

ParameterBeschreibung
:id (erforderlich) Collection-ID
add (optional) Array von Link-IDs, die der Collection hinzugefügt werden sollen
remove (optional) Array von Link-IDs, die aus der Collection entfernt werden sollen
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);
});
Server-Antwort
{
    "error": 0,
    "collection_id": 5,
    "added": [
        101,
        102,
        103
    ],
    "removed": [
        50,
        51
    ],
    "errors": []
}
Sammlung aktualisieren
PUT https://linktw.in/api/collection/:id/update

Um eine Collection zu aktualisieren, müssen Sie gültige Daten als JSON über eine PUT-Anfrage senden. Die Daten müssen als roher Body Ihrer Anfrage gesendet werden, wie unten gezeigt. Das folgende Beispiel zeigt alle Parameter, die Sie senden können, aber Sie müssen nicht alle senden (siehe Tabelle für weitere Informationen).

ParameterBeschreibung
name (optional) Collection-Name
slug (optional) Rotator-Slug
description (optional) Collection-Beschreibung
color (optional) Badge-Farbe der Collection (HEX)
public (optional) Zugriff (true oder false)
starred (optional) Collection als Favorit markieren oder nicht (true oder 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);
});
Server-Antwort
{
    "error": 0,
    "message": "Collection has been updated successfully."
}
Sammlung löschen
DELETE https://linktw.in/api/collection/:id/delete

Um eine Collection zu löschen, müssen Sie eine DELETE-Anfrage senden. Alle Elemente werden ebenfalls aus der Zuweisung entfernt.

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);
});
Server-Antwort
{
    "error": 0,
    "message": "Collection has been deleted successfully."
}