เอกสาร API ฉบับปรับปรุง
ยินดีต้อนรับสู่ระบบ LINE API Internal Bridge ชุดเครื่องมือสำหรับดึงข้อมูลรายชื่อเพื่อน ข้อความ และรายการธุรกรรมธนาคารจากบัญชี LINE ของคุณ
💡 หมายเหตุ: API ชุดนี้เป็น internal bridge ไม่ใช่ LINE Messaging API ทางการ การเข้าถึงต้องมี MID และ Session ที่ถูกต้องของระบบ
ความสามารถหลัก
| Endpoint | คำอธิบาย |
|---|---|
GET /getContacts |
ดึงรายชื่อเพื่อนและกลุ่มทั้งหมดที่เกี่ยวข้องกับ MID |
POST /getMessages |
ดึงข้อความย้อนหลังระบุจำนวนรายการ ในห้องแชทที่ต้องการ |
POST /getTransaction |
ดึงข้อมูลรายการเงินเข้าจากธนาคาร (scb, ktb, kbank) |
Available
GET
ดึงรายชื่อเพื่อน (getContacts)
ใช้สำหรับดึงข้อมูลรายชื่อเพื่อน บัญชีที่เป็นเพื่อนกับ MID ที่ระบุ รวมถึงข้อมูลโปรไฟล์พื้นฐาน
GET https://line-api.cz.in.th/api/{mid}/getContacts
Path Parameters
| พารามิเตอร์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
mid |
string | ✅ | MID ของบัญชี LINE ที่ต้องการดึงข้อมูล |
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://line-api.cz.in.th/api/{mid}/getContacts',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
const mid = "{mid}";
fetch(`https://line-api.cz.in.th/api/${mid}/getContacts`)
.then(r => r.json())
.then(console.log)
.catch(console.error);
[
{
"mid": "uXXXXXXXXXXXX",
"displayName": "John Doe",
"statusMessage": "Hello LINE",
"picturePath": "/abcdef...",
"type": "MID"
}
]
{
"error": "account has no data; login first"
}
Available
POST
ดึงข้อความ (getMessages)
ดึงรายการข้อความสนทนาย้อนหลังระบุจำนวนรายการ โดยต้องระบุ messageBoxId (MID ของคู่สนทนา)
POST https://line-api.cz.in.th/api/{mid}/getMessages
JSON Body
| ชื่อฟิลด์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
messageBoxId |
string | ✅ | MID ของห้องแชทที่ต้องการดึง (User MID หรือ Group ID) |
messagesCount |
integer | ✅ | จำนวนข้อความที่ต้องการดึง |
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://line-api.cz.in.th/api/{mid}/getMessages',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
"messageBoxId" => "uXXXXXXXXXXXX",
"messagesCount" => 50
]),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
));
$response = curl_exec($curl);
echo $response;
?>
const mid = "{mid}";
const body = { messageBoxId: "uXXXXXXXXXXXX", messagesCount: 50 };
fetch(`https://line-api.cz.in.th/api/${mid}/getMessages`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body)
}).then(r => r.json()).then(console.log);
{
"messageBoxId": "uXXXXXXXXXXXX",
"messagesCount": 2,
"messages": [
{
"id": "12345",
"from": "uXXXX",
"text": "Hello World",
"createdTime": 1759614696845
}
]
}
{
"error": "messageBoxId is required"
}
Available
POST
รายการธุรกรรม (getTransaction)
ดึงข้อมูลรายการเงินเข้าจากธนาคาร โดยระบบจะทำการ Parse ข้อมูลจาก Flex Message ของธนาคารใน LINE ให้เป็น JSON
POST https://line-api.cz.in.th/api/{mid}/getTransaction
JSON Body
| ชื่อฟิลด์ | ประเภท | จำเป็น | คำอธิบาย |
|---|---|---|---|
bank |
string | ✅ | ชื่อย่อธนาคาร (เช่น scb, ktb, kbank) |
count |
integer | ❌ | จำนวนรายการ (ดีฟอลต์ 20, สูงสุด 100) |
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://line-api.cz.in.th/api/{mid}/getTransaction',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
"bank" => "scb",
"count" => 20
]),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
));
$response = curl_exec($curl);
echo $response;
?>
const mid = "{mid}";
fetch(`https://line-api.cz.in.th/api/${mid}/getTransaction`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ bank: "scb", count: 20 })
}).then(r => r.json()).then(console.log);
{
"bank": "scb",
"count": 1,
"data": [
{
"datetime": "2025-03-21 19:08:59",
"deposits": 1000,
"description": "ยอดเงินคงเหลือ 5,432.10",
"txnRemark": "โอนเข้า 123-4-56789-0",
"ctype": "promptpay_scb_fundin"
}
]
}
{
"error": "account_revoked",
"hint": "Device revoked. Data cleared. Please re-login via QR."
}