Customer
Daftar Customer
Ambil daftar customer dengan pagination. Mendukung filter berdasarkan kata kunci pencarian, tag, dan status blacklist.
GET /api/v1/public/customers
Query Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
limit | number | tidak | Jumlah customer yang dikembalikan (1-200, default 50) |
cursor | string | tidak | Customer ID untuk pagination (dari next_cursor di response sebelumnya) |
search | string | tidak | Cari berdasarkan nomor telepon, nama, atau email |
tags | string | tidak | Daftar tag yang dipisahkan koma untuk filter |
blacklisted | string | tidak | Filter berdasarkan status blacklist: "true" atau "false" |
Contoh Request
- cURL
- JavaScript
- Python
curl -X GET "https://chat.api.co.id/api/v1/public/customers?limit=50&search=john&tags=vip,loyal" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch(
"https://chat.api.co.id/api/v1/public/customers?limit=50&search=john&tags=vip,loyal",
{
headers: {
"Authorization": "Bearer YOUR_API_KEY"
}
}
);
const { data, pagination } = await response.json();
import requests
response = requests.get(
"https://chat.api.co.id/api/v1/public/customers",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"limit": 50, "search": "john", "tags": "vip,loyal"}
)
result = response.json()
customers = result["data"]
pagination = result["pagination"]
Response
{
"success": true,
"data": [
{
"id": "clxxx1234567890",
"phone_number": "628123456789",
"name": "John Doe",
"email": "[email protected]",
"tags": ["vip", "loyal"],
"is_window_active": true,
"unread_count": 3,
"created_at": "2026-01-01T00:00:00.000Z"
},
{
"id": "clxxx0987654321",
"phone_number": "628987654321",
"name": "Jane Smith",
"email": "[email protected]",
"tags": ["new"],
"is_window_active": false,
"unread_count": 0,
"created_at": "2026-02-15T08:30:00.000Z"
}
],
"pagination": {
"has_more": true,
"next_cursor": "clxxx0987654321",
"limit": 50
}
}
Gunakan next_cursor dari objek pagination sebagai query parameter cursor untuk mengambil halaman berikutnya.
Detail Customer
Ambil detail lengkap satu customer, termasuk custom field, log consent, dan catatan.
GET /api/v1/public/customers/:id
URL Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
id | string | ya | Customer ID (CUID), nomor telepon, atau username Instagram |
Contoh Request
- cURL
- JavaScript
- Python
curl -X GET "https://chat.api.co.id/api/v1/public/customers/628123456789" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch(
"https://chat.api.co.id/api/v1/public/customers/628123456789",
{
headers: {
"Authorization": "Bearer YOUR_API_KEY"
}
}
);
const { data } = await response.json();
console.log("Customer:", data.name);
import requests
response = requests.get(
"https://chat.api.co.id/api/v1/public/customers/628123456789",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
data = response.json()["data"]
print("Customer:", data["name"])
Response
{
"success": true,
"data": {
"id": "clxxx1234567890",
"phone_number": "628123456789",
"name": "John Doe",
"email": "[email protected]",
"instagram_username": null,
"tags": ["vip", "loyal"],
"is_window_active": true,
"unread_count": 3,
"custom_fields": {
"company": "Acme Inc",
"plan": "enterprise"
},
"consent_logs": [
{
"source": "website_form",
"purpose": "marketing",
"consent_status": true,
"logged_at": "2026-01-01T00:00:00.000Z"
}
],
"notes": [
{
"id": "note_abc123",
"content": "VIP customer, handle with care",
"created_at": "2026-01-05T14:00:00.000Z"
}
],
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-07T10:30:00.000Z"
}
}
Buat Customer
Buat record customer baru dengan nomor telepon, info profil, tag, dan status consent.
POST /api/v1/public/customers
Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
phone_number | string | ya | Nomor telepon customer dalam format E.164 (mis. 628123456789) |
whatsapp_phone_number_id | string | ya | Nomor WhatsApp Anda yang akan dikaitkan dengan customer ini. Gunakan id dari GET /phone-numbers. |
name | string | tidak | Nama tampilan customer |
email | string | tidak | Alamat email customer |
tags | string[] | tidak | Array tag untuk pengelompokan (mis. ["vip", "loyal"]) |
consent_status | boolean | tidak | Apakah customer sudah memberikan consent untuk dikirimi pesan |
consent_source | string | tidak | Sumber consent (mis. "api", "website_form", "manual") |
Contoh Request
- cURL
- JavaScript
- Python
curl -X POST "https://chat.api.co.id/api/v1/public/customers" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "628123456789",
"whatsapp_phone_number_id": "clyyy9876543210",
"name": "John Doe",
"email": "[email protected]",
"tags": ["vip"],
"consent_status": true,
"consent_source": "api"
}'
const response = await fetch("https://chat.api.co.id/api/v1/public/customers", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
phone_number: "628123456789",
whatsapp_phone_number_id: "clyyy9876543210",
name: "John Doe",
email: "[email protected]",
tags: ["vip"],
consent_status: true,
consent_source: "api"
})
});
const { data } = await response.json();
console.log("Created customer:", data.id);
import requests
response = requests.post(
"https://chat.api.co.id/api/v1/public/customers",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"phone_number": "628123456789",
"whatsapp_phone_number_id": "clyyy9876543210",
"name": "John Doe",
"email": "[email protected]",
"tags": ["vip"],
"consent_status": True,
"consent_source": "api"
}
)
data = response.json()["data"]
print("Created customer:", data["id"])
Response
{
"success": true,
"data": {
"id": "clxxx1234567890",
"phone_number": "628123456789",
"name": "John Doe",
"email": "[email protected]",
"tags": ["vip"],
"consent_status": true,
"consent_source": "api",
"blacklisted": false,
"created_at": "2026-04-03T10:00:00.000Z",
"updated_at": "2026-04-03T10:00:00.000Z"
}
}
Ubah Customer
Ubah profil customer yang sudah ada. Hanya field yang dikirim yang diubah (partial update).
PATCH /api/v1/public/customers/:id
URL Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
id | string | ya | Customer ID (CUID) |
Body Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
name | string | tidak | Nama customer yang baru |
email | string | tidak | Alamat email yang baru |
tags | string[] | tidak | Menggantikan semua tag yang ada dengan array ini |
Contoh Request
- cURL
- JavaScript
- Python
curl -X PATCH "https://chat.api.co.id/api/v1/public/customers/clxxx1234567890" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Name",
"tags": ["vip", "loyal"]
}'
const response = await fetch("https://chat.api.co.id/api/v1/public/customers/clxxx1234567890", {
method: "PATCH",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
name: "Updated Name",
tags: ["vip", "loyal"]
})
});
import requests
response = requests.patch(
"https://chat.api.co.id/api/v1/public/customers/clxxx1234567890",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"name": "Updated Name",
"tags": ["vip", "loyal"]
}
)
Response
{
"success": true,
"data": {
"id": "clxxx1234567890",
"phone_number": "628123456789",
"name": "Updated Name",
"email": "[email protected]",
"tags": ["vip", "loyal"],
"consent_status": true,
"blacklisted": false,
"updated_at": "2026-04-03T11:00:00.000Z"
}
}
Hapus Customer
Hapus record customer secara permanen. Tindakan ini tidak bisa dibatalkan.
DELETE /api/v1/public/customers/:id
URL Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
id | string | ya | Customer ID (CUID) yang akan dihapus |
Peringatan: Menghapus customer bersifat permanen dan juga akan menghapus seluruh riwayat percakapan, catatan, dan record consent yang terkait.
Contoh Request
- cURL
- JavaScript
- Python
curl -X DELETE "https://chat.api.co.id/api/v1/public/customers/clxxx1234567890" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch("https://chat.api.co.id/api/v1/public/customers/clxxx1234567890", {
method: "DELETE",
headers: {
"Authorization": "Bearer YOUR_API_KEY"
}
});
import requests
response = requests.delete(
"https://chat.api.co.id/api/v1/public/customers/clxxx1234567890",
headers={
"Authorization": "Bearer YOUR_API_KEY"
}
)
Response
{
"success": true,
"data": {
"id": "clxxx1234567890",
"deleted": true
}
}
Consent Customer
Catat aksi consent untuk customer. Berguna untuk pelacakan GDPR/kepatuhan dan pengelolaan izin pengiriman pesan.
POST /api/v1/public/customers/:id/consent
URL Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
id | string | ya | Customer ID (CUID) |
Body Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
action | string | ya | Aksi consent: "OPT_IN", "OPT_OUT", atau "UPDATE" |
source | string | ya | Tempat consent dikumpulkan (mis. "website_form", "api", "phone_call") |
purpose | string | tidak | Tujuan consent (mis. "marketing", "transactional", "support") |
Contoh Request
- cURL
- JavaScript
- Python
curl -X POST "https://chat.api.co.id/api/v1/public/customers/clxxx1234567890/consent" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "OPT_IN",
"source": "website_form",
"purpose": "marketing"
}'
const response = await fetch("https://chat.api.co.id/api/v1/public/customers/clxxx1234567890/consent", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
action: "OPT_IN",
source: "website_form",
purpose: "marketing"
})
});
import requests
response = requests.post(
"https://chat.api.co.id/api/v1/public/customers/clxxx1234567890/consent",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"action": "OPT_IN",
"source": "website_form",
"purpose": "marketing"
}
)
Response
{
"success": true,
"data": {
"customer_id": "clxxx1234567890",
"action": "OPT_IN",
"source": "website_form",
"purpose": "marketing",
"consent_status": true,
"logged_at": "2026-04-03T10:00:00.000Z"
}
}
Cek Messaging Window
Cek apakah messaging window 24 jam sedang aktif untuk seorang customer. Pesan non-template hanya bisa dikirim selama window ini aktif.
GET /api/v1/public/customers/:id/window-status
Aturan Window 24 Jam: WhatsApp hanya mengizinkan pesan bebas (teks, media, interaktif) dalam 24 jam sejak pesan masuk terakhir dari customer. Setelah window tertutup, Anda hanya bisa mengirim pesan template yang sudah disetujui. Selalu cek status window sebelum mengirim pesan non-template.
URL Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
id | string | ya | Customer ID (CUID), nomor telepon, atau username Instagram |
Contoh Request
- cURL
- JavaScript
- Python
curl -X GET "https://chat.api.co.id/api/v1/public/customers/628123456789/window-status" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch(
"https://chat.api.co.id/api/v1/public/customers/628123456789/window-status",
{ headers: { "Authorization": "Bearer YOUR_API_KEY" } }
);
const { data } = await response.json();
if (data.whatsapp.is_window_active) {
// Can send free-form messages
} else {
// Must use template messages
}
response = requests.get(
"https://chat.api.co.id/api/v1/public/customers/628123456789/window-status",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
data = response.json()["data"]
if data["whatsapp"]["is_window_active"]:
# Can send free-form messages
else:
# Must use template messages
Response
{
"success": true,
"data": {
"customer_id": "clxxx1234567890",
"whatsapp": {
"is_window_active": true,
"window_expires_at": "2026-01-08T10:30:00.000Z",
"last_inbound_message_at": "2026-01-07T10:30:00.000Z",
"can_send_freeform": true,
"can_send_template": true,
"free_entry_point": {
"is_active": true,
"expires_at": "2026-01-14T10:30:00.000Z"
},
"is_free": true,
"free_reason": "ctwa",
"free_service_messages": {
"limit": 1000,
"used": 312,
"remaining": 688
}
},
"instagram": {
"is_window_active": false,
"window_expires_at": null
}
}
}
Free Window Click-to-WhatsApp
whatsapp.free_entry_point menunjukkan apakah customer sedang berada di free entry point window dari iklan Click-to-WhatsApp. Sejak Oktober 2026 window ini berlaku hingga 7 hari, dan semua pesan yang dikirim ke customer selama window ini gratis, termasuk template. Window terbuka saat customer mengirim pesan dari iklan. Pesan yang dikirim di dalam window ini tidak dihitung ke 1.000 pesan layanan gratis. expires_at bernilai null jika customer tidak pernah datang dari iklan.
Ini estimasi: kami memulai window dari pesan iklan, sedangkan Meta memulainya dari balasan pertama Anda (dalam 24 jam). Invoice Meta Anda adalah angka final.
Apakah Pesan Berikutnya Gratis?
whatsapp.is_free menunjukkan apakah pesan berikutnya ke customer ini gratis. free_reason menjelaskan alasannya:
"ctwa": customer sedang berada di free window Click-to-WhatsApp. Semua pesan gratis, termasuk template."free_tier": window 24 jam terbuka dan nomor telepon customer masih punya sisa pesan layanan gratis bulan ini. Pesan bebas gratis. Template tetap berbayar.null: pesan berikutnya berbayar, atau window tertutup dan Anda hanya bisa mengirim template.
free_service_messages menunjukkan jumlah 1.000 pesan layanan gratis yang terpakai dan tersisa bulan ini (UTC) pada nomor telepon yang terhubung ke customer. Bernilai null jika customer tidak punya nomor yang terhubung. Angka ini juga estimasi.
Atur Blacklist
Tambahkan atau hapus customer dari blacklist. Customer yang di-blacklist tidak akan menerima pesan apa pun.
PATCH /api/v1/public/customers/:id/blacklist
URL Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
id | string | ya | Customer ID (CUID), nomor telepon, atau username Instagram |
Body Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
blacklisted | boolean | ya | Isi true untuk blacklist, false untuk menghapus dari blacklist |
Contoh Request
- cURL
- JavaScript
- Python
curl -X PATCH "https://chat.api.co.id/api/v1/public/customers/628123456789/blacklist" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"blacklisted": true}'
const response = await fetch(
"https://chat.api.co.id/api/v1/public/customers/628123456789/blacklist",
{
method: "PATCH",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ blacklisted: true })
}
);
const { data } = await response.json();
console.log("Blacklisted:", data.blacklisted);
import requests
response = requests.patch(
"https://chat.api.co.id/api/v1/public/customers/628123456789/blacklist",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={"blacklisted": True}
)
data = response.json()["data"]
print("Blacklisted:", data["blacklisted"])
Response
{
"success": true,
"data": {
"id": "clxxx1234567890",
"phone_number": "628123456789",
"name": "John Doe",
"blacklisted": true,
"updated_at": "2026-04-03T10:00:00.000Z"
}
}
Catatan Customer
Kelola catatan internal yang terkait dengan customer. Catatan hanya terlihat oleh tim Anda.
GET /api/v1/public/customers/:id/notes
POST /api/v1/public/customers/:id/notes
DELETE /api/v1/public/customers/:id/notes/:noteId
URL Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
id | string | ya | Customer ID (CUID), nomor telepon, atau username Instagram |
noteId | string | ya | ID catatan (hanya wajib untuk DELETE) |
Body Parameter (POST)
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
content | string | ya | Isi teks catatan |
Daftar Catatan
- cURL
- JavaScript
- Python
curl -X GET "https://chat.api.co.id/api/v1/public/customers/628123456789/notes" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch(
"https://chat.api.co.id/api/v1/public/customers/628123456789/notes",
{
headers: {
"Authorization": "Bearer YOUR_API_KEY"
}
}
);
const { data } = await response.json();
console.log("Notes:", data);
import requests
response = requests.get(
"https://chat.api.co.id/api/v1/public/customers/628123456789/notes",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
notes = response.json()["data"]
print("Notes:", notes)
Response Daftar Catatan
{
"success": true,
"data": [
{
"id": "note_abc123",
"content": "VIP customer, handle with care",
"created_by": "[email protected]",
"created_at": "2026-01-05T14:00:00.000Z"
},
{
"id": "note_def456",
"content": "Prefers communication in English",
"created_by": "[email protected]",
"created_at": "2026-02-10T09:15:00.000Z"
}
]
}
Tambah Catatan
- cURL
- JavaScript
- Python
curl -X POST "https://chat.api.co.id/api/v1/public/customers/628123456789/notes" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "Follow up on order #1234"}'
const response = await fetch(
"https://chat.api.co.id/api/v1/public/customers/628123456789/notes",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ content: "Follow up on order #1234" })
}
);
const { data } = await response.json();
console.log("Note created:", data.id);
import requests
response = requests.post(
"https://chat.api.co.id/api/v1/public/customers/628123456789/notes",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={"content": "Follow up on order #1234"}
)
data = response.json()["data"]
print("Note created:", data["id"])
Response Tambah Catatan
{
"success": true,
"data": {
"id": "note_ghi789",
"content": "Follow up on order #1234",
"created_by": "[email protected]",
"created_at": "2026-04-03T10:00:00.000Z"
}
}
Hapus Catatan
- cURL
- JavaScript
- Python
curl -X DELETE "https://chat.api.co.id/api/v1/public/customers/628123456789/notes/note_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch(
"https://chat.api.co.id/api/v1/public/customers/628123456789/notes/note_abc123",
{
method: "DELETE",
headers: {
"Authorization": "Bearer YOUR_API_KEY"
}
}
);
const { success } = await response.json();
console.log("Deleted:", success);
import requests
response = requests.delete(
"https://chat.api.co.id/api/v1/public/customers/628123456789/notes/note_abc123",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
print("Deleted:", response.json()["success"])
Response Hapus Catatan
{
"success": true,
"message": "Note deleted successfully"
}
Coba langsung
Tekan Try it lalu tempel API key Anda (kc_live_...) ke kolom API key (Bearer). Dapatkan key dari API Keys. Request dijalankan ke akun live Anda, jadi endpoint yang mengirim, membuat, atau menghapus akan memengaruhi data sungguhan.
- GET/api/v1/public/customersList Customers
- POST/api/v1/public/customersCreate Customer
- GET/api/v1/public/customers/{id}Get Customer
- PATCH/api/v1/public/customers/{id}Update Customer
- DELETE/api/v1/public/customers/{id}Delete Customer
- POST/api/v1/public/customers/{id}/consentCustomer Consent
- GET/api/v1/public/customers/{id}/window-statusCheck Messaging Window
- PATCH/api/v1/public/customers/{id}/blacklistToggle Blacklist
- GET/api/v1/public/customers/{id}/notesList Notes
- POST/api/v1/public/customers/{id}/notesAdd Note
- DELETE/api/v1/public/customers/{id}/notes/{noteId}Delete Note