ดึงรายการลูกค้าทั้งหมดของธุรกิจ
Customers เป็นข้อมูลระดับ Business ไม่แยกตามสาขา — ทุก Token ที่มี Scope read:customers จะเห็นลูกค้าทั้งหมดของธุรกิจ
Endpoint นี้เหมาะสำหรับ:
read:customers
ข้อมูล PII (phone, email, date_of_birth, address ฯลฯ) ต้องการ Scope เพิ่มเติม:
read:customers:pii
GET /api/partner/v1/customers
Authorization: Bearer <access_token>
| Parameter | Type | Required | Description |
|---|---|---|---|
| is_active | boolean | No | กรองตามสถานะลูกค้า: true หรือ false |
| membership_tier_id | string (UUID) | No | กรองตาม Membership Tier |
| q | string | No | ค้นหาจาก full_name หรือ customer_code (1–255 ตัวอักษร) |
| limit | integer | No | จำนวนรายการต่อหน้า (1–200) ค่าเริ่มต้น 50 |
| cursor | string | No | Cursor สำหรับดึงหน้าถัดไป |
ฟิลด์ข้อมูลส่วนบุคคล (PII) จะ ไม่ปรากฏใน Response เลย หาก Token ไม่มี Scope read:customers:pii — ไม่ใช่ null แต่ key หายไปจาก object ทั้งหมด
ฟิลด์ที่ต้องการ Scope read:customers:pii:
phoneemaildate_of_birthaddress, city, state, postal_code, countrytax_idEndpoint นี้ใช้ Cursor-based Pagination
หาก has_more เป็น true ให้ส่ง next_cursor กลับมาใน parameter cursor
GET /api/partner/v1/customers?cursor=<next_cursor>
curl -X GET \
"https://<host>/api/partner/v1/customers?is_active=true&limit=50" \
-H "Authorization: Bearer <access_token>"
{
"data": [
{
"id": "4b1a5ef8-f4a2-4fb2-99d5-dddd1076e1bb",
"customer_code": "CUS-000380",
"full_name": "สมชาย ใจดี",
"first_name": "สมชาย",
"last_name": "ใจดี",
"membership_tier_id": "5c19101c-d9e5-4fb0-9f85-7daf1f0c3f91",
"membership_number": "MEM17785123666606",
"total_points": 30,
"available_points": 10,
"total_spent": "600",
"total_visits": 4,
"last_visit_date": "2026-05-11T00:00:00.000Z",
"is_active": true,
"is_verified": false,
"joined_date": "2026-05-11T00:00:00.000Z",
"created_at": "2026-05-11T15:12:59.723Z",
"updated_at": "2026-05-11T15:14:06.138Z",
"phone": "0812345678",
"email": null,
"date_of_birth": null,
"address": null,
"city": null,
"state": null,
"postal_code": null,
"country": "Thailand",
"tax_id": null
}
],
"pagination": {
"next_cursor": null,
"has_more": false,
"limit": 50
}
}
| Field | Type | Scope Required | Description |
|---|---|---|---|
| id | string (UUID) | read:customers | Customer ID |
| customer_code | string | read:customers | รหัสลูกค้า |
| full_name | string | read:customers | ชื่อ-นามสกุล |
| first_name | string | read:customers | ชื่อ |
| last_name | string | null | read:customers | นามสกุล |
| membership_tier_id | string (UUID) | null | read:customers | Tier ของ Membership Program |
| membership_number | string | null | read:customers | เลข Membership |
| total_points | number | read:customers | คะแนนสะสมทั้งหมด |
| available_points | number | read:customers | คะแนนที่ใช้ได้ |
| total_spent | string (decimal) | read:customers | ยอดใช้จ่ายสะสม |
| total_visits | number | read:customers | จำนวนครั้งที่เข้าใช้บริการ |
| last_visit_date | string (ISO 8601) | null | read:customers | วันที่เข้าใช้บริการล่าสุด |
| is_active | boolean | read:customers | สถานะลูกค้า |
| is_verified | boolean | read:customers | ยืนยันตัวตนแล้วหรือยัง |
| joined_date | string (ISO 8601) | null | read:customers | วันที่สมัครสมาชิก |
| created_at | string (ISO 8601) | read:customers | เวลาที่สร้าง record |
| updated_at | string (ISO 8601) | read:customers | เวลาที่แก้ไขล่าสุด |
| phone | string | null | read:customers:pii | เบอร์โทรศัพท์ |
| string | null | read:customers:pii | อีเมล | |
| date_of_birth | string (ISO 8601) | null | read:customers:pii | วันเกิด |
| address | string | null | read:customers:pii | ที่อยู่ |
| city | string | null | read:customers:pii | เมือง / เขต |
| state | string | null | read:customers:pii | รัฐ / จังหวัด |
| postal_code | string | null | read:customers:pii | รหัสไปรษณีย์ |
| country | string | null | read:customers:pii | ประเทศ |
| tax_id | string | null | read:customers:pii | เลขประจำตัวผู้เสียภาษี |