시스템에서 요청을 처리하려면 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"}
]
https://linktw.in/api/urls?limit=2&page=1&order=date&collections=%5B1%2C2%5D
API로 링크를 가져오려면 이 엔드포인트를 사용하세요. 데이터를 필터링할 수도 있습니다(표 참고). 요금제에 클릭 한도가 있으면 응답에 현재 클릭 수, 한도, 결제 기간 초기화까지 남은 일수가 담긴 usage 객체가 포함됩니다. 무제한 요금제에서는 이 필드가 생략됩니다.
놓친 클릭: 링크별 missedclicks 필드와 usage 객체의 missed_clicks는 클릭 한도가 있는 무료 요금제 사용자에게만 반환됩니다.
링크 상태: status는 active(활성), upgrade_required(무료 요금제, 승인 목록에 없는 대상), needs_domain(제한된 콘텐츠, 자체 도메인에서만 작동), verify_email(계정 이메일 미확인) 또는 disabled입니다. statuses는 링크가 활성 상태가 아닌 모든 이유를 나열합니다. restriction은 상태가 needs_domain일 때만 값이 있으며, 이유(reason: adult, gambling, high_risk, restricted_domain)와 취할 수 있는 조치를 알려줍니다. type은 저장된 리디렉션 방식(direct, frame, splash, overlay-…)이며 설정되지 않으면 null입니다.
배지: features는 링크에 적용되는 대시보드 배지를 나열하고, expires_at은 만료일(Y-m-d) 또는 null, kind는 링크 유형입니다. 단일 링크, 생성·수정된 링크에도 같은 필드가 포함됩니다.
| 매개변수 | 설명 |
|---|---|
| limit | (선택 사항) 페이지당 결과 수 |
| page | (선택 사항) 현재 페이지 요청 |
| order | (선택 사항) 데이터 정렬: date, date_desc, date_asc, clicks_desc, clicks_asc, name_asc, name_desc |
| search | (선택 사항) 별칭, 커스텀 별칭, URL, 메타 제목, 커스텀 제목 또는 설명으로 링크를 검색합니다. 도메인 별칭 확장을 지원합니다 (예: "youtube"는 youtube.com과 youtu.be에 매칭됩니다) |
| date_from | (선택 사항) 시작 날짜로 필터링 (Y-m-d 또는 ISO 8601 형식, 예: 2025-01-01 또는 2025-01-01T00:00:00.000Z) |
| date_to | (선택 사항) 종료 날짜로 필터링 (Y-m-d 또는 ISO 8601 형식, 예: 2025-01-31 또는 2025-01-31T23:59:59.999Z) |
| collections | (선택 사항) 링크를 필터링할 컬렉션 ID 또는 이름의 배열입니다. ID만 또는 이름만 사용하며, 혼합하지 마세요. 예: [1,2,3] 또는 ["Marketing","Social Media"] |
| tags | (선택) 링크를 필터링할 태그 이름 또는 ID. 쉼표로 구분하거나 배열로 보냅니다. 예: promo,summer 또는 [4,7] |
| tags_mode | (선택) any(기본값): 태그 중 하나 이상이 있는 링크. all: 모든 태그가 있는 링크. |
| timezone | (선택 사항) 응답의 날짜 필드에 사용할 시간대 (예: America/New_York, Europe/London). 계정 시간대 설정을 재정의합니다. 지정하지 않으면 기본값은 UTC입니다. |
curl --location --request GET 'https://linktw.in/api/urls?limit=2&page=1&order=date&collections=%5B1%2C2%5D' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls?limit=2&page=1&order=date&collections=%5B1%2C2%5D",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/urls?limit=2&page=1&order=date&collections=%5B1%2C2%5D',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": "0",
"data": {
"result": 2,
"perpage": 2,
"currentpage": 1,
"nextpage": 1,
"maxpage": 1,
"urls": [
{
"id": 2,
"alias": "google",
"shorturl": "https:\/\/linktw.in\/google",
"longurl": "https:\/\/google.com",
"clicks": 0,
"uniqueclicks": 0,
"title": "Google",
"description": "",
"display_title": "My Dashboard Title",
"custom_title": "My Custom Google Title",
"custom_description": "This is my custom description for Google",
"metaimage": "https:\/\/linktw.in\/content\/images\/AbCdEf_ai_GhIjKl.jpg",
"custom_preview": true,
"type": "direct",
"status": "active",
"restriction": null,
"kind": "music",
"features": [
"geo",
"password",
"expiry"
],
"expires_at": "2026-12-31",
"collections": [
{
"id": 1,
"name": "Marketing",
"description": "All marketing campaign links",
"color": "#1E88E5"
},
{
"id": 3,
"name": "Social Media",
"description": "Social media platform links",
"color": "#43A047"
}
],
"tags": [
{
"id": 4,
"name": "promo",
"color": "#0967f2"
}
],
"pixels": [
{
"id": 1,
"type": "gtmpixel",
"name": "GTM Pixel",
"tag": "GTM-XXXXX"
},
{
"id": 2,
"type": "fbpixel",
"name": "Facebook Pixel",
"tag": "1234567890"
}
],
"date": "2023-11-10 18:01:43"
},
{
"id": 1,
"alias": "googlecanada",
"shorturl": "https:\/\/linktw.in\/googlecanada",
"longurl": "https:\/\/google.ca",
"clicks": 0,
"uniqueclicks": 0,
"title": "Google Canada",
"description": "",
"display_title": null,
"custom_title": null,
"custom_description": null,
"metaimage": null,
"custom_preview": false,
"type": null,
"status": "needs_domain",
"restriction": null,
"collections": [],
"tags": [],
"pixels": [],
"date": "2023-11-10 18:00:25"
}
],
"usage": {
"clicks": 1250,
"clicks_limit": 50000,
"clicks_reset_days": 22
}
}
}
https://linktw.in/api/url/:id
API로 단일 링크의 세부 정보를 가져오려면 이 엔드포인트를 사용하세요. 링크 ID 또는 전체 단축 URL을 전달할 수 있습니다.kind는 클릭 시 링크가 하는 일, 즉 대시보드에 표시되는 유형입니다: music, podcast, store, sms, email, phone, whatsapp, deeplink 또는 direct. type은 저장된 리디렉션 방식(direct, frame, splash, overlay-…)이며 설정되지 않으면 null입니다. music과 store는 Smart Music Link 및 App Store Link 설정을 보여주며, available은 링크가 이를 사용할 수 있는지 나타냅니다(Update Link 참고). page_image는 대상에서 가져온 이미지(og:image 또는 YouTube 썸네일)로, 링크에 자체 이미지가 없을 때 미리보기에 표시되는 웹사이트의 "페이지 이미지"입니다(찾지 못하면 null). metaimage는 링크 자체의 미리보기 이미지입니다(소셜 미리보기가 꺼져 있거나 이미지가 없으면 null). "이미지 없음"을 선택하면 preview_image_none이 true입니다. music.cover는 음악 페이지에 표시되는 커버(업로드한 이미지, 없으면 플랫폼에서 가져온 아트워크)이고, music.cover_custom은 링크에 커버가 설정되어 있는지 나타냅니다(Upload a Link Cover 참고). music.fetched_title / music.fetched_artist는 플랫폼에서 가져온 제목과 아티스트이고, music.title / music.artist는 직접 설정한 값입니다(null = 가져온 값 표시, Update Link에서 null을 보내면 되돌아감). param_forwarding은 링크 자체의 매개변수 전달 설정({mode, names, tracking})이며 계정 설정을 따르면 null입니다. stock_monitor는 Amazon Stock Monitor 설정을 보여줍니다. 요금제에 Stock Monitor가 포함되고 계정 스위치가 켜져 있으면 Amazon 상품 링크의 available이 true이며, 그렇지 않으면 다른 필드는 비어 있습니다(null / 0). monitored는 현재 링크가 확인되고 있는지, last_checked는 마지막 확인 시각, used / cap은 요금제 한도 중 계정이 모니터링하는 상품 수입니다. action과 suppressed_oos는 적용 중인 값(링크 자체 값, 없으면 계정 값)이고, account는 계정 기본값을 담으며, account.enroll_mode가 manual이면 모니터가 켜진 링크만 모니터링됩니다.
링크 상태: status는 active(활성), upgrade_required(무료 요금제, 승인 목록에 없는 대상), needs_domain(제한된 콘텐츠, 자체 도메인에서만 작동), verify_email(계정 이메일 미확인) 또는 disabled입니다. statuses는 링크가 활성 상태가 아닌 모든 이유를 나열합니다. restriction은 상태가 needs_domain일 때만 값이 있으며, 이유(reason: adult, gambling, high_risk, restricted_domain)와 취할 수 있는 조치를 알려줍니다.
| 매개변수 | 설명 |
|---|---|
| :id | (필수) 링크 ID (예: 123) 또는 전체 단축 URL (예: https://linktw.in/abc123) |
| timezone | (선택 사항) 응답의 날짜 필드에 사용할 시간대 (예: America/New_York, Europe/London). 계정 시간대 설정을 재정의합니다. 지정하지 않으면 기본값은 UTC입니다. |
curl --location --request GET 'https://linktw.in/api/url/:id' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/url/:id',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 1,
"details": {
"id": 1,
"alias": "googlecanada",
"shorturl": "https:\/\/linktw.in\/googlecanada",
"longurl": "https:\/\/google.com",
"domain": "https:\/\/linktw.in",
"title": "Google",
"description": "",
"display_title": "My Dashboard Title",
"custom_title": "My Custom Title",
"custom_description": "My Custom Description",
"note": "Internal note for this link",
"pass": false,
"location": {
"canada": {
"all": "https:\/\/google.ca"
},
"united states": {
"CA": "https:\/\/google.us\/california",
"NY": "https:\/\/google.us\/newyork",
"all": "https:\/\/google.us"
}
},
"device": {
"iphone": "https:\/\/google.com",
"android": "https:\/\/google.com"
},
"languagetarget": {
"en": "https:\/\/google.com",
"fr": "https:\/\/google.ca"
},
"utmtarget": [
{
"param": "utm_source",
"value": "facebook",
"link": "https:\/\/example.com\/facebook-offer"
}
],
"parameters": {
"utm_source": "api",
"utm_medium": "link"
},
"expiry": "2025-12-31 23:59:59",
"clicklimit": 1000,
"expirationredirect": "https:\/\/example.com\/expired",
"abtesting": [
{
"percent": 50,
"link": "https:\/\/variant-a.com",
"count": 125
},
{
"percent": 50,
"link": "https:\/\/variant-b.com",
"count": 130
}
],
"metaimage": "https:\/\/linktw.in\/content\/images\/AbCdEf_ai_GhIjKl.jpg",
"date": "2023-11-10 18:01:43",
"kind": "deeplink",
"type": "direct",
"custom_preview": true,
"page_image": "https:\/\/www.google.com\/og-image.png",
"preview_image_none": false,
"param_forwarding": null,
"stock_monitor": {
"available": false,
"monitored": false,
"monitor": "auto",
"action": null,
"alternatives": [],
"suppressed_oos": null,
"last_checked": null,
"used": 0,
"cap": 0,
"account": null
},
"music": {
"available": false,
"enabled": false,
"services": [],
"auto_open": null,
"title": null,
"artist": null,
"style": "list",
"cover": null,
"cover_custom": false,
"fetched_title": null,
"fetched_artist": null
},
"store": {
"available": false,
"enabled": false,
"ios": null,
"android": null,
"huawei": null,
"mac": null,
"windows": null,
"chrome": null,
"fallback": null
},
"status": "active",
"restriction": null,
"features": [
"geo",
"password",
"expiry"
],
"expires_at": "2026-12-31",
"collections": [
{
"id": 1,
"name": "Marketing",
"description": "All marketing campaign links",
"color": "#FF6B6B"
},
{
"id": 3,
"name": "Social Media",
"description": "Social media platform links",
"color": "#4ECDC4"
}
],
"tags": [
{
"id": 4,
"name": "promo",
"color": "#0967f2"
}
],
"pixels": [
{
"id": 1,
"type": "gtmpixel",
"name": "GTM Pixel",
"tag": "GTM-ABCDE"
},
{
"id": 2,
"type": "fbpixel",
"name": "Facebook Pixel",
"tag": "123456789012345"
}
]
},
"data": {
"clicks": 0,
"uniqueClicks": 0,
"missedClicks": 0,
"topCountries": 0,
"topReferrers": 0,
"topBrowsers": 0,
"topOs": 0,
"socialCount": {
"facebook": 0,
"twitter": 0,
"google": 0
}
}
}
https://linktw.in/api/url/add
To create a link, send your data as JSON (raw body, Content-Type: application/json) or as multipart/form-data (required when uploading an image file directly). The example below shows all available parameters — only url is required.
Restricted destinations: a link to a restricted destination (e.g. adult content platforms) on a shared domain fails with error_code: restricted_domain, plus offer (move, add or upgrade) and domains (your branded domains): use one of them as domain.
| 매개변수 | 설명 |
|---|---|
| url | (필수) 단축할 긴 URL입니다. |
| custom | (선택 사항) 랜덤 별칭 대신 사용할 커스텀 별칭입니다. |
| password | (선택 사항) 비밀번호 보호 |
| domain | (선택 사항) 커스텀 도메인 (이미 추가된 브랜드 도메인과 일치해야 함) |
| expiry | (선택 사항) 링크 만료 날짜, 예: 2024-09-28 23:11:16 |
| clicklimit | (선택 사항) 링크 만료 전 최대 클릭 수 (정수) |
| expirationredirect | (선택 사항) 링크 만료 후 리디렉션할 URL (날짜 또는 클릭 한도 기준) |
| note | (선택 사항) 이 링크에 대한 내부 메모/설명 (방문자에게 표시되지 않음) |
| display_title | (선택 사항) 대시보드에서 이 링크를 구성하기 위한 커스텀 제목입니다. 참조용이며 og:title이나 링크 미리보기에 영향을 주지 않습니다. |
| geotarget | (선택 사항) 지역 타겟팅 데이터입니다. location, link, 선택적 state 필드를 가진 객체의 배열입니다. location은 국가 전체 이름이어야 합니다 (예: "United States", "Canada"). 선택적 state 필드를 통해 국가 내 특정 주/지역을 타겟팅할 수 있습니다 (예: "California"). 전체 국가 및 주 목록 보기. |
| devicetarget | (선택 사항) 기기 타겟팅 데이터입니다. device와 link 필드를 가진 객체의 배열입니다. |
| languagetarget | (선택 사항) 언어 타겟팅 데이터입니다. language와 link 필드를 가진 객체의 배열입니다. |
| utmtarget | (optional) UTM targeting data. Array of objects with param, value and link fields, checked in order: the first rule whose query parameter matches wins. |
| abtesting | (선택 사항) A/B 테스트 변형입니다. link와 선택적 percent 필드를 가진 객체의 배열입니다. |
| parameters | (선택 사항) 추가할 URL 파라미터입니다. name과 value 필드를 가진 객체의 배열입니다. |
| metatitle | (선택 사항) 메타 제목 |
| metadescription | (선택 사항) 메타 설명 |
| metaimage | (선택 사항) 소셜 공유 미리보기 이미지(og:image). 두 가지 형식을 지원합니다. (1) JSON: .jpg, .jpeg 또는 .png로 끝나는 공개 URL을 입력하세요(예: "metaimage": "https://example.com/image.jpg"). (2) 파일 업로드: 요청을 multipart/form-data로 보내고 metaimage라는 필드에 이미지 파일을 넣으세요. 두 형식 모두 JPG/JPEG 또는 PNG, 최대 1MB여야 합니다. |
| custompreview | (optional) Set to true to turn on the Social Media Preview switch without sending any custom title, description or image. The preview then uses the destination page's own title, description and image. Sending metatitle, metadescription or metaimage turns it on automatically. |
| pixels | (선택 사항) 링크에 연결할 pixel ID 또는 이름의 배열입니다. ID만 또는 이름만 사용하며, 혼합하지 마세요. |
| collections | (선택 사항) 링크를 추가할 컬렉션 ID 또는 이름의 배열입니다. ID만 또는 이름만 사용하며, 혼합하지 마세요. |
| tags | (선택) 링크의 태그: 태그 이름 또는 ID의 배열이나 쉼표로 구분된 문자열. 새 이름은 워크스페이스의 태그가 됩니다. |
| bridge_override | (optional) Set to 1 to override the account-wide redirect (bridge) page settings for this link. When 0 or omitted, the link inherits your account defaults and the five fields below are ignored. Fields you leave out take your account default. |
| bridge_page | (선택 사항, bridge_override=1 필요) 1이면 브리지 페이지("탭하여 계속")를 표시하고, 0이면 숨기고 바로 리디렉션합니다. |
| bridge_auto_redirect | (선택 사항, bridge_override=1 필요) 1이면 일정 시간 후 자동으로 리디렉션하고, 0이면 방문자가 탭해야 계속 진행됩니다. |
| bridge_redirect_delay | (선택 사항, bridge_override=1 필요) 자동 리디렉션 지연 시간(초 단위, 1-30). |
| escape_inapp_browser | (선택 사항, bridge_override=1 필요) 목적지 앱이 설치되어 있지 않을 때: 1이면 인앱 브라우저(Facebook/Instagram/TikTok)에서 벗어나 외부 브라우저에서 열고, 0이면 인앱 브라우저에 머뭅니다. |
| bridge_lang | (optional, requires bridge_override=1) Language of the redirect page text ("Open in app" etc.): auto (each visitor's browser language, English if unsupported), en, es, de, fr, it, pt-BR, nl, sv, pl, tr, ru, id, vi, th, ja, zh, ko. Without an override the link follows the account setting in Link Settings (English unless changed). |
| param_forwarding | (optional) UTM / parameter forwarding for this link: which query parameters on the short link are passed on to the destination. Object: mode (all, off or custom), names (with custom: the parameter names to forward, a list or a comma-separated string; letters, digits, _ and -), tracking (with custom: true also forwards the common tracking parameters such as utm_*, gclid, fbclid). names and tracking only apply with mode custom. Left out, the link follows the account setting in Link Settings. custom with no usable name and tracking false is refused. |
curl --location --request POST 'https://linktw.in/api/url/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https:\/\/google.com",
"custom": "takeme-to-google",
"password": "mypass",
"expiry": "2023-11-11 12:00:00",
"clicklimit": 1000,
"expirationredirect": "https:\/\/example.com\/expired",
"note": "Internal campaign tracking note",
"display_title": "My Google Link",
"pixels": [
"My Facebook Pixel",
"My GTM Pixel"
],
"collections": [
"Marketing",
"Social Media"
],
"tags": [
"promo",
"summer"
],
"metatitle": "Not Google",
"metadescription": "Not Google description",
"metaimage": "https:\/\/www.mozilla.org\/media\/protocol\/img\/logos\/firefox\/browser\/og.4ad05d4125a5.png",
"geotarget": [
{
"location": "Canada",
"link": "https:\/\/google.ca"
},
{
"location": "United States",
"link": "https:\/\/google.us",
"state": "California"
}
],
"devicetarget": [
{
"device": "iPhone",
"link": "https:\/\/google.com\/iphone"
},
{
"device": "Android",
"link": "https:\/\/google.com\/android"
}
],
"languagetarget": [
{
"language": "en",
"link": "https:\/\/google.com"
},
{
"language": "fr",
"link": "https:\/\/google.ca"
}
],
"utmtarget": [
{
"param": "utm_source",
"value": "facebook",
"link": "https:\/\/example.com\/facebook-offer"
}
],
"abtesting": [
{
"link": "https:\/\/variant-a.example.com",
"percent": 50
},
{
"link": "https:\/\/variant-b.example.com",
"percent": 50
}
],
"parameters": [
{
"name": "aff",
"value": "3"
},
{
"name": "gtm_source",
"value": "api"
}
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'url' => 'https://google.com',
'custom' => 'takeme-to-google',
'password' => 'mypass',
'expiry' => '2023-11-11 12:00:00',
'clicklimit' => 1000,
'expirationredirect' => 'https://example.com/expired',
'note' => 'Internal campaign tracking note',
'display_title' => 'My Google Link',
'pixels' =>
array(
0 => 'My Facebook Pixel',
1 => 'My GTM Pixel',
),
'collections' =>
array(
0 => 'Marketing',
1 => 'Social Media',
),
'tags' =>
array(
0 => 'promo',
1 => 'summer',
),
'metatitle' => 'Not Google',
'metadescription' => 'Not Google description',
'metaimage' => 'https://www.mozilla.org/media/protocol/img/logos/firefox/browser/og.4ad05d4125a5.png',
'geotarget' =>
array(
0 =>
array(
'location' => 'Canada',
'link' => 'https://google.ca',
),
1 =>
array(
'location' => 'United States',
'link' => 'https://google.us',
'state' => 'California',
),
),
'devicetarget' =>
array(
0 =>
array(
'device' => 'iPhone',
'link' => 'https://google.com/iphone',
),
1 =>
array(
'device' => 'Android',
'link' => 'https://google.com/android',
),
),
'languagetarget' =>
array(
0 =>
array(
'language' => 'en',
'link' => 'https://google.com',
),
1 =>
array(
'language' => 'fr',
'link' => 'https://google.ca',
),
),
'utmtarget' =>
array(
0 =>
array(
'param' => 'utm_source',
'value' => 'facebook',
'link' => 'https://example.com/facebook-offer',
),
),
'abtesting' =>
array(
0 =>
array(
'link' => 'https://variant-a.example.com',
'percent' => 50,
),
1 =>
array(
'link' => 'https://variant-b.example.com',
'percent' => 50,
),
),
'parameters' =>
array(
0 =>
array(
'name' => 'aff',
'value' => '3',
),
1 =>
array(
'name' => 'gtm_source',
'value' => 'api',
),
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/url/add',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"url": "https:\/\/google.com",
"custom": "takeme-to-google",
"password": "mypass",
"expiry": "2023-11-11 12:00:00",
"clicklimit": 1000,
"expirationredirect": "https:\/\/example.com\/expired",
"note": "Internal campaign tracking note",
"display_title": "My Google Link",
"pixels": [
"My Facebook Pixel",
"My GTM Pixel"
],
"collections": [
"Marketing",
"Social Media"
],
"tags": [
"promo",
"summer"
],
"metatitle": "Not Google",
"metadescription": "Not Google description",
"metaimage": "https:\/\/www.mozilla.org\/media\/protocol\/img\/logos\/firefox\/browser\/og.4ad05d4125a5.png",
"geotarget": [
{
"location": "Canada",
"link": "https:\/\/google.ca"
},
{
"location": "United States",
"link": "https:\/\/google.us",
"state": "California"
}
],
"devicetarget": [
{
"device": "iPhone",
"link": "https:\/\/google.com\/iphone"
},
{
"device": "Android",
"link": "https:\/\/google.com\/android"
}
],
"languagetarget": [
{
"language": "en",
"link": "https:\/\/google.com"
},
{
"language": "fr",
"link": "https:\/\/google.ca"
}
],
"utmtarget": [
{
"param": "utm_source",
"value": "facebook",
"link": "https:\/\/example.com\/facebook-offer"
}
],
"abtesting": [
{
"link": "https:\/\/variant-a.example.com",
"percent": 50
},
{
"link": "https:\/\/variant-b.example.com",
"percent": 50
}
],
"parameters": [
{
"name": "aff",
"value": "3"
},
{
"name": "gtm_source",
"value": "api"
}
]
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 3,
"shorturl": "https:\/\/linktw.in\/google",
"title": "Google",
"description": "Search the world's information..."
}
https://linktw.in/api/url/:id/update
PUT is the normal update method and must use application/json. POST is required only when you upload an actual image file: use multipart/form-data and attach it as metaimage. You may include the other update fields in that same multipart request; array fields must be JSON-encoded strings. Both methods support /api/url/:id/update for a numeric ID and /api/url/update/:id for a full short URL such as https://linktw.in/abc123. Only send fields you want to change — omitted fields remain unchanged. For array fields, sending the field replaces all existing values. Send null to clear a field, [] to remove all items from an array field; in a multipart request every value is a string, so send the literal text null or [].
Restricted destinations: a link to a restricted destination (e.g. adult content platforms) on a shared domain fails with error_code: restricted_domain, plus offer (move, add or upgrade) and domains (your branded domains): use one of them as domain. When an update makes an existing link restricted, the link is switched off and its status becomes needs_domain.
아래 생성된 예제는 PUT + JSON을 사용합니다. 파일을 직접 업로드하려면 메서드를 POST로 바꾸고, JSON Content-Type 헤더를 제거한 뒤 multipart/form-data를 사용하세요(예: -F "[email protected]").
| 매개변수 | 설명 |
|---|---|
| url | (선택 사항) 업데이트할 긴 URL |
| custom | (선택 사항) 커스텀 별칭 |
| password | (선택 사항) 비밀번호 보호. 제거하려면 null을 전송하세요. |
| domain | (선택 사항) 커스텀 도메인 (이미 추가된 브랜드 도메인과 일치해야 함) |
| expiry | (선택 사항) 링크 만료 날짜 (예: 2024-09-28 23:11:16). 제거하려면 null을 전송하세요. |
| clicklimit | (선택 사항) 링크 만료 전 최대 클릭 수. 제거하려면 null을 전송하세요. |
| expirationredirect | (선택 사항) 링크 만료 후 리디렉션할 URL. 제거하려면 null을 전송하세요. |
| note | (선택 사항) 내부 메모/설명. 제거하려면 null을 전송하세요. |
| display_title | (선택 사항) 대시보드 구성을 위한 커스텀 제목. 제거하려면 null을 전송하세요. |
| geotarget | (선택 사항) 지역 타겟팅 데이터 (전체 교체). location, link, 선택적 state 필드를 가진 객체의 배열입니다. 모두 지우려면 []을 전송하세요. location은 국가 전체 이름이어야 합니다 (예: "United States", "Canada"). 선택적 state 필드를 통해 국가 내 특정 주/지역을 타겟팅할 수 있습니다 (예: "California"). 전체 국가 및 주 목록 보기. |
| devicetarget | (선택 사항) 기기 타겟팅 데이터 (전체 교체). device와 link 필드를 가진 객체의 배열입니다. 모두 지우려면 []을 전송하세요. |
| languagetarget | (선택 사항) 언어 타겟팅 데이터 (전체 교체). language와 link 필드를 가진 객체의 배열입니다. 모두 지우려면 []을 전송하세요. |
| utmtarget | (optional) UTM targeting data (full replacement, order kept). Array of objects with param, value and link fields. Omit to keep, send [] to clear all. |
| abtesting | (선택 사항) A/B 테스트 변형 (전체 교체). link와 선택적 percent 필드를 가진 객체의 배열입니다. 모두 지우려면 []을 전송하세요. |
| parameters | (선택 사항) URL 파라미터 (전체 교체). name과 value 필드를 가진 객체의 배열입니다. 모두 지우려면 []을 전송하세요. |
| metatitle | (선택 사항) 메타 제목. 제거하려면 null을 전송하세요. |
| metadescription | (선택 사항) 메타 설명. 제거하려면 null을 전송하세요. |
| metaimage | (optional) Social share preview image (og:image). With PUT + JSON, provide a publicly accessible .jpg, .jpeg, or .png URL, or send null to remove the uploaded image (with a custom title or description still set, the preview then uses the destination page's own image, as "Page image" does on the website), or send exactly "none" for a preview without an image (the website's "No image"; it switches the social preview on unless custompreview: false is sent too; update only). To upload image bytes directly, use POST + multipart/form-data and include the JPG/PNG file in the metaimage field (max 1MB). |
| custompreview | (optional) true turns the Social Media Preview switch on (the preview uses the destination page's own image when no custom image is set). false turns it off and removes the custom title, description and image. |
| pixels | (선택 사항) pixel ID 또는 이름의 배열 (전체 교체). 모든 pixel을 제거하려면 []을 전송하세요. |
| collections | (선택 사항) 컬렉션 ID 또는 이름의 배열 (전체 교체). 모든 컬렉션에서 제거하려면 []을 전송하세요. |
| tags | (선택) 태그 이름 또는 ID(전체 교체). 새 이름은 워크스페이스의 태그가 됩니다. 모든 태그를 제거하려면 []를 보내세요. |
| bridge_override | (optional) 1 to override the account-wide redirect (bridge) page settings for this link, 0 to go back to the account defaults. Omit to keep the current settings. With 1, the five fields below that you omit keep their current value. |
| bridge_page | (optional, with bridge_override=1) 1 to show the bridge page ("Tap to Continue"), 0 to hide it and redirect fast. |
| bridge_auto_redirect | (optional, with bridge_override=1) 1 to auto-redirect after a delay, 0 to require the visitor to tap to continue. |
| bridge_redirect_delay | (optional, with bridge_override=1) Auto-redirect delay in seconds (1-30). |
| escape_inapp_browser | (optional, with bridge_override=1) 1 to escape in-app browsers and open the external browser when the app is not installed, 0 to stay in the in-app browser. |
| bridge_lang | (optional, with bridge_override=1) Redirect page language: auto, en, es, de, fr, it, pt-BR, nl, sv, pl, tr, ru, id, vi, th, ja, zh, ko. |
| music | (optional) Smart Music Link, for links to a music or podcast platform (music.available in Get a Single Link). Object: services (list of platform URLs, e.g. Spotify, Apple Music, YouTube Music; first URL per platform, in display order), auto_open (a service key such as spotify, or null for the picker only), title, artist, style (list or icons). Keys left out keep their values; services left out keep the current platforms, or the link's own URL. null or {"enabled": false} switches it off. Fails when the plan does not include Music Link or its limit is reached. |
| store | (optional) App Store Link, for links to an app store listing (store.available in Get a Single Link): routes each visitor to their device's store. Object: ios, android, huawei (needs android), mac, windows, chrome (each a listing URL on that store), fallback (any URL, for other devices; dropped if it fails the security checks). Keys left out keep their values. null or {"enabled": false} switches it off. The store routing appears in device with source store; it is not part of devicetarget. |
| param_forwarding | (optional) UTM / parameter forwarding for this link: which query parameters on the short link are passed on to the destination. Object: mode (all, off or custom), names (with custom: the parameter names to forward, a list or a comma-separated string; letters, digits, _ and -), tracking (with custom: true also forwards the common tracking parameters such as utm_*, gclid, fbclid). names and tracking only apply with mode custom. Keys left out keep their values. null makes the link follow the account setting in Link Settings again. custom with no usable name and tracking false is refused. |
| stock_monitor | (optional) Amazon Stock Monitor for this link (stock_monitor.available in Get a Single Link: an Amazon product link, a plan with Stock Monitor and the account switch on in the affiliate settings). Object: monitor (auto: follows the account, newest links first; on: always monitored, pinned; off: never), action (if out of stock: none = dashboard dot only, notify = daily summary email, product = switch to a replacement from alternatives, auto = switch to a related product; null = account default), alternatives (Amazon product links, in order of preference; product needs at least one), suppressed_oos (true: "See All Buying Options" counts as out of stock; null = account default). Keys left out keep their values. null puts the link back on the account defaults. The plan sets how many products can be monitored; pinned links go first. A pin past that limit is saved but not monitored. When stock_monitor is sent, the response includes it (as in Get a Single Link), so monitored, used and cap show the result. |
curl --location --request PUT 'https://linktw.in/api/url/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https:\/\/google.com",
"custom": "google",
"password": "mypass",
"expiry": "2024-12-31 23:59:59",
"clicklimit": 500,
"expirationredirect": "https:\/\/example.com\/link-expired",
"note": "Updated campaign note",
"display_title": "Updated Dashboard Title",
"pixels": [
"My Facebook Pixel",
"My GTM Pixel"
],
"collections": [
"Marketing",
"Q4 Campaign"
],
"tags": [
"promo"
],
"metatitle": "Updated Title",
"metadescription": "Updated description",
"geotarget": [
{
"location": "Canada",
"link": "https:\/\/google.ca"
},
{
"location": "United States",
"link": "https:\/\/google.us",
"state": "New York"
}
],
"devicetarget": [
{
"device": "iPhone",
"link": "https:\/\/google.com\/iphone"
},
{
"device": "Android",
"link": "https:\/\/google.com\/android"
}
],
"languagetarget": [
{
"language": "en",
"link": "https:\/\/google.com"
},
{
"language": "es",
"link": "https:\/\/google.es"
}
],
"abtesting": [
{
"link": "https:\/\/variant-a.example.com",
"percent": 70
},
{
"link": "https:\/\/variant-b.example.com",
"percent": 30
}
],
"parameters": [
{
"name": "utm_source",
"value": "api"
},
{
"name": "utm_campaign",
"value": "winter2024"
}
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/:id/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'url' => 'https://google.com',
'custom' => 'google',
'password' => 'mypass',
'expiry' => '2024-12-31 23:59:59',
'clicklimit' => 500,
'expirationredirect' => 'https://example.com/link-expired',
'note' => 'Updated campaign note',
'display_title' => 'Updated Dashboard Title',
'pixels' =>
array(
0 => 'My Facebook Pixel',
1 => 'My GTM Pixel',
),
'collections' =>
array(
0 => 'Marketing',
1 => 'Q4 Campaign',
),
'tags' =>
array(
0 => 'promo',
),
'metatitle' => 'Updated Title',
'metadescription' => 'Updated description',
'geotarget' =>
array(
0 =>
array(
'location' => 'Canada',
'link' => 'https://google.ca',
),
1 =>
array(
'location' => 'United States',
'link' => 'https://google.us',
'state' => 'New York',
),
),
'devicetarget' =>
array(
0 =>
array(
'device' => 'iPhone',
'link' => 'https://google.com/iphone',
),
1 =>
array(
'device' => 'Android',
'link' => 'https://google.com/android',
),
),
'languagetarget' =>
array(
0 =>
array(
'language' => 'en',
'link' => 'https://google.com',
),
1 =>
array(
'language' => 'es',
'link' => 'https://google.es',
),
),
'abtesting' =>
array(
0 =>
array(
'link' => 'https://variant-a.example.com',
'percent' => 70,
),
1 =>
array(
'link' => 'https://variant-b.example.com',
'percent' => 30,
),
),
'parameters' =>
array(
0 =>
array(
'name' => 'utm_source',
'value' => 'api',
),
1 =>
array(
'name' => 'utm_campaign',
'value' => 'winter2024',
),
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://linktw.in/api/url/:id/update',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"url": "https:\/\/google.com",
"custom": "google",
"password": "mypass",
"expiry": "2024-12-31 23:59:59",
"clicklimit": 500,
"expirationredirect": "https:\/\/example.com\/link-expired",
"note": "Updated campaign note",
"display_title": "Updated Dashboard Title",
"pixels": [
"My Facebook Pixel",
"My GTM Pixel"
],
"collections": [
"Marketing",
"Q4 Campaign"
],
"tags": [
"promo"
],
"metatitle": "Updated Title",
"metadescription": "Updated description",
"geotarget": [
{
"location": "Canada",
"link": "https:\/\/google.ca"
},
{
"location": "United States",
"link": "https:\/\/google.us",
"state": "New York"
}
],
"devicetarget": [
{
"device": "iPhone",
"link": "https:\/\/google.com\/iphone"
},
{
"device": "Android",
"link": "https:\/\/google.com\/android"
}
],
"languagetarget": [
{
"language": "en",
"link": "https:\/\/google.com"
},
{
"language": "es",
"link": "https:\/\/google.es"
}
],
"abtesting": [
{
"link": "https:\/\/variant-a.example.com",
"percent": 70
},
{
"link": "https:\/\/variant-b.example.com",
"percent": 30
}
],
"parameters": [
{
"name": "utm_source",
"value": "api"
},
{
"name": "utm_campaign",
"value": "winter2024"
}
]
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 3,
"shorturl": "https:\/\/linktw.in\/google",
"title": "Google",
"description": "Search the world's information..."
}
https://linktw.in/api/url/:id/delete
링크를 삭제하려면 DELETE 요청을 전송해야 합니다. DELETE /api/url/:id/delete (숫자 ID의 경우) 또는 DELETE /api/url/delete/:id (숫자 ID 및 https://linktw.in/abc123과 같은 전체 단축 URL 모두 지원)를 사용할 수 있습니다.
curl --location --request DELETE 'https://linktw.in/api/url/:id/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/:id/delete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://linktw.in/api/url/:id/delete',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Link has been successfully deleted."
}
https://linktw.in/api/url/:id/move-domain
For links with the status needs_domain: links with adult, gambling or high-risk content, or to a restricted destination, are switched off on our shared domains but work on your own. This moves the link to one of your branded domains (restriction.domains) and switches it back on, like the Move button in the dashboard: status becomes active, or upgrade_required on the free plan when the destination is not on the approved list. The destination is checked again first. Refused with error 1 when the link is not needs_domain, when domain is not one of yours, or when the destination is now flagged. The short code stays when it is free on that domain, otherwise the link gets a new one (new_code: true). The old short URL stops working. Creating or updating a link to a restricted destination on a shared domain fails with error_code: restricted_domain, plus offer and domains.
| 매개변수 | 설명 |
|---|---|
| :id | (required) The link ID |
| domain | (optional) One of your branded domains, exactly as given in restriction.domains. Defaults to the first one. |
curl --location --request POST 'https://linktw.in/api/url/:id/move-domain' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"domain": "https:\/\/go.example.com"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/:id/move-domain",
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://go.example.com',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/url/:id/move-domain',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"domain": "https:\/\/go.example.com"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 1,
"shorturl": "https:\/\/go.example.com\/googlecanada",
"domain": "https:\/\/go.example.com",
"new_code": false,
"status": "active",
"restriction": null
}
https://linktw.in/api/url/:id/cover
Set the cover image of a link: the artwork the Smart Music Link / podcast page shows (music.cover in Get a Single Link), also the link's image on bio pages. Send multipart/form-data with image (JPG, PNG or WebP, max 500 KB; square works best). Optional image_og: a 1200×1200 JPEG of the same crop, used when the link is shared (social previews); without it the cover itself is used. Send clear = 1 (form or JSON) to remove your upload and go back to the fetched artwork (not together with an image). An image over the size limit is refused with "The image is too large". Without a cover of your own, the music page uses the artwork fetched from the platform. The response returns cover (the image now shown, or null) and cover_custom (true when a cover is set on the link; false = the fetched artwork). For links that are not music or podcast links, music.cover is null.
| 매개변수 | 설명 |
|---|---|
| :id | (required) The link ID |
| image | (required unless clear is sent) The cover image file. |
| image_og | (optional) Share-sized JPEG of the same crop. |
| clear | (optional) 1 = remove your cover. |
curl --location --request POST 'https://linktw.in/api/url/:id/cover' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/url/:id/cover",
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/url/:id/cover',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"id": 1,
"cover": "https:\/\/linktw.in\/content\/images\/AbCdEf_bi_GhIjKl.webp",
"cover_custom": true
}
https://linktw.in/api/urls/delete
단일 요청으로 여러 링크를 삭제합니다. 삭제할 링크 ID 배열을 전송하세요.
| 매개변수 | 설명 |
|---|---|
| ids | (필수) 삭제할 링크 ID 배열 |
curl --location --request POST 'https://linktw.in/api/urls/delete' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"ids": [
101,
102,
103
]
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls/delete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'ids' =>
array(
0 => 101,
1 => 102,
2 => 103,
),
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/urls/delete',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"ids": [
101,
102,
103
]
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"deleted": [
101,
102,
103
],
"errors": []
}
https://linktw.in/api/urls/bulk/preview
아무것도 바꾸지 않고, 변경이 최대 500개 링크에 어떤 영향을 주는지 확인합니다: 바뀌는 링크 수, 변경 전후 예시 몇 개, 바꿀 수 없는 링크. 같은 본문을 일괄 편집 적용으로 보내세요.
| 매개변수 | 설명 |
|---|---|
| ids | (필수) 링크 ID 배열, 최대 500개 |
| op | (필수) 바꿀 항목: destination, replace, utm, domain, expiry, clicklimit, pixels_add, pixels_remove, collection_add, collection_remove, tags_add 또는 tags_remove |
| url | (destination) 새 목적지 URL |
| find | (replace) 목적지에서 찾을 텍스트, replace 그 자리에 넣을 텍스트, 대소문자를 구분하려면 match_case true |
| utm_source | (utm) utm_source, utm_medium, utm_campaign, utm_term, utm_content와 utm_mode add(기존 값 유지) 또는 replace |
| domain | (domain) 내 도메인 중 하나 |
| expiry | (expiry) 내 시간대의 날짜와 시간, 예: 2026-12-31 23:59. 비워 두면 만료일이 없어집니다. |
| clicklimit | (clicklimit) 클릭 수. 0이면 한도가 없어집니다. |
| pixels | (pixels_add, pixels_remove) 픽셀 ID 배열 |
| collection | (collection_add, collection_remove) 컬렉션 ID |
| tags | (tags_add, tags_remove) 태그 이름 또는 ID. tags_add는 새 이름을 태그로 만듭니다. |
curl --location --request POST 'https://linktw.in/api/urls/bulk/preview' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"ids": [
101,
102,
103
],
"op": "utm",
"utm_mode": "add",
"utm_source": "newsletter",
"utm_campaign": "spring"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls/bulk/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'ids' =>
array(
0 => 101,
1 => 102,
2 => 103,
),
'op' => 'utm',
'utm_mode' => 'add',
'utm_source' => 'newsletter',
'utm_campaign' => 'spring',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/urls/bulk/preview',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"ids": [
101,
102,
103
],
"op": "utm",
"utm_mode": "add",
"utm_source": "newsletter",
"utm_campaign": "spring"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"op": "utm",
"label": "Add UTM parameters",
"selected": 3,
"found": 3,
"changing": 2,
"unchanged": 1,
"problems": 0,
"ids": [
101,
102
],
"samples": [
{
"id": 101,
"short": "linktw.in\/spring",
"title": "Spring sale",
"before": "https:\/\/example.com\/spring",
"after": "https:\/\/example.com\/spring?utm_source=newsletter&utm_campaign=spring"
}
],
"issues": [],
"chunk": 4
}
}
https://linktw.in/api/urls/bulk/apply
링크 한 묶음에 변경을 적용합니다: 호출당 최대 chunk개 링크(미리보기 기준: destination, replace, utm은 4개, domain, expiry, 클릭 한도, 픽셀은 25개, 나머지는 100개). 첫 호출은 edit_id를 돌려줍니다: 같은 변경의 다음 묶음마다 함께 보내면 한 번의 되돌리기로 모두 복원됩니다.
| 매개변수 | 설명 |
|---|---|
| ids | (필수) 이 묶음의 링크 ID |
| op | (필수) 일괄 편집 미리보기와 같은 변경과 그 필드 |
| edit_id | (선택) 첫 묶음의 edit_id, 다음 묶음마다 |
curl --location --request POST 'https://linktw.in/api/urls/bulk/apply' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"ids": [
101,
102
],
"op": "utm",
"utm_mode": "add",
"utm_source": "newsletter",
"utm_campaign": "spring"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls/bulk/apply",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(array(
'ids' =>
array(
0 => 101,
1 => 102,
),
'op' => 'utm',
'utm_mode' => 'add',
'utm_source' => 'newsletter',
'utm_campaign' => 'spring',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/urls/bulk/apply',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"ids": [
101,
102
],
"op": "utm",
"utm_mode": "add",
"utm_source": "newsletter",
"utm_campaign": "spring"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"data": {
"edit_id": 58,
"changed": [
101,
102
],
"unchanged": [],
"failed": [],
"flagged": null
}
}
https://linktw.in/api/urls/bulk/undo
마지막 일괄 변경의 링크를 24시간 안에, 호출당 25개씩 되돌립니다: remaining이 0보다 크면 다시 호출하세요. 그 사이 수정한 링크는 더 최근 값을 유지합니다.
| 매개변수 | 설명 |
|---|---|
| edit_id | (선택) 되돌릴 edit_id. 기본값: 마지막 변경. |
curl --location --request POST 'https://linktw.in/api/urls/bulk/undo' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"edit_id": 58
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls/bulk/undo",
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(
'edit_id' => 58,
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/urls/bulk/undo',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"edit_id": 58
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Undone.",
"data": {
"edit_id": 58,
"restored": 2,
"kept": 0,
"remaining": 0,
"done": true,
"issues": []
}
}
https://linktw.in/api/urls/bulk/last
아직 되돌릴 수 있는 일괄 변경, 또는 null.
curl --location --request GET 'https://linktw.in/api/urls/bulk/last' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/urls/bulk/last",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOURAPIKEY",
"Content-Type: application/json",
],
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://linktw.in/api/urls/bulk/last',
'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": {
"edit": {
"id": 58,
"op": "utm",
"label": "Add UTM parameters",
"changed": 2,
"created_at": "2026-11-12 10:00:00",
"expires_at": "2026-11-13 10:00:00"
}
}
}
https://linktw.in/api/tags
링크의 태그와 각 태그가 붙은 링크 수, 태그에 쓸 수 있는 색상을 나열합니다. 링크 목록의 tags 매개변수로 태그별로 링크를 필터링하세요.
curl --location --request GET 'https://linktw.in/api/tags' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/tags",
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/tags',
'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": {
"tags": [
{
"id": 4,
"name": "promo",
"color": "#0967f2",
"links": 12
}
],
"colors": [
"#64748b",
"#0967f2",
"#0ca30c",
"#fab219",
"#d03b3b",
"#7c3aed",
"#db2777",
"#0891b2"
]
}
}
https://linktw.in/api/tag/add
태그를 만듭니다. 같은 이름의 태그가 있으면 그 태그를 돌려줍니다.
| 매개변수 | 설명 |
|---|---|
| name | (필수) 태그 이름, 최대 40자 |
| color | (선택) 태그 목록의 색상 중 하나. 기본값: 내 태그가 가장 적게 쓰는 색상. |
curl --location --request POST 'https://linktw.in/api/tag/add' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "summer",
"color": "#0ca30c"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/tag/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' => 'summer',
'color' => '#0ca30c',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://linktw.in/api/tag/add',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "summer",
"color": "#0ca30c"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Tag saved.",
"data": {
"tag": {
"id": 7,
"name": "summer",
"color": "#0ca30c"
}
}
}
https://linktw.in/api/tag/:id/update
태그 이름이나 색상을 바꿉니다. 그 태그가 붙은 모든 링크에 반영됩니다.
| 매개변수 | 설명 |
|---|---|
| name | (선택) 새 이름 |
| color | (선택) 태그 목록의 색상 중 하나 |
curl --location --request PUT 'https://linktw.in/api/tag/:id/update' \
--header 'Authorization: Bearer YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "summer-2026"
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://linktw.in/api/tag/: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' => 'summer-2026',
)),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://linktw.in/api/tag/:id/update',
'headers': {
'Authorization': 'Bearer YOURAPIKEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "summer-2026"
}),
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
{
"error": 0,
"message": "Tag saved.",
"data": {
"tag": {
"id": 7,
"name": "summer-2026",
"color": "#0ca30c"
}
}
}
https://linktw.in/api/tag/:id/delete
태그를 삭제합니다. 모든 링크에서 빠지고, 링크는 그대로 남습니다.
curl --location --request DELETE 'https://linktw.in/api/tag/: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/tag/: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/tag/: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": "Tag deleted."
}
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
}
]
}
}
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
}
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."
}
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."
}
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"
}
]
}
}
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
}
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."
}
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."
}
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"
}
]
}
}
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": []
}
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"
}
]
}
}
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
}
}
}
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"
}
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."
}
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."
}
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
}
]
}
}
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"
}
]
}
}
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"
}
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."
}
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": []
}
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."
}
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."
}
캐싱: 통계 endpoint는 새로운 클릭 데이터가 도착하면 자동으로 무효화되는 지능형 캐싱을 사용합니다. 이를 통해 서버 부하를 최소화하면서 항상 최신 데이터를 얻을 수 있습니다. 새로운 클릭이 없는 반복 요청은 캐시된 결과를 즉시 반환합니다.
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
}
]
}
}
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"
]
}
}
}
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 ..."
]
}
}
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으로 응답합니다. 원래 키는 기본 키로 계속 작동합니다.
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"
}
]
}
}
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..."
}
}
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
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."
}
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"
}
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"
}
}
]
}
}
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"
}
}
]
}
}