หน้าหลัก / จัดการเครื่องมือ / เอกสาร API
เอกสาร API ตัวแทน
4 บริการแยกชัด · ราคาเท่าหน้าร้าน · คีย์เดียวใช้ได้ทุกหมวด
การยืนยันตัวตน
ทุกคำขอต้องแนบคีย์ของบัญชีคุณมาที่ header X-API-Key (หรือ Authorization: Bearer <key>)
X-API-Key: tw_xxxxxxxxxxxxxxxxxxxxxxxxxxxx Content-Type: application/json Base URL: https://twin24hr.shop
คีย์อยู่ที่หน้า จัดการเครื่องมือ · 1 บัญชี 1 คีย์ · สร้างใหม่แล้วคีย์เดิมใช้ไม่ได้ทันที
รายการ Endpoint
| บริการ | Method | Path | ใช้ทำอะไร |
|---|---|---|---|
| ทั่วไป | GET | /api/v1/me | ยอดเครดิต + ข้อมูลบัญชี |
| แอพพรีเมี่ยม | GET | /api/v1/premium/products | สินค้า + แพ็กเกจทั้งหมด |
| เติมเกมออนไลน์ | GET | /api/v1/topup/products | เกม/เติมเงิน + แพ็กเกจ |
| ปั๊มโซเชียล | GET | /api/v1/social/services | บริการปั๊ม ทั้งหมดของผู้ให้บริการ |
| รับ OTP | GET | /api/v1/otp/services | เบอร์ OTP ทั้งหมดของผู้ให้บริการ ตามประเทศ |
| สั่งซื้อ | POST | /api/v1/orders | พรีเมี่ยม / เติมเกม |
| สั่งปั๊มโซเชียล | POST | /api/v1/social/orders | ส่งลิงก์ + จำนวน |
| สั่งรับ OTP | POST | /api/v1/otp/orders | ขอเบอร์ + รหัส |
| เช็กสถานะ | GET | /api/v1/orders/<order_no> | สถานะ + สิ่งที่ส่งมอบ |
มีสินค้าทดสอบให้ทุกบริการ —
TEST-API (พรีเมี่ยม/เติมเกม) · TEST (ปั๊มโซเชียล/OTP)
ทดสอบต่อสายได้โดยไม่ตัดเครดิตและไม่เรียกผู้ให้บริการ
ไม่ให้บริการผ่าน API — บัตรเติมเกม · แพ็กเกจเสริมเน็ต · เติมเงินมือถือ (สั่งได้เฉพาะหน้าร้าน)
ตัวอย่างโค้ด — เลือกภาษาแล้วเปลี่ยนทุกหัวข้อพร้อมกัน
1) แอพพรีเมี่ยม — ดูรายการ
GET /api/v1/premium/products
curl -s "https://twin24hr.shop/api/v1/premium/products" \ -H "X-API-Key: tw_xxxxxxxxxxxx"
const KEY = 'tw_xxxxxxxxxxxx';
const res = await fetch("https://twin24hr.shop/api/v1/premium/products", {
method: 'GET',
headers: { 'X-API-Key': KEY, 'Content-Type': 'application/json' }
});
console.log(await res.json());const axios = require('axios');
const { data } = await axios({
method: 'GET',
url: "https://twin24hr.shop/api/v1/premium/products",
headers: { 'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001' }
});
console.log(data);<?php
$ch = curl_init("https://twin24hr.shop/api/v1/premium/products");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['X-API-Key: tw_xxxxxxxxxxxx', 'Content-Type: application/json'],
]);
echo curl_exec($ch);import requests
r = requests.request(
'GET',
"https://twin24hr.shop/api/v1/premium/products",
headers={'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001'},
timeout=30,
)
print(r.json())req, _ := http.NewRequest("GET", "https://twin24hr.shop/api/v1/premium/products", nil)
req.Header.Set("X-API-Key", "tw_xxxxxxxxxxxx")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "req-001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
io.Copy(os.Stdout, res.Body)using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-API-Key", "tw_xxxxxxxxxxxx");
var req = new HttpRequestMessage(HttpMethod.Get, "https://twin24hr.shop/api/v1/premium/products");
var res = await http.SendAsync(req);
Console.WriteLine(await res.Content.ReadAsStringAsync());2) เติมเกมออนไลน์ — ดูรายการ
GET /api/v1/topup/products
curl -s "https://twin24hr.shop/api/v1/topup/products" \ -H "X-API-Key: tw_xxxxxxxxxxxx"
const KEY = 'tw_xxxxxxxxxxxx';
const res = await fetch("https://twin24hr.shop/api/v1/topup/products", {
method: 'GET',
headers: { 'X-API-Key': KEY, 'Content-Type': 'application/json' }
});
console.log(await res.json());const axios = require('axios');
const { data } = await axios({
method: 'GET',
url: "https://twin24hr.shop/api/v1/topup/products",
headers: { 'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001' }
});
console.log(data);<?php
$ch = curl_init("https://twin24hr.shop/api/v1/topup/products");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['X-API-Key: tw_xxxxxxxxxxxx', 'Content-Type: application/json'],
]);
echo curl_exec($ch);import requests
r = requests.request(
'GET',
"https://twin24hr.shop/api/v1/topup/products",
headers={'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001'},
timeout=30,
)
print(r.json())req, _ := http.NewRequest("GET", "https://twin24hr.shop/api/v1/topup/products", nil)
req.Header.Set("X-API-Key", "tw_xxxxxxxxxxxx")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "req-001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
io.Copy(os.Stdout, res.Body)using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-API-Key", "tw_xxxxxxxxxxxx");
var req = new HttpRequestMessage(HttpMethod.Get, "https://twin24hr.shop/api/v1/topup/products");
var res = await http.SendAsync(req);
Console.WriteLine(await res.Content.ReadAsStringAsync());3) สั่งซื้อ (พรีเมี่ยม / เติมเกม)
POST /api/v1/orders
curl -s -X POST "https://twin24hr.shop/api/v1/orders" \
-H "X-API-Key: tw_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: req-001" \
-d '{"product_id":229104,"variant_id":1943508,"qty":1,"target":"ลิงก์หรือบัญชีปลายทาง"}'const KEY = 'tw_xxxxxxxxxxxx';
const res = await fetch("https://twin24hr.shop/api/v1/orders", {
method: 'POST',
headers: { 'X-API-Key': KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({"product_id":229104,"variant_id":1943508,"qty":1,"target":"ลิงก์หรือบัญชีปลายทาง"})
});
console.log(await res.json());const axios = require('axios');
const { data } = await axios({
method: 'POST',
url: "https://twin24hr.shop/api/v1/orders",
headers: { 'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001' },
data: {"product_id":229104,"variant_id":1943508,"qty":1,"target":"ลิงก์หรือบัญชีปลายทาง"}
});
console.log(data);<?php
$ch = curl_init("https://twin24hr.shop/api/v1/orders");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['X-API-Key: tw_xxxxxxxxxxxx', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode({"product_id":229104,"variant_id":1943508,"qty":1,"target":"ลิงก์หรือบัญชีปลายทาง"}),
]);
echo curl_exec($ch);import requests
r = requests.request(
'POST',
"https://twin24hr.shop/api/v1/orders",
headers={'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001'},
json={"product_id":229104,"variant_id":1943508,"qty":1,"target":"ลิงก์หรือบัญชีปลายทาง"},
timeout=30,
)
print(r.json())req, _ := http.NewRequest("POST", "https://twin24hr.shop/api/v1/orders", bytes.NewBufferString(`{"product_id":229104,"variant_id":1943508,"qty":1,"target":"ลิงก์หรือบัญชีปลายทาง"}`))
req.Header.Set("X-API-Key", "tw_xxxxxxxxxxxx")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "req-001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
io.Copy(os.Stdout, res.Body)using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-API-Key", "tw_xxxxxxxxxxxx");
var req = new HttpRequestMessage(HttpMethod.Post, "https://twin24hr.shop/api/v1/orders") {
Content = new StringContent(@"{""product_id"":229104,""variant_id"":1943508,""qty"":1,""target"":""ลิงก์หรือบัญชีปลายทาง""}", Encoding.UTF8, "application/json")
};
var res = await http.SendAsync(req);
Console.WriteLine(await res.Content.ReadAsStringAsync());4) ปั๊มโซเชียล — สั่งงาน
POST /api/v1/social/orders
curl -s -X POST "https://twin24hr.shop/api/v1/social/orders" \
-H "X-API-Key: tw_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: req-001" \
-d '{"service_id":1234,"link":"https://instagram.com/yourpage","quantity":1000}'const KEY = 'tw_xxxxxxxxxxxx';
const res = await fetch("https://twin24hr.shop/api/v1/social/orders", {
method: 'POST',
headers: { 'X-API-Key': KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({"service_id":1234,"link":"https://instagram.com/yourpage","quantity":1000})
});
console.log(await res.json());const axios = require('axios');
const { data } = await axios({
method: 'POST',
url: "https://twin24hr.shop/api/v1/social/orders",
headers: { 'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001' },
data: {"service_id":1234,"link":"https://instagram.com/yourpage","quantity":1000}
});
console.log(data);<?php
$ch = curl_init("https://twin24hr.shop/api/v1/social/orders");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['X-API-Key: tw_xxxxxxxxxxxx', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode({"service_id":1234,"link":"https://instagram.com/yourpage","quantity":1000}),
]);
echo curl_exec($ch);import requests
r = requests.request(
'POST',
"https://twin24hr.shop/api/v1/social/orders",
headers={'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001'},
json={"service_id":1234,"link":"https://instagram.com/yourpage","quantity":1000},
timeout=30,
)
print(r.json())req, _ := http.NewRequest("POST", "https://twin24hr.shop/api/v1/social/orders", bytes.NewBufferString(`{"service_id":1234,"link":"https://instagram.com/yourpage","quantity":1000}`))
req.Header.Set("X-API-Key", "tw_xxxxxxxxxxxx")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "req-001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
io.Copy(os.Stdout, res.Body)using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-API-Key", "tw_xxxxxxxxxxxx");
var req = new HttpRequestMessage(HttpMethod.Post, "https://twin24hr.shop/api/v1/social/orders") {
Content = new StringContent(@"{""service_id"":1234,""link"":""https://instagram.com/yourpage"",""quantity"":1000}", Encoding.UTF8, "application/json")
};
var res = await http.SendAsync(req);
Console.WriteLine(await res.Content.ReadAsStringAsync());5) รับ OTP — ขอเบอร์
POST /api/v1/otp/orders
curl -s -X POST "https://twin24hr.shop/api/v1/otp/orders" \
-H "X-API-Key: tw_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: req-001" \
-d '{"service_id":"TEST","country":"TH"}'const KEY = 'tw_xxxxxxxxxxxx';
const res = await fetch("https://twin24hr.shop/api/v1/otp/orders", {
method: 'POST',
headers: { 'X-API-Key': KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({"service_id":"TEST","country":"TH"})
});
console.log(await res.json());const axios = require('axios');
const { data } = await axios({
method: 'POST',
url: "https://twin24hr.shop/api/v1/otp/orders",
headers: { 'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001' },
data: {"service_id":"TEST","country":"TH"}
});
console.log(data);<?php
$ch = curl_init("https://twin24hr.shop/api/v1/otp/orders");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['X-API-Key: tw_xxxxxxxxxxxx', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode({"service_id":"TEST","country":"TH"}),
]);
echo curl_exec($ch);import requests
r = requests.request(
'POST',
"https://twin24hr.shop/api/v1/otp/orders",
headers={'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001'},
json={"service_id":"TEST","country":"TH"},
timeout=30,
)
print(r.json())req, _ := http.NewRequest("POST", "https://twin24hr.shop/api/v1/otp/orders", bytes.NewBufferString(`{"service_id":"TEST","country":"TH"}`))
req.Header.Set("X-API-Key", "tw_xxxxxxxxxxxx")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "req-001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
io.Copy(os.Stdout, res.Body)using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-API-Key", "tw_xxxxxxxxxxxx");
var req = new HttpRequestMessage(HttpMethod.Post, "https://twin24hr.shop/api/v1/otp/orders") {
Content = new StringContent(@"{""service_id"":""TEST"",""country"":""TH""}", Encoding.UTF8, "application/json")
};
var res = await http.SendAsync(req);
Console.WriteLine(await res.Content.ReadAsStringAsync());6) เช็กสถานะคำสั่งซื้อ
GET /api/v1/orders/TW202611280001
curl -s "https://twin24hr.shop/api/v1/orders/TW202611280001" \ -H "X-API-Key: tw_xxxxxxxxxxxx"
const KEY = 'tw_xxxxxxxxxxxx';
const res = await fetch("https://twin24hr.shop/api/v1/orders/TW202611280001", {
method: 'GET',
headers: { 'X-API-Key': KEY, 'Content-Type': 'application/json' }
});
console.log(await res.json());const axios = require('axios');
const { data } = await axios({
method: 'GET',
url: "https://twin24hr.shop/api/v1/orders/TW202611280001",
headers: { 'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001' }
});
console.log(data);<?php
$ch = curl_init("https://twin24hr.shop/api/v1/orders/TW202611280001");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => ['X-API-Key: tw_xxxxxxxxxxxx', 'Content-Type: application/json'],
]);
echo curl_exec($ch);import requests
r = requests.request(
'GET',
"https://twin24hr.shop/api/v1/orders/TW202611280001",
headers={'X-API-Key': 'tw_xxxxxxxxxxxx', 'Idempotency-Key': 'req-001'},
timeout=30,
)
print(r.json())req, _ := http.NewRequest("GET", "https://twin24hr.shop/api/v1/orders/TW202611280001", nil)
req.Header.Set("X-API-Key", "tw_xxxxxxxxxxxx")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "req-001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
io.Copy(os.Stdout, res.Body)using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-API-Key", "tw_xxxxxxxxxxxx");
var req = new HttpRequestMessage(HttpMethod.Get, "https://twin24hr.shop/api/v1/orders/TW202611280001");
var res = await http.SendAsync(req);
Console.WriteLine(await res.Content.ReadAsStringAsync());ตัวอย่างคำตอบ
// 200 — สำเร็จ
{
"success": true,
"order_no": "TW202611280001",
"amount": 40,
"balance": 1260,
"delivered": ["DF-6H-XXXX-XXXX"]
}
// 400 — เครดิตของคุณไม่พอ
{ "success": false, "code": "no_credit", "message": "เครดิตไม่พอ (ต้องใช้ ฿40.00)" }
// 401 / 403 — คีย์ผิดหรือถูกปิด
{ "success": false, "code": "bad_key", "message": "API key ไม่ถูกต้องหรือถูกปิดใช้งาน" }
// 409 — ส่งซ้ำ
{ "success": false, "code": "duplicate", "message": "คำขอนี้ถูกส่งไปแล้ว" }
// 429 — เรียกถี่เกิน
{ "success": false, "code": "rate_limited", "message": "เรียกถี่เกินไป (60 ครั้ง/นาที)" }ความปลอดภัย
- คีย์ไม่ถูกเก็บเป็นข้อความธรรมดา — เก็บเป็น SHA-256 hash เท่านั้น แสดงครั้งเดียวตอนสร้าง กู้คืนไม่ได้
- HTTPS เท่านั้น — ระบบปฏิเสธคำขอที่ไม่ใช่ TLS และไม่รับคีย์ผ่าน query string
- จำกัด 60 คำขอ/นาที ต่อคีย์ — เกินแล้วได้
429พร้อมRetry-After - Idempotency-Key — ส่งซ้ำด้วยคีย์เดิมจะไม่ถูกตัดเงินสองครั้ง (ได้
409) - ตัดเครดิตหลังผู้ให้บริการตอบรับ — ถ้าส่งไม่สำเร็จ ระบบคืนเครดิตให้ทันที
- ไม่เปิดเผยข้อมูลภายใน — ข้อผิดพลาดจากผู้ให้บริการถูกแปลงเป็นข้อความกลาง ไม่มี stack trace หรือคีย์หลุดออกไป
- ทุกออเดอร์มีป้าย API — ตรวจย้อนหลังได้ในหน้าประวัติและหน้าคำสั่งซื้อล่าสุด
- ปิดคีย์ได้ทันที — กด “ปิดใช้งาน” ที่หน้า จัดการเครื่องมือ คำขอถัดไปถูกปฏิเสธทันที