Skip to content

เพิ่มรายชื่อผู้ติดต่อ POST ​

สร้างรายชื่อผู้ติดต่อ (Person) ใหม่ในบัญชีของคุณ ระบบจะสร้าง personId ให้และส่งกลับใน response

Authorization ​

ใช้ API Key (การยืนยันตัวตน) — ส่ง header Authorization: Bearer <API_KEY> (API Key ขึ้นต้นด้วย smsk_)

HTTP Request ​

http
POST https://public-api.smsup-plus.com/Person/insertPerson

Content Type ​

application/json

Parameter Description ​

PropertyTypeRequiredDescription
firstNamestringRequiredชื่อ ห้ามว่าง
lastNamestringOptionalนามสกุล
emailstringOptionalอีเมล (ระบบไม่ตรวจรูปแบบ)
phonestringOptionalเบอร์โทร (ระบบไม่ตรวจรูปแบบ เก็บตามที่ส่งมา)
companyNamestringOptionalชื่อบริษัท
notestringOptionalหมายเหตุ
tagsstring[]Optionalรายการแท็ก ใช้กรองใน ค้นหารายชื่อ ด้วย tag

Response Description ​

PropertyTypeDescription
statusnumber200 เมื่อสำเร็จ
dataobjectรายชื่อที่สร้าง — ฟิลด์เดียวกับ Person
data.personIdstringรหัสรายชื่อ (UUID) ใช้กับ endpoint อื่น ๆ

ตัวอย่าง Request ​

bash
curl -X POST 'https://public-api.smsup-plus.com/Person/insertPerson' \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
    "firstName": "สมชาย",
    "lastName": "ใจดี",
    "email": "somchai@example.com",
    "phone": "0812345678",
    "companyName": "Example Co., Ltd.",
    "note": "ลูกค้าสาขาสีลม",
    "tags": ["VIP"]
  }'
js
const res = await fetch('https://public-api.smsup-plus.com/Person/insertPerson', {
  method: 'POST',
  headers: { Authorization: 'Bearer <API_KEY>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    firstName: 'สมชาย',
    lastName: 'ใจดี',
    email: 'somchai@example.com',
    phone: '0812345678',
    companyName: 'Example Co., Ltd.',
    note: 'ลูกค้าสาขาสีลม',
    tags: ['VIP'],
  }),
})
console.log(await res.json())

ตัวอย่าง Response ​

json
{
  "status": 200,
  "data": {
    "personId": "3f8b2c1e-7a4d-4e9b-9c2f-1d5e6a7b8c90",
    "accountId": 1024,
    "firstName": "สมชาย",
    "lastName": "ใจดี",
    "email": "somchai@example.com",
    "phone": "0812345678",
    "companyName": "Example Co., Ltd.",
    "note": "ลูกค้าสาขาสีลม",
    "tags": ["VIP"],
    "isDeleted": false,
    "createdBy": 2048,
    "createdAt": "2026-11-16T03:15:42.123456789Z",
    "updatedAt": "2026-11-16T03:15:42.123456789Z"
  }
}

Error ที่อาจเจอ ​

HTTPResponseสาเหตุ
200{"status":400,"description":"firstName is required."}ไม่ได้ส่ง firstName, ส่งเป็นค่าว่าง, body ไม่ใช่ JSON หรือชนิดข้อมูลผิด (เช่น tags ไม่ใช่ array)
200{"status":500,"description":"Failed to create person."}บันทึกไม่สำเร็จ ลองใหม่อีกครั้ง
401{"error":"invalid api key"}API Key ไม่ถูกต้อง — ดู Error

WARNING

เมื่อผ่านการยืนยันตัวตนแล้ว endpoint นี้ตอบ HTTP 200 เสมอ ให้ตรวจผลจากฟิลด์ status ใน body

INFO

ระบบไม่ตรวจรายชื่อซ้ำ — เรียกซ้ำด้วยข้อมูลเดิมจะได้รายชื่อใหม่อีกรายการ (คนละ personId)