개발자를 위한 API 레퍼런스

시작하기

시스템에서 요청을 처리하려면 API 키가 필요합니다. 사용자가 등록하면 API 키가 자동으로 생성됩니다. 각 요청에 API 키를 함께 보내야 합니다(아래 전체 예제 참조). API 키가 전송되지 않거나 만료된 경우 오류가 발생합니다. 악용을 방지하기 위해 API 키를 비밀로 유지해 주세요.

인증

API 시스템으로 인증하려면 각 요청과 함께 API 키를 인증 토큰으로 보내야 합니다. 아래에서 샘플 코드를 확인할 수 있습니다.

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);
});
속도 제한

API에는 안정성을 극대화하기 위해 요청 급증을 방지하는 속도 제한기가 있습니다. 현재 속도 제한은 1분당 120개의 요청으로 설정되어 있습니다.

응답과 함께 여러 헤더가 전송되며, 이를 통해 요청에 대한 다양한 정보를 확인할 수 있습니다.

X-RateLimit-Limit: 120
X-RateLimit-Remaining: 119
X-RateLimit-Reset: TIMESTAMP
응답 처리

모든 API 응답은 기본적으로 JSON 형식으로 반환됩니다. 이를 사용 가능한 데이터로 변환하려면 언어에 따라 적절한 함수를 사용해야 합니다. PHP에서는 json_decode() 함수를 사용하여 데이터를 객체(기본값) 또는 배열(두 번째 파라미터를 true로 설정)로 변환할 수 있습니다. 오류 여부에 대한 정보를 제공하는 error 키를 확인하는 것이 매우 중요합니다. 헤더 코드도 확인할 수 있습니다.

{
    "error": 1,
    "message": "An error occurred"
}
날짜 & 시간

API 응답의 모든 날짜 및 시간 필드는 계정에 설정된 시간대로 반환됩니다. 계정 설정에서 시간대를 설정할 수 있습니다. 시간대가 설정되지 않은 경우 날짜는 기본적으로 UTC입니다.

요청별로 계정 시간대를 재정의할 수도 있습니다. 다음을 추가하세요: ?timezone= 대부분의 엔드포인트에 쿼리 매개변수 (예: ?timezone=America/New_York).

날짜 필드의 형식은 다음과 같습니다 YYYY-MM-DD HH:MM:SS (예: 2024-01-15 14:30:00).

Account 엔드포인트가 반환하는 내용 timezone_offset 설정된 시간대의 현재 UTC 오프셋(분 단위)입니다. 일광 절약 시간을 고려하며, 날짜를 다른 시간대로 변환하는 데 사용할 수 있습니다. 예를 들어, -300은 UTC-5(미국 동부 표준시), 60은 UTC+1(중앙유럽 표준시)을 의미합니다.

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

참조 표

지역 타겟팅 국가 목록

The location 필드 geotarget 배열은 다음을 사용해야 합니다: 정확한 전체 국가명 아래와 같이. 국가명은 대소문자를 구분합니다. 국가를 클릭하면 선택적으로 사용 가능한 주/지역을 확인할 수 있습니다. state 필드.

코드국가명 (다음에서 사용 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"}
]

1. 링크


2. 도메인

전체 도메인 목록 조회
GET https://linktw.in/api/domains?limit=2&page=1

링크 단축에 사용 가능한 모든 도메인을 가져옵니다. 표준(플랫폼 제공) 도메인과 브랜드(커스텀) 도메인이 포함됩니다. isStandard 필드를 사용하여 구분할 수 있습니다.

매개변수설명
limit (선택 사항) 브랜드 도메인의 페이지당 결과 수
page (선택 사항) 브랜드 도메인의 현재 페이지 요청
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
            }
        ]
    }
}
브랜드 도메인 생성
POST https://linktw.in/api/domain/add

이 endpoint를 사용하여 도메인을 추가할 수 있습니다. 도메인이 서버로 올바르게 연결되어 있는지 확인하세요.

매개변수설명
domain (필수) http 또는 https를 포함한 브랜드 도메인
redirectroot (선택 사항) 누군가 도메인을 방문할 때의 루트 리디렉션
redirect404 (선택 사항) 커스텀 404 리디렉션
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
}
도메인 업데이트
PUT https://linktw.in/api/domain/:id/update

브랜드 도메인을 업데이트하려면 PUT 요청으로 유효한 JSON 데이터를 전송해야 합니다. 데이터는 아래와 같이 요청의 raw body로 전송해야 합니다. 아래 예시는 전송 가능한 모든 파라미터를 보여주지만 모두 전송할 필요는 없습니다 (자세한 내용은 표 참조).

매개변수설명
redirectroot (선택 사항) 누군가 도메인을 방문할 때의 루트 리디렉션
redirect404 (선택 사항) 커스텀 404 리디렉션
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."
}
도메인 삭제
DELETE https://linktw.in/api/domain/:id/delete

도메인을 삭제하려면 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."
}

3. Pixel

Pixel 목록 조회
GET https://linktw.in/api/pixels?limit=2&page=1

API를 통해 pixel 코드를 조회하려면 이 endpoint를 사용합니다. 데이터를 필터링할 수도 있습니다 (자세한 내용은 표 참조).

매개변수설명
limit (선택 사항) 페이지당 결과 수
page (선택 사항) 현재 페이지 요청
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"
            }
        ]
    }
}
Pixel 생성
POST https://linktw.in/api/pixel/add

이 endpoint를 사용하여 pixel을 생성할 수 있습니다. pixel 유형과 태그를 전송해야 합니다.

매개변수설명
type (required) gtmpixel | gapixel | fbpixel | adwordspixel | linkedinpixel | twitterpixel | adrollpixel | quorapixel | pinterest | bing | snapchat | reddit | tiktok
name (필수) pixel의 커스텀 이름
tag (필수) pixel의 태그
curl --location --request POST 'https://linktw.in/api/pixel/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "gtmpixel",
    "name": "My GTM",
    "tag": "GTM-ABCDE"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://linktw.in/api/pixel/add",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode(array(
      'type' => 'gtmpixel',
      'name' => 'My GTM',
      'tag' => 'GTM-ABCDE',
    )),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://linktw.in/api/pixel/add',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
    "type": "gtmpixel",
    "name": "My GTM",
    "tag": "GTM-ABCDE"
}),
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "id": 1
}
Pixel 업데이트
PUT https://linktw.in/api/pixel/:id/update

pixel을 업데이트하려면 PUT 요청으로 유효한 JSON 데이터를 전송해야 합니다. 데이터는 아래와 같이 요청의 raw body로 전송해야 합니다. 아래 예시는 전송 가능한 모든 파라미터를 보여주지만 모두 전송할 필요는 없습니다 (자세한 내용은 표 참조).

매개변수설명
name (선택 사항) pixel의 커스텀 이름
tag (필수) pixel의 태그
curl --location --request PUT 'https://linktw.in/api/pixel/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "My GTM",
    "tag": "GTM-ABCDE"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://linktw.in/api/pixel/:id/update",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode(array(
      'name' => 'My GTM',
      'tag' => 'GTM-ABCDE',
    )),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'PUT',
    'url': 'https://linktw.in/api/pixel/:id/update',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
    "name": "My GTM",
    "tag": "GTM-ABCDE"
}),
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "message": "Pixel has been updated successfully."
}
Pixel 삭제
DELETE https://linktw.in/api/pixel/:id/delete

pixel을 삭제하려면 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."
}
단일 Pixel 조회
GET https://linktw.in/api/pixel/:id?limit=15&page=1

API를 통해 할당된 링크와 함께 단일 pixel을 조회하려면 이 endpoint를 사용합니다. pixel 세부 정보와 이 pixel이 할당된 링크의 페이지화된 목록을 반환합니다.

매개변수설명
:id (필수) Pixel ID
limit (선택 사항) 페이지당 결과 수
page (선택 사항) 현재 페이지 요청
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"
            }
        ]
    }
}
Pixel에 링크 일괄 할당
POST https://linktw.in/api/pixel/:id/links

단일 요청으로 pixel에 여러 링크를 추가하거나 제거합니다. 추가 및/또는 제거할 링크 ID 배열을 전송하세요.

매개변수설명
:id (필수) Pixel ID
add (선택 사항) 이 pixel을 추가할 링크 ID 배열
remove (선택 사항) 이 pixel을 제거할 링크 ID 배열
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": []
}

4. QR 코드

QR 코드 목록 조회
GET https://linktw.in/api/qr?limit=2&page=1

API를 통해 QR 코드를 조회하려면 이 endpoint를 사용합니다. 데이터를 필터링할 수도 있습니다 (자세한 내용은 표 참조).

매개변수설명
limit (선택 사항) 페이지당 결과 수
page (선택 사항) 현재 페이지 요청
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"
            }
        ]
    }
}
단일 QR 코드 조회
GET https://linktw.in/api/qr/:id

API를 통해 단일 QR 코드의 세부 정보를 조회하려면 이 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
        }
    }
}
QR 코드 생성
POST https://linktw.in/api/qr/add

QR 코드를 생성하려면 POST 요청으로 유효한 JSON 데이터를 전송해야 합니다. 데이터는 아래와 같이 요청의 raw body로 전송해야 합니다. 아래 예시는 전송 가능한 모든 파라미터를 보여주지만 모두 전송할 필요는 없습니다 (자세한 내용은 표 참조).

매개변수설명
type (필수) text | vcard | link | email | phone | sms | wifi
data (필수) QR 코드에 삽입할 데이터입니다. 유형에 따라 데이터는 문자열 또는 배열일 수 있습니다
background (선택 사항) RGB 색상, 예: rgb(255,255,255)
foreground (선택 사항) RGB 색상, 예: rgb(0,0,0)
logo (선택 사항) png 또는 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"
}
QR 코드 업데이트
PUT https://linktw.in/api/qr/:id/update

QR 코드를 업데이트하려면 PUT 요청으로 유효한 JSON 데이터를 전송해야 합니다. 데이터는 아래와 같이 요청의 raw body로 전송해야 합니다. 아래 예시는 전송 가능한 모든 파라미터를 보여주지만 모두 전송할 필요는 없습니다 (자세한 내용은 표 참조).

매개변수설명
data (필수) QR 코드에 삽입할 데이터입니다. 유형에 따라 데이터는 문자열 또는 배열일 수 있습니다
background (선택 사항) RGB 색상, 예: rgb(255,255,255)
foreground (선택 사항) RGB 색상, 예: rgb(0,0,0)
logo (선택 사항) png 또는 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."
}
QR 코드 삭제
DELETE https://linktw.in/api/qr/:id/delete

QR 코드를 삭제하려면 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."
}

5. 컬렉션

컬렉션 목록 조회
GET https://linktw.in/api/collections?limit=2&page=1

API를 통해 컬렉션을 조회하려면 이 endpoint를 사용합니다. 데이터를 필터링할 수도 있습니다 (자세한 내용은 표 참조).

매개변수설명
limit (선택 사항) 페이지당 결과 수
page (선택 사항) 현재 페이지 요청
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
            }
        ]
    }
}
단일 컬렉션 조회
GET https://linktw.in/api/collection/:id?limit=1&page=1

API를 통해 선택된 컬렉션의 항목을 조회하려면 이 endpoint를 사용합니다. 데이터를 필터링할 수도 있습니다 (자세한 내용은 표 참조).

매개변수설명
limit (선택 사항) 페이지당 결과 수
page (선택 사항) 현재 페이지 요청
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"
            }
        ]
    }
}
컬렉션 만들기
POST https://linktw.in/api/collection/add

이 endpoint를 사용하여 컬렉션을 추가할 수 있습니다.

매개변수설명
name (필수) 컬렉션 이름
slug (선택 사항) 로테이터 슬러그
description (선택 사항) 컬렉션 설명
color (선택 사항) 컬렉션 배지 색상 (HEX)
public (선택 사항) 접근 권한 (true 또는 false)
starred (선택 사항) 컬렉션 즐겨찾기 여부 (true 또는 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"
}
컬렉션에 링크 할당
POST https://linktw.in/api/collection/:collectionid/assign/:itemid

컬렉션 ID와 링크 ID를 포함한 요청을 전송하여 링크를 임의의 컬렉션에 할당할 수 있습니다.

매개변수설명
:collectionid (필수) 컬렉션 ID
:itemid (필수) 링크 ID
curl --location --request POST 'https://linktw.in/api/collection/:collectionid/assign/:itemid' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

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

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://linktw.in/api/collection/:collectionid/assign/:itemid',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "message": "Link successfully added to the collection."
}
컬렉션에 링크 일괄 할당
POST https://linktw.in/api/collection/:id/links

단일 요청으로 컬렉션에 여러 링크를 추가하거나 제거합니다. 추가 및/또는 제거할 링크 ID 배열을 전송하세요.

매개변수설명
:id (필수) 컬렉션 ID
add (선택 사항) 컬렉션에 추가할 링크 ID 배열
remove (선택 사항) 컬렉션에서 제거할 링크 ID 배열
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": []
}
컬렉션 업데이트
PUT https://linktw.in/api/collection/:id/update

컬렉션을 업데이트하려면 PUT 요청으로 유효한 JSON 데이터를 전송해야 합니다. 데이터는 아래와 같이 요청의 raw body로 전송해야 합니다. 아래 예시는 전송 가능한 모든 파라미터를 보여주지만 모두 전송할 필요는 없습니다 (자세한 내용은 표 참조).

매개변수설명
name (선택 사항) 컬렉션 이름
slug (선택 사항) 로테이터 슬러그
description (선택 사항) 컬렉션 설명
color (선택 사항) 컬렉션 배지 색상 (HEX)
public (선택 사항) 접근 권한 (true 또는 false)
starred (선택 사항) 컬렉션 즐겨찾기 여부 (true 또는 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."
}
컬렉션 삭제
DELETE https://linktw.in/api/collection/:id/delete

컬렉션을 삭제하려면 DELETE 요청을 전송해야 합니다. 모든 항목의 할당도 해제됩니다.

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."
}