สร้างแท็ก POST
สร้างแท็ก (กลุ่มรายชื่อ) ใหม่ในบัญชีของคุณ แล้วนำ tagId ไปผูกกับรายชื่อผู้ติดต่อ
Authorization
ใช้ API Key (การยืนยันตัวตน) — ส่ง header Authorization: Bearer <API_KEY> (API Key ขึ้นต้นด้วย smsk_)
HTTP Request
http
POST https://public-api.smsup-plus.com/Tag/insertTagContent Type
application/json
Parameter Description
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Required | ชื่อแท็ก ห้ามว่าง |
Response Description
| Property | Type | Description |
|---|---|---|
status | number | 200 เมื่อสำเร็จ |
data | object | แท็กที่สร้าง — ฟิลด์เดียวกับ Tag |
data.tagId | string | รหัสแท็ก (UUID) ใช้กับ endpoint อื่น ๆ |
ตัวอย่าง Request
bash
curl -X POST 'https://public-api.smsup-plus.com/Tag/insertTag' \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"name": "VIP"
}'js
const res = await fetch('https://public-api.smsup-plus.com/Tag/insertTag', {
method: 'POST',
headers: { Authorization: 'Bearer <API_KEY>', 'Content-Type': 'application/json' },
body: JSON.stringify({ name: 'VIP' }),
})
console.log(await res.json())ตัวอย่าง Response
json
{
"status": 200,
"data": {
"tagId": "a1c2e3f4-5b6d-4e7f-8a9b-0c1d2e3f4a5b",
"accountId": 1024,
"name": "VIP",
"isDeleted": false,
"createdBy": 2048,
"createdAt": "2026-11-16T03:10:00.123456789Z",
"updatedAt": "2026-11-16T03:10:00.123456789Z"
}
}Error ที่อาจเจอ
| HTTP | Response | สาเหตุ |
|---|---|---|
| 200 | {"status":400,"description":"name is required."} | ไม่ได้ส่ง name, ส่งเป็นค่าว่าง หรือ body ไม่ใช่ JSON |
| 200 | {"status":500,"description":"Failed to create tag."} | บันทึกไม่สำเร็จ ลองใหม่อีกครั้ง |
| 401 | {"error":"invalid api key"} | API Key ไม่ถูกต้อง — ดู Error |
WARNING
เมื่อผ่านการยืนยันตัวตนแล้ว endpoint นี้ตอบ HTTP 200 เสมอ ให้ตรวจผลจากฟิลด์ status ใน body
INFO
ระบบไม่ตรวจชื่อแท็กซ้ำ — เรียกซ้ำด้วยชื่อเดิมจะได้แท็กใหม่อีกรายการ (คนละ tagId) ควรค้นหาแท็กก่อนสร้าง
