CRM
Liên hệ, cơ hội/deal, hoạt động — dữ liệu khách hàng cốt lõi.
9 endpoint · base /api/v1/crm
Tìm/liệt kê liên hệ.
search_contactsScope: crm.contacts.viewAPI key / ứng dụngTham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
q | string | query | không | Từ khóa tìm kiếm |
pageNumber | int | query | không | Trang (bắt đầu từ 1) |
pageSize | int | query | không | Số dòng mỗi trang (mặc định 20 ở CRM và Sales orders/customers; Sales products mặc định 50) |
Ví dụ
curl https://api.nextx.vn/api/v1/crm/contacts?q=...&pageNumber=1&pageSize=1 \
-H "Authorization: Bearer <ACCESS_TOKEN>"Ví dụ phản hồi
{
"items": [
{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"code": "string",
"contactType": "string",
"fullName": "string",
"email": "string",
"phone": "string",
"jobTitle": "string",
"companyName": "string",
"avatarUrl": "string",
"tier": "string",
"hasCustomerProfile": false,
"tags": [
null
],
"createdAt": "2026-10-27T09:00:00+07:00",
"lifecycleStage": "string",
"address": "string",
"city": "string",
"ward": "string",
"assigneeName": "string",
"assigneeId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"pipelineStageName": "string",
"pipelineStageColor": "string",
"orderCount": 0,
"dealCount": 0,
"topDealValue": 0,
"topDealStage": "string",
"topDealStageColor": "string",
"topDealCloseDate": "2026-10-27",
"topDealId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"provinceCode": "string",
"customerStatus": "string",
"groupName": "string",
"lastActivityAt": "2026-10-27T09:00:00+07:00",
"groupIcon": "string",
"groupColor": "string",
"statusLabel": "string",
"statusIcon": "string",
"statusColor": "string",
"customFields": {},
"sourceId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"assignedAt": "2026-10-27T09:00:00+07:00",
"leadScore": 0,
"leadTier": "string",
"latestCommentText": "string",
"latestCommentAt": "2026-10-27T09:00:00+07:00",
"notes": "string",
"sourceName": "string",
"phone2": "string",
"phone3": "string",
"dob": "2026-10-27",
"channelOrigin": {
"channelType": null,
"channelAccountName": null,
"otherAccountCount": null
},
"chatSummary": {
"openCount": null,
"totalCount": null,
"unreadCount": null,
"lastMessageAt": null,
"lastMessagePreview": null,
"lastMessageDirection": null,
"lastChannelType": null,
"awaitingReplyMinutes": null,
"slaBreached": null,
"botHandling": null,
"linkedOrderCodes": null,
"conversationTags": null
},
"nextActivityAt": "2026-10-27T09:00:00+07:00",
"nextActivityKind": "string",
"nextActivityTitle": "string",
"contactStatusId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"branchId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"branchName": "string",
"slaStage": 0,
"slaContactedAt": "2026-10-27T09:00:00+07:00"
}
],
"totalCount": 0,
"page": 0,
"pageSize": 0,
"totalPages": 0,
"hasNextPage": false,
"hasPreviousPage": false
}Chi tiết 1 liên hệ.
get_contactScope: crm.contacts.viewAPI key / ứng dụngTham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
id | GUID | path | có | Contact id |
Ví dụ
curl https://api.nextx.vn/api/v1/crm/contacts/<id> \
-H "Authorization: Bearer <ACCESS_TOKEN>"Ví dụ phản hồi
{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"code": "string",
"contactType": "string",
"fullName": "string",
"email": "string",
"phone": "string",
"jobTitle": "string",
"companyName": "string",
"website": "string",
"avatarUrl": "string",
"gender": "string",
"dob": "2026-10-27",
"address": "string",
"city": "string",
"country": "string",
"identityNumber": "string",
"identityIssuedDate": "2026-10-27",
"identityIssuedPlace": "string",
"ward": "string",
"phone2": "string",
"phone3": "string",
"linkedinUrl": "string",
"tier": "string",
"isDecisionMaker": false,
"customFields": {},
"sourceRef": "string",
"tags": [
{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"name": "string",
"color": "string"
}
],
"customerProfile": {
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"tier": "string",
"customerStatus": "string",
"lifetimeValue": 0,
"createdAt": "2026-10-27T09:00:00+07:00"
},
"supplierInfo": {
"supplierId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"supplierName": "string",
"supplierCode": "string"
},
"createdAt": "2026-10-27T09:00:00+07:00",
"updatedAt": "2026-10-27T09:00:00+07:00",
"lifecycleStage": "string",
"industryId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"sourceId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"customerGroupId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"contactPersonName": "string",
"contactPersonPhone": "string",
"contactPersonRelationship": "string",
"provinceCode": "string",
"districtCode": "string",
"wardCode": "string",
"notes": "string",
"groupName": "string",
"groupIcon": "string",
"groupColor": "string",
"assigneeId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"assigneeName": "string",
"assignedAt": "2026-10-27T09:00:00+07:00",
"statusLabel": "string",
"statusIcon": "string",
"statusColor": "string",
"contactStatusId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"branchId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"branchName": "string",
"taxCode": "string",
"bankAccountNumber": "string",
"bankName": "string",
"bankBranch": "string",
"leadScore": 0,
"leadTier": "string",
"referralCodeId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"referralCodeKind": "string",
"referralCode": "string",
"firstTouch": {
"intakeEventId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"receivedAt": "2026-10-27T09:00:00+07:00",
"doorType": "string",
"doorName": "string",
"sourceId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"sourceRaw": "string",
"utmSource": "string",
"utmMedium": "string",
"utmCampaign": "string",
"landingUrl": "string",
"referralRaw": "string",
"referralMatch": "string"
}
}Tạo liên hệ mới.
create_contactScope: crm.contacts.createAPI key / ứng dụngTham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
Idempotency-Key Mới | string | header | không | Mã do bạn tự sinh cho MỖI thao tác ghi (vd UUID), tối đa 200 ký tự. Gửi lại cùng mã trong 24 giờ ⇒ nhận lại đúng kết quả lần đầu, không tạo bản ghi thứ hai. Cùng mã mà khác nội dung ⇒ 422. |
contactType | string | body | có | INDIVIDUAL hoặc BUSINESS; không đổi được sau khi tạo |
fullName | string | body | có | — |
email | string | body | không | — |
phone | string | body | không | — |
companyName | string | body | không | — |
jobTitle | string | body | không | — |
customFields | object | body | không | Khoá là mã trường tuỳ biến |
Ví dụ
curl -X POST https://api.nextx.vn/api/v1/crm/contacts \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Idempotency-Key: 7f3c2a90-…" \
-H "Content-Type: application/json" \
-d '{
"contactType": "...",
"fullName": "...",
"email": "...",
"phone": "...",
"companyName": "...",
"jobTitle": "...",
"customFields": {}
}'Ví dụ phản hồi
{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"code": "string",
"contactType": "string",
"fullName": "string",
"email": "string",
"phone": "string",
"jobTitle": "string",
"companyName": "string",
"website": "string",
"avatarUrl": "string",
"gender": "string",
"dob": "2026-10-27",
"address": "string",
"city": "string",
"country": "string",
"identityNumber": "string",
"identityIssuedDate": "2026-10-27",
"identityIssuedPlace": "string",
"ward": "string",
"phone2": "string",
"phone3": "string",
"linkedinUrl": "string",
"tier": "string",
"isDecisionMaker": false,
"customFields": {},
"sourceRef": "string",
"tags": [
{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"name": "string",
"color": "string"
}
],
"customerProfile": {
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"tier": "string",
"customerStatus": "string",
"lifetimeValue": 0,
"createdAt": "2026-10-27T09:00:00+07:00"
},
"supplierInfo": {
"supplierId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"supplierName": "string",
"supplierCode": "string"
},
"createdAt": "2026-10-27T09:00:00+07:00",
"updatedAt": "2026-10-27T09:00:00+07:00",
"lifecycleStage": "string",
"industryId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"sourceId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"customerGroupId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"contactPersonName": "string",
"contactPersonPhone": "string",
"contactPersonRelationship": "string",
"provinceCode": "string",
"districtCode": "string",
"wardCode": "string",
"notes": "string",
"groupName": "string",
"groupIcon": "string",
"groupColor": "string",
"assigneeId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"assigneeName": "string",
"assignedAt": "2026-10-27T09:00:00+07:00",
"statusLabel": "string",
"statusIcon": "string",
"statusColor": "string",
"contactStatusId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"branchId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"branchName": "string",
"taxCode": "string",
"bankAccountNumber": "string",
"bankName": "string",
"bankBranch": "string",
"leadScore": 0,
"leadTier": "string",
"referralCodeId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"referralCodeKind": "string",
"referralCode": "string",
"firstTouch": {
"intakeEventId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"receivedAt": "2026-10-27T09:00:00+07:00",
"doorType": "string",
"doorName": "string",
"sourceId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"sourceRaw": "string",
"utmSource": "string",
"utmMedium": "string",
"utmCampaign": "string",
"landingUrl": "string",
"referralRaw": "string",
"referralMatch": "string"
}
}Pipeline cơ hội/deal.
get_deal_pipelineScope: crm.opportunities.viewAPI key / ứng dụngTham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
q | string | query | không | Từ khoá theo tên/mã cơ hội |
status | string | query | không | Trạng thái cơ hội |
stageId | GUID | query | không | Lọc theo giai đoạn (pipeline stage) |
pageNumber | int | query | không | Trang (bắt đầu từ 1) |
pageSize | int | query | không | Số dòng mỗi trang (mặc định 20 ở CRM và Sales orders/customers; Sales products mặc định 50) |
Ví dụ
curl https://api.nextx.vn/api/v1/crm/opportunities?q=...&status=...&stageId=%3CstageId%3E&pageNumber=1&pageSize=1 \
-H "Authorization: Bearer <ACCESS_TOKEN>"Ví dụ phản hồi
{
"items": [
{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"code": "string",
"name": "string",
"contactId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"contactName": "string",
"contactCompanyName": "string",
"pipelineStageId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"pipelineStageName": "string",
"pipelineStageColor": "string",
"estimatedValue": 0,
"probability": 0,
"expectedCloseDate": "2026-10-27",
"assigneeId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"assigneeName": "string",
"description": "string",
"status": "string",
"wonReason": "string",
"lostReason": "string",
"lostToCompetitor": "string",
"wonAt": "2026-10-27T09:00:00+07:00",
"createdAt": "2026-10-27T09:00:00+07:00",
"isOverdue": false,
"daysOverdue": 0,
"quotationCount": 0,
"contractCount": 0,
"latestCommentText": "string",
"latestCommentAt": "2026-10-27T09:00:00+07:00",
"reopenCount": 0,
"contactPhone": "string",
"campaignName": "string",
"nextCallAt": "2026-10-27T09:00:00+07:00",
"callCount": 0,
"lastDisposition": "string",
"lastCalledAt": "2026-10-27T09:00:00+07:00",
"tags": [
null
]
}
],
"totalCount": 0,
"page": 0,
"pageSize": 0,
"totalPages": 0,
"hasNextPage": false,
"hasPreviousPage": false
}Chi tiết deal.
get_dealScope: crm.opportunities.viewAPI key / ứng dụngTham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
id | GUID | path | có | — |
Ví dụ
curl https://api.nextx.vn/api/v1/crm/opportunities/<id> \
-H "Authorization: Bearer <ACCESS_TOKEN>"Ví dụ phản hồi
{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"code": "string",
"name": "string",
"contactId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"contactName": "string",
"leadId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"leadName": "string",
"pipelineStageId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"pipelineStageName": "string",
"pipelineStageColor": "string",
"estimatedValue": 0,
"probability": 0,
"expectedCloseDate": "2026-10-27",
"assigneeId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"assigneeName": "string",
"description": "string",
"customFields": {},
"status": "string",
"wonReason": "string",
"lostReason": "string",
"lostToCompetitor": "string",
"actualValue": 0,
"actualCloseDate": "2026-10-27",
"wonAt": "2026-10-27T09:00:00+07:00",
"createdAt": "2026-10-27T09:00:00+07:00",
"updatedAt": "2026-10-27T09:00:00+07:00",
"reopenCount": 0,
"lastReopenReason": "string",
"reopenedAt": "2026-10-27T09:00:00+07:00"
}Đổi giai đoạn (stage) của deal. Không cho phép khi deal đã Thắng hoặc Thua.
update_deal_stageScope: crm.opportunities.manageAPI key / ứng dụngTham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
Idempotency-Key Mới | string | header | không | Mã do bạn tự sinh cho MỖI thao tác ghi (vd UUID), tối đa 200 ký tự. Gửi lại cùng mã trong 24 giờ ⇒ nhận lại đúng kết quả lần đầu, không tạo bản ghi thứ hai. Cùng mã mà khác nội dung ⇒ 422. |
id | GUID | path | có | — |
pipelineStageId | GUID | body | có | Id giai đoạn đích trong pipeline |
Ví dụ
curl -X PATCH https://api.nextx.vn/api/v1/crm/opportunities/<id>/stage \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Idempotency-Key: 7f3c2a90-…" \
-H "Content-Type: application/json" \
-d '{
"pipelineStageId": "<pipelineStageId>"
}'Ví dụ phản hồi
{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"code": "string",
"name": "string",
"contactId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"contactName": "string",
"leadId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"leadName": "string",
"pipelineStageId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"pipelineStageName": "string",
"pipelineStageColor": "string",
"estimatedValue": 0,
"probability": 0,
"expectedCloseDate": "2026-10-27",
"assigneeId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"assigneeName": "string",
"description": "string",
"customFields": {},
"status": "string",
"wonReason": "string",
"lostReason": "string",
"lostToCompetitor": "string",
"actualValue": 0,
"actualCloseDate": "2026-10-27",
"wonAt": "2026-10-27T09:00:00+07:00",
"createdAt": "2026-10-27T09:00:00+07:00",
"updatedAt": "2026-10-27T09:00:00+07:00",
"reopenCount": 0,
"lastReopenReason": "string",
"reopenedAt": "2026-10-27T09:00:00+07:00"
}Thống kê tổng quan cơ hội: tổng open/won/lost, doanh thu dự kiến, dự báo, tỷ lệ thắng, số mới trong N ngày, phân bổ theo giai đoạn.
get_sales_summaryScope: crm.opportunities.viewAPI key / ứng dụngTham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
periodDays | int | query | không | Số ngày gần nhất, từ 1 đến 365; mặc định 30 |
Ví dụ
curl https://api.nextx.vn/api/v1/crm/opportunities/stats?periodDays=1 \
-H "Authorization: Bearer <ACCESS_TOKEN>"Ví dụ phản hồi
{
"totalOpen": 0,
"totalWon": 0,
"totalLost": 0,
"totalEstimatedValue": 0,
"totalWonValue": 0,
"newInPeriod": 0,
"winRate": 0,
"forecast": {
"weightedValue": 0,
"openCount": 0,
"totalOpenEstimatedValue": 0
},
"pipelineDistribution": [
{
"stageId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"stageName": "string",
"stageColor": "string",
"count": 0,
"totalValue": 0
}
]
}Hoạt động gần đây của cả workspace, sắp theo thời gian giảm dần.
get_recent_activitiesScope: crm.reports.viewAPI key / ứng dụngTham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
pageNumber | int | query | không | Trang (bắt đầu từ 1) |
pageSize | int | query | không | 1–100; mặc định 20 |
activityType | string | query | không | Lọc theo loại hoạt động |
fromDate | date | query | không | ISO-8601 |
toDate | date | query | không | ISO-8601 |
contactId | GUID | query | không | — |
Ví dụ
curl https://api.nextx.vn/api/v1/crm/activities?pageNumber=1&pageSize=1&activityType=...&fromDate=2026-06-01&toDate=2026-06-01&contactId=%3CcontactId%3E \
-H "Authorization: Bearer <ACCESS_TOKEN>"Ví dụ phản hồi
{
"items": [
{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"activityType": "string",
"title": "string",
"description": "string",
"contactId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"contactName": "string",
"sourceService": "string",
"actorId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"occurredAt": "2026-10-27T09:00:00+07:00"
}
],
"totalCount": 0,
"page": 0,
"pageSize": 0,
"totalPages": 0,
"hasNextPage": false,
"hasPreviousPage": false
}Tạo task. Chỉ được gắn với MỘT trong ba: liên hệ, cơ hội hoặc ticket; vi phạm thì lỗi 422 TASK_SINGLE_LINK_VIOLATION.
create_taskScope: crm.tasks.manageAPI key / ứng dụngTham số
| Tham số | Kiểu | Vị trí | Bắt buộc | Mô tả |
|---|---|---|---|---|
Idempotency-Key Mới | string | header | không | Mã do bạn tự sinh cho MỖI thao tác ghi (vd UUID), tối đa 200 ký tự. Gửi lại cùng mã trong 24 giờ ⇒ nhận lại đúng kết quả lần đầu, không tạo bản ghi thứ hai. Cùng mã mà khác nội dung ⇒ 422. |
title | string | body | có | Tối đa 500 ký tự |
status | string | body | có | TODO, IN_PROGRESS hoặc DONE |
priority | string | body | có | LOW, MEDIUM hoặc HIGH |
description | string | body | không | — |
dueDate | date | body | không | YYYY-MM-DD |
assigneeId | GUID | body | không | — |
contactId | GUID | body | không | Chỉ một trong contactId / opportunityId / ticketId |
opportunityId | GUID | body | không | — |
ticketId | GUID | body | không | — |
Ví dụ
curl -X POST https://api.nextx.vn/api/v1/crm/tasks \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Idempotency-Key: 7f3c2a90-…" \
-H "Content-Type: application/json" \
-d '{
"title": "...",
"status": "...",
"priority": "...",
"description": "...",
"dueDate": "2026-06-01",
"assigneeId": "<assigneeId>",
"contactId": "<contactId>",
"opportunityId": "<opportunityId>",
"ticketId": "<ticketId>"
}'Ví dụ phản hồi
{
"id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"code": "string",
"title": "string",
"description": "string",
"status": "string",
"priority": "string",
"startDate": "2026-10-27",
"dueDate": "2026-10-27",
"assigneeId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"assigneeName": "string",
"contactId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"contactName": "string",
"contactCode": "string",
"opportunityId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"opportunityName": "string",
"opportunityCode": "string",
"ticketId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"ticketSubject": "string",
"parentTaskId": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"parentTaskTitle": "string",
"parentTaskCode": "string",
"progress": 0,
"customFields": "string",
"createdAt": "2026-10-27T09:00:00+07:00",
"updatedAt": "2026-10-27T09:00:00+07:00",
"remindAt": "2026-10-27T09:00:00+07:00",
"reminderSentAt": "2026-10-27T09:00:00+07:00"
}