개발자를 위한 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"
}

참조 표

지역 타겟팅 국가 목록

geotarget 배열의 location 필드에는 아래에 표시된 정확한 전체 국가명을 사용해야 합니다. 국가명은 대소문자를 구분합니다. 국가를 클릭하면 선택 항목인 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",
                "event": null,
                "date": "2023-11-10 18:00:00"
            },
            {
                "id": 2,
                "type": "fbpixel",
                "name": "Facebook Pixel",
                "tag": "1234567890123456",
                "event": "Lead",
                "date": "2023-11-10 18:10:00"
            }
        ]
    }
}
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의 태그
event (선택 사항, Facebook 전용) 링크를 클릭할 때마다 PageView와 함께 실행할 표준 이벤트. 다음 중 하나: Lead, CompleteRegistration, ViewContent, Search, AddToCart, AddToWishlist, InitiateCheckout, AddPaymentInfo, Purchase, Subscribe, StartTrial, Contact, Schedule, SubmitApplication, Donate. 기본값은 PageView만 실행입니다.
curl --location --request POST 'https://linktw.in/api/pixel/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "fbpixel",
    "name": "My Facebook Pixel",
    "tag": "1234567890123456",
    "event": "Lead"
}'
$curl = curl_init();

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

$response = curl_exec($curl);

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

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

매개변수설명
name (선택 사항) pixel의 커스텀 이름
tag (필수) pixel의 태그
event (선택 사항, Facebook 전용) PageView와 함께 실행할 표준 이벤트. PageView만 실행하려면 PageView를 보내거나 생략하세요. 허용되는 값의 전체 목록은 "픽셀 만들기"를 참고하세요.
curl --location --request PUT 'https://linktw.in/api/pixel/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "My Facebook Pixel",
    "tag": "1234567890123456",
    "event": "Lead"
}'
$curl = curl_init();

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

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'PUT',
    'url': 'https://linktw.in/api/pixel/:id/update',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
    "name": "My Facebook Pixel",
    "tag": "1234567890123456",
    "event": "Lead"
}),
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "message": "Pixel has been updated successfully."
}
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",
            "event": null,
            "date": "2024-01-15 12:00:00"
        },
        "links": [
            {
                "id": 101,
                "title": "Example Link",
                "shorturl": "https:\/\/linktw.in\/abc123",
                "longurl": "https:\/\/example.com",
                "clicks": 150,
                "date": "2024-01-10"
            }
        ]
    }
}
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."
}

6. 통계

캐싱: 통계 endpoint는 새로운 클릭 데이터가 도착하면 자동으로 무효화되는 지능형 캐싱을 사용합니다. 이를 통해 서버 부하를 최소화하면서 항상 최신 데이터를 얻을 수 있습니다. 새로운 클릭이 없는 반복 요청은 캐시된 결과를 즉시 반환합니다.

대시보드 통계
GET https://linktw.in/api/statistics/dashboard?period=1m&timezone=America%2FNew_York

계정의 집계된 통계를 가져옵니다. KPI(총 클릭수, 고유 클릭수, 상위 리퍼러, 상위 국가), 생성된 링크 수, 대시보드 뷰의 성능 지표가 포함됩니다. 차트 데이터 형식은 기간에 따라 다릅니다: 1d는 시작/끝에 부분 시간이 포함된 25개의 시간별 항목을 반환하고, 다른 기간은 빈 기간에 0 클릭으로 완전한 시계열을 반환합니다. 90일 이상의 기간에서는 데이터가 월별로 그룹화됩니다. 응답의 모든 날짜/시간 값은 지정된 시간대로 조정됩니다.

하드 제한: 날짜 범위는 다음에 의해 자동으로 제한됩니다: (1) 플랜 보존 한도, (2) 계정 생성 날짜, (3) 가장 오래된 링크 생성 날짜. 이러한 제한 이전의 데이터는 조회할 수 없습니다.

매개변수설명
period (선택 사항) 기간: 1d (1일), 1w (1주), 1m (1개월), 1y (1년) 또는 max (전체 기간). 기본값: 1m
timezone (선택 사항) 날짜 계산과 표시에 사용할 시간대(예: "America/New_York", "Europe/London", "Asia/Bangkok"). 지정하지 않으면 사용자의 기본 시간대를 사용하고, 그것도 없으면 UTC를 사용합니다. PHP 시간대 데이터베이스에 있는 유효한 시간대여야 합니다.
curl --location --request GET 'https://linktw.in/api/statistics/dashboard?period=1m&timezone=America%2FNew_York' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "period": "1w",
    "timezone": "Europe\/London"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://linktw.in/api/statistics/dashboard?period=1m&timezone=America%2FNew_York",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode(array(
      'period' => '1w',
      'timezone' => 'Europe/London',
    )),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://linktw.in/api/statistics/dashboard?period=1m&timezone=America%2FNew_York',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
    "period": "1w",
    "timezone": "Europe\/London"
}),
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "data": {
        "totalClicks": 15420,
        "totalUniqueClicks": 12340,
        "topReferrer": "Direct",
        "topReferrerClicks": 5234,
        "topCountry": "United States",
        "topCountryCode": "US",
        "topCountryClicks": 4521,
        "totalLinks": 156,
        "performanceGrowth": 12.5,
        "chartData": [
            {
                "date": "2025-06-14 10:00",
                "clicks": 45
            },
            {
                "date": "2025-06-14 11:00",
                "clicks": 62
            },
            {
                "date": "2025-06-14 12:00",
                "clicks": 89
            }
        ],
        "topPerformingLinks": [
            {
                "id": 123,
                "shortUrl": "http:\/\/linktwin.com\/abc123",
                "longUrl": "https:\/\/example.com\/my-product-landing-page",
                "title": "My Product Landing Page",
                "display_title": "Summer Campaign Link",
                "clicks": 1250,
                "uniqueClicks": 987
            }
        ]
    }
}
상세 통계
GET https://linktw.in/api/statistics/detailed?date_range=30d&collections=%5B1%2C3%5D&timezone=Europe%2FLondon

Get comprehensive statistics including KPIs (total clicks, unique clicks, top referrer, top country), dashboard metrics, plus detailed breakdowns by countries, referrers, browsers, devices, languages, cities, and day trends (hourly/daily click distribution). Breakdown lists return the top 9 items plus an "Other" category aggregating all remaining items (useful for pie charts). This endpoint combines both dashboard data and detailed analytics in a single response. Chart data format varies by period: 1d returns 25 hourly entries with partial hours at start/end, other periods return complete time series with 0 clicks for empty periods. For periods longer than 90 days, data is grouped by month. When using timezone parameter, date boundaries are calculated based on the specified timezone. You can filter results by one or more collections using their IDs or names.

Numbers match the website statistics page: bio page views are not counted as clicks (they are returned separately as bioViews), and referrers are grouped by source (e.g. "Instagram"), with clicks from your bio pages listed as "@alias" (type "bio"). allTimeClicks and allTimeUniqueClicks cover all time, not the date range.

Hard Restrictions: The date range is automatically limited by: (1) Plan retention limit, (2) Account creation date, (3) Oldest link creation date (or oldest link in filtered collections). You cannot query data before any of these limits.

클릭 필터: f_ 매개변수는 웹사이트 통계 페이지의 필터 버튼처럼 모든 수치를 일치하는 클릭으로 좁힙니다. 한 매개변수의 여러 값은 그중 하나라도 해당하면 포함되고, 여러 매개변수는 모두 일치해야 합니다. 필터가 적용된 동안 allTimeClicks와 allTimeUniqueClicks는 필터링할 수 없으므로 null입니다. filters는 사용된 필터를 반환합니다(필터가 없으면 {}). 필터가 적용된 요청이 너무 오래 걸리면 HTTP 503과 코드 filter_timeout으로 응답합니다. 더 짧은 기간을 선택하세요.

매개변수설명
date_range (optional) Date range: 1d (last 24 hours), 7d, 30d or 1y (that many days including today), max, or custom. Default: 30d
start_date (선택 사항) YYYY-MM-DD 또는 ISO 8601 형식의 시작 날짜 (date_range가 custom인 경우 필수)
end_date (선택 사항) YYYY-MM-DD 또는 ISO 8601 형식의 종료 날짜 (date_range가 custom인 경우 필수)
collection_id (선택 사항) 단일 컬렉션 ID로 통계 필터링 (하위 호환성을 위해)
collections (선택 사항) 하나 이상의 컬렉션 ID 또는 이름으로 통계를 필터링합니다. 단일 값, 쉼표로 구분된 문자열 또는 JSON 배열일 수 있습니다. 예: [1,2,3] 또는 ["Marketing","Social Media"]
timezone (선택 사항) 날짜 계산에 사용할 시간대(예: "America/New_York", "Europe/London", "Asia/Bangkok"). 지정하지 않으면 사용자의 기본 시간대를 사용하고, 그것도 없으면 UTC를 사용합니다. PHP 시간대 데이터베이스에 있는 유효한 시간대여야 합니다.
f_country[] (선택) 클릭 필터: 이 국가들의 클릭만, 값은 대시보드 통계 필터에 표시된 그대로. 여러 값은 매개변수를 반복하세요.
f_referrer[] (선택) 클릭 필터: 이 소스들의 클릭만, 값은 대시보드 통계 필터에 표시된 그대로(예: instagram.com, 리퍼러 없는 클릭은 direct).
f_os[] (선택) 클릭 필터: 이 운영 체제들의 클릭만.
f_browser[] (선택) 클릭 필터: 이 브라우저들의 클릭만.
f_language[] (선택) 클릭 필터: 이 브라우저 언어들의 클릭만(예: en).
curl --location --request GET 'https://linktw.in/api/statistics/detailed?date_range=30d&collections=%5B1%2C3%5D&timezone=Europe%2FLondon' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "date_range": "custom",
    "start_date": "2025-01-01",
    "end_date": "2025-06-14",
    "collections": [
        1,
        3
    ],
    "timezone": "America\/New_York"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://linktw.in/api/statistics/detailed?date_range=30d&collections=%5B1%2C3%5D&timezone=Europe%2FLondon",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode(array(
      'date_range' => 'custom',
      'start_date' => '2025-01-01',
      'end_date' => '2025-06-14',
      'collections' => 
  array(
        0 => 1,
        1 => 3,
      ),
      'timezone' => 'America/New_York',
    )),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://linktw.in/api/statistics/detailed?date_range=30d&collections=%5B1%2C3%5D&timezone=Europe%2FLondon',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
    "date_range": "custom",
    "start_date": "2025-01-01",
    "end_date": "2025-06-14",
    "collections": [
        1,
        3
    ],
    "timezone": "America\/New_York"
}),
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "data": {
        "totalClicks": 15420,
        "totalUniqueClicks": 12340,
        "topReferrer": "Direct",
        "topReferrerClicks": 5234,
        "topCountry": "United States",
        "topCountryCode": "US",
        "topCountryClicks": 4521,
        "allTimeClicks": 98210,
        "allTimeUniqueClicks": 70412,
        "bioViews": 2310,
        "totalLinks": 156,
        "performanceGrowth": 12.5,
        "chartData": [
            {
                "date": "2025-01-01",
                "clicks": 342
            },
            {
                "date": "2025-01-02",
                "clicks": 421
            },
            "\/\/ ... continues for all days in range ..."
        ],
        "topPerformingLinks": [
            {
                "id": 123,
                "shortUrl": "linktwin.com\/abc123",
                "longUrl": "https:\/\/example.com\/product-page",
                "title": "Product Landing Page",
                "display_title": "Q1 Promo Link",
                "clicks": 3542,
                "uniqueClicks": 2987
            },
            "\/\/ ... up to 5 top performing links ..."
        ],
        "topCountries": [
            {
                "country": "United States",
                "countryCode": "US",
                "count": 5423
            },
            {
                "country": "Canada",
                "countryCode": "CA",
                "count": 2341
            },
            "\/\/ ... up to 9 countries ...",
            {
                "country": "Other",
                "countryCode": null,
                "count": 1245
            }
        ],
        "topReferrers": [
            {
                "domain": "Direct",
                "count": 4521,
                "label": "Direct traffic",
                "host": null,
                "icon": "https:\/\/linktwin.com\/static\/images\/direct.svg",
                "type": "direct"
            },
            {
                "domain": "Google",
                "count": 3201,
                "label": "Google",
                "host": "google.com",
                "icon": "https:\/\/linktwin.com\/static\/images\/google.svg",
                "type": "domain"
            },
            {
                "domain": "@mybio",
                "count": 1288,
                "label": "@mybio",
                "host": null,
                "icon": "https:\/\/linktwin.com\/static\/images\/bio-page.svg",
                "type": "bio"
            },
            "\/\/ ... up to 9 referrers ...",
            {
                "domain": "Other",
                "count": 892,
                "label": "Other",
                "host": null,
                "icon": null,
                "type": "other"
            }
        ],
        "topBrowsers": [
            {
                "browser": "Chrome",
                "count": 8923
            },
            {
                "browser": "Safari",
                "count": 3421
            },
            "\/\/ ... up to 9 browsers ...",
            {
                "browser": "Other",
                "count": 456
            }
        ],
        "topDevices": [
            {
                "os": "Windows 10",
                "count": 6234
            },
            {
                "os": "iOS",
                "count": 4521
            },
            "\/\/ ... up to 9 devices ...",
            {
                "os": "Other",
                "count": 321
            }
        ],
        "topLanguages": [
            {
                "language": "English",
                "languageCode": "en",
                "count": 10234
            },
            {
                "language": "Spanish",
                "languageCode": "es",
                "count": 2341
            },
            "\/\/ ... up to 9 languages ...",
            {
                "language": "Other",
                "languageCode": null,
                "count": 567
            }
        ],
        "topCities": [
            {
                "city": "New York",
                "country": "United States",
                "countryCode": "US",
                "count": 1523
            },
            {
                "city": "Los Angeles",
                "country": "United States",
                "countryCode": "US",
                "count": 1234
            },
            "\/\/ ... up to 9 cities ...",
            {
                "city": "Other",
                "country": null,
                "countryCode": null,
                "count": 789
            }
        ],
        "dayTrend": {
            "hourlyTrend": [
                {
                    "hour": 0,
                    "label": "00:00",
                    "clicks": 45,
                    "uniqueClicks": 32
                },
                {
                    "hour": 1,
                    "label": "01:00",
                    "clicks": 23,
                    "uniqueClicks": 18
                },
                "\/\/ ... data for all 24 hours ...",
                {
                    "hour": 23,
                    "label": "23:00",
                    "clicks": 67,
                    "uniqueClicks": 51
                }
            ],
            "dailyTrend": [
                {
                    "day": 0,
                    "label": "Sunday",
                    "clicks": 234,
                    "uniqueClicks": 189
                },
                {
                    "day": 1,
                    "label": "Monday",
                    "clicks": 456,
                    "uniqueClicks": 367
                },
                "\/\/ ... data for all 7 days ...",
                {
                    "day": 6,
                    "label": "Saturday",
                    "clicks": 345,
                    "uniqueClicks": 278
                }
            ],
            "summary": {
                "totalClicks": 2456,
                "totalUniqueClicks": 1987,
                "peakHour": {
                    "hour": 14,
                    "label": "14:00",
                    "clicks": 234,
                    "uniqueClicks": 189
                },
                "peakDay": {
                    "day": 3,
                    "label": "Wednesday",
                    "clicks": 567,
                    "uniqueClicks": 456
                },
                "timezone": "Europe\/London",
                "period": "30d",
                "from": "2025-01-01 00:00:00",
                "to": "2025-01-31 23:59:59"
            }
        },
        "filters": {
            "country": [
                "Germany"
            ],
            "referrer": [
                "instagram.com"
            ]
        }
    }
}
개별 링크 통계
GET https://linktw.in/api/statistics/link/:id?date_range=30d&timezone=Asia/Bangkok

특정 링크에 대한 상세 통계를 가져옵니다. 클릭 데이터, 지역 분포, 리퍼러, 기기, 브라우저, 언어, 도시, 일별 트렌드(시간별/일별 클릭 분포), 최근 활동(가장 최근 클릭 5개)이 포함됩니다. 링크 ID(예: 123) 또는 전체 단축 URL(예: https://linktw.in/abc123)을 전달할 수 있습니다. 차트 데이터 형식은 기간에 따라 다릅니다: 1d는 시작/끝에 부분 시간이 포함된 25개의 시간별 항목을 반환하고, 다른 기간은 빈 기간에 0 클릭으로 완전한 시계열을 반환합니다. 90일 이상의 기간에서는 데이터가 월별로 그룹화됩니다. 응답의 모든 날짜/시간 값은 지정된 시간대로 조정됩니다. 무료 플랜 사용자의 경우 응답에 missedClicks(플랜 한도를 초과한 총 클릭수)도 포함됩니다.

하드 제한: 날짜 범위는 다음에 의해 자동으로 제한됩니다: (1) 플랜 보존 한도, (2) 계정 생성 날짜, (3) 링크 생성 날짜. 이러한 제한 이전의 데이터는 조회할 수 없습니다.

클릭 필터: f_ 매개변수는 웹사이트 통계 페이지의 필터 버튼처럼 모든 수치를 일치하는 클릭으로 좁힙니다. 한 매개변수의 여러 값은 그중 하나라도 해당하면 포함되고, 여러 매개변수는 모두 일치해야 합니다. 필터가 적용된 동안 allTimeClicks와 allTimeUniqueClicks는 필터링할 수 없으므로 null입니다. filters는 사용된 필터를 반환합니다(필터가 없으면 {}). 필터가 적용된 요청이 너무 오래 걸리면 HTTP 503과 코드 filter_timeout으로 응답합니다. 더 짧은 기간을 선택하세요.

매개변수설명
date_range (required) Date range: 1d (last 24 hours), 7d, 30d or 1y (that many days including today), max, or custom
start_date (선택 사항) YYYY-MM-DD 또는 ISO 8601 형식의 시작 날짜 (date_range가 custom인 경우 필수)
end_date (선택 사항) YYYY-MM-DD 또는 ISO 8601 형식의 종료 날짜 (date_range가 custom인 경우 필수)
timezone (선택 사항) 날짜 계산과 표시에 사용할 시간대(예: "America/New_York", "Europe/London", "Asia/Bangkok"). 지정하지 않으면 사용자의 기본 시간대를 사용하고, 그것도 없으면 UTC를 사용합니다. PHP 시간대 데이터베이스에 있는 유효한 시간대여야 합니다.
f_country[] (선택) 클릭 필터: 이 국가들의 클릭만, 값은 대시보드 통계 필터에 표시된 그대로. 여러 값은 매개변수를 반복하세요.
f_referrer[] (선택) 클릭 필터: 이 소스들의 클릭만, 값은 대시보드 통계 필터에 표시된 그대로(예: instagram.com, 리퍼러 없는 클릭은 direct).
f_os[] (선택) 클릭 필터: 이 운영 체제들의 클릭만.
f_browser[] (선택) 클릭 필터: 이 브라우저들의 클릭만.
f_language[] (선택) 클릭 필터: 이 브라우저 언어들의 클릭만(예: en).
curl --location --request GET 'https://linktw.in/api/statistics/link/:id?date_range=30d&timezone=Asia/Bangkok' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "date_range": "1d",
    "timezone": "Asia\/Bangkok"
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://linktw.in/api/statistics/link/:id?date_range=30d&timezone=Asia/Bangkok",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode(array(
      'date_range' => '1d',
      'timezone' => 'Asia/Bangkok',
    )),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://linktw.in/api/statistics/link/:id?date_range=30d&timezone=Asia/Bangkok',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
    "date_range": "1d",
    "timezone": "Asia\/Bangkok"
}),
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "data": {
        "link": {
            "id": 180,
            "shortUrl": "linktwin.com\/abc123",
            "longUrl": "https:\/\/example.com\/product-page",
            "title": "Product Landing Page",
            "display_title": "Main Product Link",
            "absoluteClicks": 5234,
            "createdAt": "2024-12-01 10:30:00"
        },
        "totalClicks": 523,
        "totalUniqueClicks": 421,
        "topReferrer": "google.com",
        "topReferrerClicks": 156,
        "topCountry": "United States",
        "topCountryCode": "US",
        "topCountryClicks": 234,
        "performanceGrowth": 15.4,
        "missedClicks": 42,
        "chartData": [
            {
                "date": "2025-05-15",
                "clicks": 23
            },
            {
                "date": "2025-05-16",
                "clicks": 18
            },
            {
                "date": "2025-05-17",
                "clicks": 0
            },
            "\/\/ ... all days in the range included, even with 0 clicks ..."
        ],
        "topCountries": [
            {
                "country": "United States",
                "countryCode": "US",
                "count": 234
            },
            {
                "country": "Canada",
                "countryCode": "CA",
                "count": 89
            },
            "\/\/ ... up to 9 countries ...",
            {
                "country": "Other",
                "countryCode": null,
                "count": 45
            }
        ],
        "topReferrers": [
            {
                "domain": "Google",
                "count": 156,
                "label": "Google",
                "host": "google.com",
                "icon": "https:\/\/linktwin.com\/static\/images\/google.svg",
                "type": "domain"
            },
            {
                "domain": "@mybio",
                "count": 98,
                "label": "@mybio",
                "host": null,
                "icon": "https:\/\/linktwin.com\/static\/images\/bio-page.svg",
                "type": "bio"
            },
            "\/\/ ... up to 9 referrers ...",
            {
                "domain": "Other",
                "count": 32,
                "label": "Other",
                "host": null,
                "icon": null,
                "type": "other"
            }
        ],
        "topBrowsers": [
            {
                "browser": "Chrome",
                "count": 312
            },
            {
                "browser": "Safari",
                "count": 134
            },
            "\/\/ ... up to 9 browsers ...",
            {
                "browser": "Other",
                "count": 21
            }
        ],
        "topDevices": [
            {
                "os": "iOS",
                "count": 234
            },
            {
                "os": "Android",
                "count": 189
            },
            "\/\/ ... up to 9 devices ...",
            {
                "os": "Other",
                "count": 15
            }
        ],
        "topLanguages": [
            {
                "language": "English",
                "languageCode": "en",
                "count": 423
            },
            {
                "language": "French",
                "languageCode": "fr",
                "count": 67
            },
            "\/\/ ... up to 9 languages ...",
            {
                "language": "Other",
                "languageCode": null,
                "count": 18
            }
        ],
        "topCities": [
            {
                "city": "New York",
                "country": "United States",
                "countryCode": "US",
                "count": 89
            },
            {
                "city": "London",
                "country": "United Kingdom",
                "countryCode": "GB",
                "count": 67
            },
            "\/\/ ... up to 9 cities ...",
            {
                "city": "Other",
                "country": null,
                "countryCode": null,
                "count": 28
            }
        ],
        "dayTrend": {
            "hourlyTrend": [
                {
                    "hour": 0,
                    "label": "00:00",
                    "clicks": 12,
                    "uniqueClicks": 9
                },
                {
                    "hour": 1,
                    "label": "01:00",
                    "clicks": 8,
                    "uniqueClicks": 6
                },
                "\/\/ ... data for all 24 hours ...",
                {
                    "hour": 23,
                    "label": "23:00",
                    "clicks": 15,
                    "uniqueClicks": 11
                }
            ],
            "dailyTrend": [
                {
                    "day": 0,
                    "label": "Sunday",
                    "clicks": 67,
                    "uniqueClicks": 52
                },
                {
                    "day": 1,
                    "label": "Monday",
                    "clicks": 89,
                    "uniqueClicks": 71
                },
                "\/\/ ... data for all 7 days ...",
                {
                    "day": 6,
                    "label": "Saturday",
                    "clicks": 78,
                    "uniqueClicks": 61
                }
            ],
            "summary": {
                "totalClicks": 523,
                "totalUniqueClicks": 421,
                "peakHour": {
                    "hour": 14,
                    "label": "14:00",
                    "clicks": 45,
                    "uniqueClicks": 36
                },
                "peakDay": {
                    "day": 2,
                    "label": "Tuesday",
                    "clicks": 112,
                    "uniqueClicks": 89
                },
                "timezone": "Asia\/Bangkok",
                "period": "30d",
                "from": "2025-04-15 00:00:00",
                "to": "2025-05-15 23:59:59"
            }
        },
        "recentActivity": [
            {
                "date": "2025-05-15 14:32:18",
                "country": "United States",
                "countryCode": "US",
                "city": "New York",
                "os": "iOS",
                "browser": "Safari",
                "referrer": "https:\/\/facebook.com\/post\/123",
                "referrerDomain": "facebook.com",
                "language": "English",
                "languageCode": "en",
                "missedClick": false
            },
            {
                "date": "2025-05-15 13:21:05",
                "country": "Germany",
                "countryCode": "DE",
                "city": "Berlin",
                "os": "Windows",
                "browser": "Chrome",
                "referrer": null,
                "referrerDomain": null,
                "language": "German",
                "languageCode": "de",
                "missedClick": false
            },
            "\/\/ ... up to 5 recent clicks ..."
        ]
    }
}
일별 트렌드 - 시간별 및 일별 클릭 분포
GET https://linktw.in/api/statistics/daytrend?timezone=America%2FNew_York

최고 활동 시간을 파악하기 위한 시간별 및 일별 클릭 분포를 가져옵니다. 이 endpoint는 하루 중(시간별) 및 주 중(요일별) 사용자가 가장 활발한 시간을 보여주어 콘텐츠 예약 및 마케팅 캠페인을 최적화하는 데 도움이 됩니다. 각 시간(0-23) 및 요일(일요일-토요일)의 클릭 데이터를 반환합니다.

하드 제한: 날짜 범위는 다음에 의해 자동으로 제한됩니다: (1) 플랜 보존 한도, (2) 계정 생성 날짜, (3) 가장 오래된 링크 생성 날짜. 이러한 제한 이전의 데이터는 조회할 수 없습니다.

매개변수설명
period (선택 사항) 통계 기간. 옵션: "1d" (24시간), "7d" 또는 "1w" (7일), "30d" 또는 "1m" (30일, 기본값), "1y" (365일), "max" (전체 기간), "custom" (start_date 및 end_date 필요)
start_date (선택 사항) 커스텀 기간의 시작 날짜 (Y-m-d 형식, 예: "2025-01-01"). 기간이 "custom"인 경우 필수
end_date (선택 사항) 커스텀 기간의 종료 날짜 (Y-m-d 형식, 예: "2025-01-31"). 기간이 "custom"인 경우 필수
timezone (선택 사항) 시간대별 계산에 사용할 시간대(예: "America/New_York", "Europe/London", "Asia/Bangkok"). 지정하지 않으면 사용자의 기본 시간대를 사용하고, 그것도 없으면 UTC를 사용합니다. PHP 시간대 데이터베이스에 있는 유효한 시간대여야 합니다.
collection_id (선택 사항) 단일 컬렉션 ID로 통계 필터링 (하위 호환성을 위해)
collections (선택 사항) 하나 이상의 컬렉션 ID 또는 이름으로 통계를 필터링합니다. 단일 값, 쉼표로 구분된 문자열 또는 JSON 배열일 수 있습니다. 예: [1,2,3] 또는 ["Marketing","Social Media"]
curl --location --request GET 'https://linktw.in/api/statistics/daytrend?timezone=America%2FNew_York' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "period": "30d",
    "timezone": "Europe\/Berlin",
    "collections": [
        "Marketing",
        "Social Media"
    ]
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://linktw.in/api/statistics/daytrend?timezone=America%2FNew_York",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode(array(
      'period' => '30d',
      'timezone' => 'Europe/Berlin',
      'collections' => 
  array(
        0 => 'Marketing',
        1 => 'Social Media',
      ),
    )),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://linktw.in/api/statistics/daytrend?timezone=America%2FNew_York',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
    "period": "30d",
    "timezone": "Europe\/Berlin",
    "collections": [
        "Marketing",
        "Social Media"
    ]
}),
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "data": {
        "hourlyTrend": [
            {
                "hour": 0,
                "label": "00:00",
                "clicks": 145,
                "uniqueClicks": 98
            },
            {
                "hour": 1,
                "label": "01:00",
                "clicks": 87,
                "uniqueClicks": 54
            },
            "\/\/ ... data for all 24 hours ...",
            {
                "hour": 23,
                "label": "23:00",
                "clicks": 234,
                "uniqueClicks": 156
            }
        ],
        "dailyTrend": [
            {
                "day": 0,
                "label": "Sunday",
                "clicks": 1234,
                "uniqueClicks": 890
            },
            {
                "day": 1,
                "label": "Monday",
                "clicks": 1567,
                "uniqueClicks": 1123
            },
            "\/\/ ... data for all 7 days ...",
            {
                "day": 6,
                "label": "Saturday",
                "clicks": 1345,
                "uniqueClicks": 967
            }
        ],
        "summary": {
            "totalClicks": 12043,
            "totalUniqueClicks": 8765,
            "peakHour": {
                "hour": 15,
                "label": "15:00",
                "clicks": 1043,
                "uniqueClicks": 789
            },
            "peakDay": {
                "day": 3,
                "label": "Wednesday",
                "clicks": 2156,
                "uniqueClicks": 1567
            },
            "timezone": "Europe\/Berlin",
            "period": "30d",
            "from": "2025-01-01 00:00:00",
            "to": "2025-01-31 23:59:59"
        }
    }
}

웹훅

이벤트가 발생하는 즉시 받아 보세요. LinkTwin은 구독한 이벤트마다 서명된 JSON POST 요청을 내 주소로 보냅니다. 이 엔드포인트(Zapier와 Make처럼 REST 훅)나 대시보드의 웹훅 페이지에서 구독하고 해지하세요.

모든 요청에는 X-LinkTwin-Event, X-LinkTwin-Delivery, X-LinkTwin-Signature 헤더가 있습니다 (t=timestamp,v1=signature, 서명 시크릿을 키로 타임스탬프, 점, 원본 본문을 HMAC-SHA256으로 계산한 값). 이벤트 id로 중복을 걸러 내세요. 실패한 전송은 최대 하루 동안 다시 시도하며, 계속 실패하는 웹훅은 꺼집니다.

API 키: 같은 페이지에서 여러 키를 만들 수 있으며 각각 전체 권한 또는 읽기 전용으로 설정합니다. 읽기 전용 키는 GET 이외의 모든 요청에 403으로 응답합니다. 원래 키는 기본 키로 계속 작동합니다.

웹훅 목록
GET https://linktw.in/api/webhooks

계정의 웹훅 목록입니다. 서명 시크릿은 표시되지 않습니다.

curl --location --request GET 'https://linktw.in/api/webhooks' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

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

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://linktw.in/api/webhooks',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "data": {
        "result": 1,
        "limit": 25,
        "webhooks": [
            {
                "id": 5,
                "name": "Zapier",
                "url": "https:\/\/hooks.zapier.com\/hooks\/standard\/123\/abc",
                "events": [
                    "link.clicked"
                ],
                "filters": {
                    "collection_ids": [
                        7
                    ]
                },
                "status": "active",
                "source": "api",
                "failures": 0,
                "disabled_reason": null,
                "disabled_at": null,
                "last_delivery_at": "2026-11-12T10:15:02+00:00",
                "last_status": 200,
                "created_at": "2026-11-12T09:00:00+00:00"
            }
        ]
    }
}
웹훅 구독
POST https://linktw.in/api/webhooks

웹훅을 만듭니다. 응답에 서명 시크릿이 한 번만 포함되니 X-LinkTwin-Signature 헤더 확인용으로 보관하세요.

매개변수설명
url (필수) 이벤트를 받는 https 주소
events (필수) 이벤트 목록, 예: ["link.clicked"]. 이벤트 목록을 참고하세요.
name (선택) 웹훅을 구분할 이름
filters (선택) {"link_ids": [...], "collection_ids": [...]}: 이 링크만, 또는 이 컬렉션의 링크만
curl --location --request POST 'https://linktw.in/api/webhooks' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https:\/\/example.com\/linktwin-hook",
    "events": [
        "link.created",
        "link.clicked"
    ],
    "name": "My server",
    "filters": {
        "collection_ids": [
            7
        ]
    }
}'
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://linktw.in/api/webhooks",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode(array(
      'url' => 'https://example.com/linktwin-hook',
      'events' => 
  array(
        0 => 'link.created',
        1 => 'link.clicked',
      ),
      'name' => 'My server',
      'filters' => 
  array(
        'collection_ids' => 
    array(
          0 => 7,
        ),
      ),
    )),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://linktw.in/api/webhooks',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
    "url": "https:\/\/example.com\/linktwin-hook",
    "events": [
        "link.created",
        "link.clicked"
    ],
    "name": "My server",
    "filters": {
        "collection_ids": [
            7
        ]
    }
}),
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "data": {
        "id": 6,
        "name": "My server",
        "url": "https:\/\/example.com\/linktwin-hook",
        "events": [
            "link.created",
            "link.clicked"
        ],
        "filters": {
            "collection_ids": [
                7
            ]
        },
        "status": "active",
        "source": "api",
        "created_at": "2026-11-12T09:00:00+00:00",
        "secret": "whsec_3f9a..."
    }
}
웹훅 조회
GET https://linktw.in/api/webhooks/:id

웹훅 하나를 조회합니다.

curl --location --request GET 'https://linktw.in/api/webhooks/:id' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

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

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://linktw.in/api/webhooks/:id',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
null
웹훅 삭제
DELETE https://linktw.in/api/webhooks/:id

웹훅을 삭제합니다(구독 해지). 전송 기록도 함께 삭제됩니다.

curl --location --request DELETE 'https://linktw.in/api/webhooks/:id' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

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

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'DELETE',
    'url': 'https://linktw.in/api/webhooks/:id',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "message": "Webhook deleted."
}
테스트 이벤트 보내기
POST https://linktw.in/api/webhooks/:id/test

웹훅의 첫 번째 이벤트 예시를 "test": true로 표시해 지금 주소로 보내고 상태 코드와 응답 시간을 받습니다.

curl --location --request POST 'https://linktw.in/api/webhooks/:id/test' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

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

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://linktw.in/api/webhooks/:id/test',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "data": {
        "delivered": true,
        "status": 200,
        "duration_ms": 182
    },
    "message": "HTTP 200 in 182 ms"
}
이벤트 목록
GET https://linktw.in/api/webhooks/events

구독할 수 있는 모든 이벤트와 데이터 예시: link.created, link.clicked (QR 코드 스캔은 "qr": true), email.captured (바이오 페이지에 남긴 이메일).

curl --location --request GET 'https://linktw.in/api/webhooks/events' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

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

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://linktw.in/api/webhooks/events',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "data": {
        "events": [
            {
                "event": "link.clicked",
                "name": "New click",
                "description": "Someone clicks a link or scans a QR code.",
                "sample": {
                    "link_id": 123,
                    "alias": "spring-sale",
                    "short_url": "https:\/\/linktw.in\/spring-sale",
                    "url": "https:\/\/example.com\/spring-sale",
                    "collections": [
                        7
                    ],
                    "country": "United States",
                    "city": "Austin",
                    "device": "iOS",
                    "browser": "Safari",
                    "referrer": "https:\/\/www.instagram.com\/",
                    "language": "en",
                    "qr": false,
                    "qr_id": null,
                    "bio_id": null,
                    "clicked_at": "2026-11-12T10:15:00+00:00"
                }
            }
        ]
    }
}
최근 이벤트
GET https://linktw.in/api/webhooks/events/link.clicked/recent

한 종류의 최근 이벤트를 최신순으로, 보낸 그대로 보여 줍니다. 아직 아무 일도 없으면 최근 링크로 만든 예시나 일반 예시("sample": true)를 받습니다. Zapier와 Make는 이를 샘플 데이터로 보여 줍니다.

매개변수설명
:event (필수) 이벤트, 예: link.clicked
limit (선택) 개수, 1에서 25 (기본값 3)
curl --location --request GET 'https://linktw.in/api/webhooks/events/link.clicked/recent' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://linktw.in/api/webhooks/events/link.clicked/recent",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_MAXREDIRS => 2,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOURAPIKEY",
        "Content-Type: application/json",
    ],
    
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://linktw.in/api/webhooks/events/link.clicked/recent',
    'headers': {
        'Authorization': 'Bearer YOURAPIKEY',
        'Content-Type': 'application/json'
    },
    
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
서버 응답
{
    "error": 0,
    "data": {
        "event": "link.clicked",
        "sample": false,
        "events": [
            {
                "id": "evt_9812",
                "event": "link.clicked",
                "created_at": "2026-11-12T10:15:00+00:00",
                "account_id": 42,
                "test": false,
                "data": {
                    "link_id": 123,
                    "short_url": "https:\/\/linktw.in\/spring-sale",
                    "country": "United States",
                    "device": "iOS"
                }
            }
        ]
    }
}