curl --request POST \
--url https://api.zangsho.com/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "customer@example.com",
"name": "王小明"
}
'{
"data": {
"id": 123,
"email": "customer@example.com",
"name": "王小明",
"phone": "0912345678",
"metadata": {
"source": "website"
},
"ltv": "0.00",
"order_count": 0,
"first_payment_at": null,
"last_payment_at": null,
"created_at": "2026-01-09T08:00:00Z",
"updated_at": "2026-01-09T08:00:00Z"
}
}{
"message": "Unauthenticated."
}{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email field is required.",
"The email must be a valid email address."
]
}
}{
"message": "Too Many Requests",
"retry_after": 3600
}客戶 Customers
建立客戶
建立單一客戶。如果 email 已存在會回傳 422 錯誤。
若需要大量匯入客戶,請使用 批次匯入客戶。
POST
/
customers
curl --request POST \
--url https://api.zangsho.com/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "customer@example.com",
"name": "王小明"
}
'{
"data": {
"id": 123,
"email": "customer@example.com",
"name": "王小明",
"phone": "0912345678",
"metadata": {
"source": "website"
},
"ltv": "0.00",
"order_count": 0,
"first_payment_at": null,
"last_payment_at": null,
"created_at": "2026-01-09T08:00:00Z",
"updated_at": "2026-01-09T08:00:00Z"
}
}{
"message": "Unauthenticated."
}{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email field is required.",
"The email must be a valid email address."
]
}
}{
"message": "Too Many Requests",
"retry_after": 3600
}Authorizations
使用 Laravel Sanctum Token 進行認證。
Token 可在商家後台的「API 設定」頁面取得。
Body
application/json
Response
客戶建立成功
Show child attributes
Show child attributes