> For the complete documentation index, see [llms.txt](https://docs.antbuddy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.antbuddy.com/huong-dan-tich-hop-api-team-technical-api-integration-guide-technical-team/antcrm/1.-api-customer.md).

# 1. API customer

&#x20;**Customer API**

There are 3 types of customers on AntCrm:

* Lead (contactType: “lead")
* Contact (contactType: “customer", type: 0) - Account (contactType: “customer", type: 1)

**a. Customer list or details of 1 customer via phone number or email or id on Ant CRM**&#x20;

URL: <https://apiring.antbuddy.com>/contacts

Method: GET

Content-Type: application/json

| **Parameters**     | **Type** | **Required** | **Getting Explained**                                             |
| ------------------ | -------- | ------------ | ----------------------------------------------------------------- |
| contactType        | string   |              | “lead” or “customer”                                              |
| type               | string   |              | Customer Type. (0: contact, 1: account)                           |
| phone              | string   |              | phone number                                                      |
| customerId         | string   |              | Id of contact or account                                          |
| leadId             | string   |              | lead id                                                           |
| email              | string   |              | email                                                             |
| <p>page</p><p></p> | number   |              | Sequence number of pages, each page has a maximum of 20 customers |
| limit              | number   |              | Number of records per page                                        |
| updateAtf          | string   |              | <p>Updated from. For exp: 2025-05-30</p><p><br> </p>              |
| updateAtt          | string   |              | Updated to. For exp: 2025-05-30                                   |
| createdAtf         | string   |              | <p>Created from.</p><p> For exp: 2025-05-30</p>                   |
| createdAtt         | string   |              | <p>Created to. </p><p>For exp: 2025-05-30</p>                     |

Results returned:

HTTP Response Code: 200

Response:

{ "name": “”, "contactType": ””, “type”: “”, “leadId”: “”, “customerId”: “”, “dateOfBirth”: “”, “gender”: “”, addresses: \[], phones: \[], emails: \[], industry: “", im: \[], bgInfo: “”, stage: “”, tags: \[], sourceContact: “”, responsibleStaff: “”, cusFields: \[], scoreAvailable: Number, // Điểm tích luỹ scoreRank: Number, // Điểm hạng rankName: “” // Hạng thành viên, createdAt: “”, // Thời gian tạo khách hàng updatedAt: “” // Thời gian cập nhật khách hàng createdByBot: “” //Người tạo khách hàng "sourceLead"://Nếu khách hàng được convert từ lead { "\_id": "676bba5b4fc70f0b668c8464", "code": "6", "name": "Website"}, "historiesAds": \[ { "\_id": "682713cc7965c52864ea2017", "fb\_ads\_id": "120226012811620067", "fb\_post\_id": "811442567679759", "createdAt": 1747391436702 } ]

**b.Add customers**&#x20;

URL: <https://apiring.antbuddy.com>/contacts

hod: POST

Content-Type: application/json

| **Parameters**    | **Type** | **Required** | **Explain**                                           |
| ----------------- | -------- | ------------ | ----------------------------------------------------- |
| name              | string   | AND          | Customer name                                         |
| customerIdApiRing | string   | AND          | Customer's code                                       |
| type              | string   |              | Customer Type. (0: contact, 1: account). Default is 0 |
| contactType       | string   |              | “lead" or “customer". Default is lead                 |
| dateOfBirth       | string   |              | Date of birth. (“March 15, 2000”)                     |

| gender addresses    | string array |   | <p>Sex. (0: Male, 1: Female, 2: Other). Default is 2</p><p>Customer address.</p><p>\[{ city: "Ho Chi Minh City", state: "Tan Binh District", street: "319", (house number) streetName: "Nguyen Kiem", wards: "Ward 12",</p><p>"country": {</p><p>"code": "VN",</p><p>"name": "Vietnam"</p><p>}</p><p>}]</p><p>Record the same as the address on the system.</p> |
| ------------------- | ------------ | - | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| phones              | array        |   | <p>Phone number.</p><p>\[{type:”Work”, value: “01223223”} ]</p>                                                                                                                                                                                                                                                                                                 |
| emails              | array        |   | <p>Email</p><p>\[{type: “Work”, value: “<xyz@example.com>”}]</p>                                                                                                                                                                                                                                                                                                |
| industry            | string       |   | Industry (“Real Estate”)                                                                                                                                                                                                                                                                                                                                        |
| in the              | array        |   | <p>Social network.</p><p>\[{protocol: “Facebook”, “value”: “<https://abc.com”>}]</p>                                                                                                                                                                                                                                                                            |
| bgInfo              | string       |   | Note. (“VIP Customer”)                                                                                                                                                                                                                                                                                                                                          |
| stage               | string       |   | Status. ("A new customer")                                                                                                                                                                                                                                                                                                                                      |
| tags                | string       |   | <p>Label.</p><p>\[ “Not yet contacted”, “Contacted” ]</p>                                                                                                                                                                                                                                                                                                       |
| sourceContact       | string       |   | Contact source. ("Advertisement")                                                                                                                                                                                                                                                                                                                               |
| responsibleStaff    | string       |   | <p>Email of the employee in charge.</p><p>(“<nhanvien1@gmail.com>”)</p>                                                                                                                                                                                                                                                                                         |
| cusFields           | array        |   | <p>Custom fields on AntCRM.</p><p>\[</p><p>{ name: "Shipping</p><p>unit",</p><p>value: “Fast delivery”</p><p>]</p>                                                                                                                                                                                                                                              |
| group               | string       |   | <p>Assign the group that has been configured with assignment rules in the CRM.                                                                                                                                                                                                                                                                                  |
| <br>\[              |              |   |                                                                                                                                                                                                                                                                                                                                                                 |
| <br>"group": "test" |              |   |                                                                                                                                                                                                                                                                                                                                                                 |
| <br>]</p>           |              |   |                                                                                                                                                                                                                                                                                                                                                                 |

}

Results returned:

HTTP Response Code: 200

Response:

{

"success": 1,

"leadId" or “customerId”: 9457 (customer id on antcrm) }

**c. Edit customer**

URL: <https://apiring.antbuddy.com>/contacts

Method: PUT

Content-Type: application/json

| **Parameters**                            | **Type**                 | **Catch Setc** | **Explain**                                                                                                                                                                                                                                                                                                                                                            |
| ----------------------------------------- | ------------------------ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| leadId or customerId or customerIdApiRing | string                   | AND            | Customer id on antcrm or customer code passed in                                                                                                                                                                                                                                                                                                                       |
| name                                      | string                   |                | Customer name                                                                                                                                                                                                                                                                                                                                                          |
| dateOfBirth                               | string                   |                | Date of birth. (“March 15, 2000”)                                                                                                                                                                                                                                                                                                                                      |
| gender                                    | string                   |                | Sex. (0: Male, 1: Female, 2: Other)                                                                                                                                                                                                                                                                                                                                    |
| <p>addresses</p><p>phones</p>             | <p>array</p><p>array</p> |                | <p>Customer address.</p><p>\[{ city: "Ho Chi Minh City", state: "Tan Binh District", street: "319", (house number) streetName: "Nguyen Kiem", wards: "Ward 12",</p><p>"country": {</p><p>"code": "VN",</p><p>"name": "Vietnam"</p><p>}</p><p>}]</p><p>Record the same as the address on the system.</p><p>Phone number.</p><p>\[{type:”Work”, value: “01223223”} ]</p> |
| emails                                    | array                    |                | <p>Email</p><p>\[type: “Work”, value:</p><p>““<xyz@example.com>””]</p>                                                                                                                                                                                                                                                                                                 |
| industry                                  | string                   |                | Industry (“Real Estate”)                                                                                                                                                                                                                                                                                                                                               |
| in the                                    | array                    |                | <p>Social network.</p><p>\[protocol: “Facebook”, “value”: “</p><p>“<https://abc.com””> ]</p>                                                                                                                                                                                                                                                                           |
| bgInfo                                    | string                   |                | Note. (“VIP Customer”)                                                                                                                                                                                                                                                                                                                                                 |
| stage                                     | string                   |                | Status. ("A new customer")                                                                                                                                                                                                                                                                                                                                             |
| tags                                      | string                   |                | <p>Label.</p><p>\[ “Not yet contacted”, “Contacted” ]</p>                                                                                                                                                                                                                                                                                                              |
| sourceContact                             | string                   |                | Contact source. ("Advertisement")                                                                                                                                                                                                                                                                                                                                      |
| responsibleStaff                          | string                   |                | <p>Email of the person in charge.</p><p>(“<nhanvien1@gmail.com>”)</p>                                                                                                                                                                                                                                                                                                  |
| cusFields                                 | array                    |                | <p>Custom fields on AntCRM.</p><p>\[</p><p>{</p><p>name: "Shipping unit",</p><p>value: “Fast delivery”</p><p>}</p><p>]</p>                                                                                                                                                                                                                                             |

Results returned:

HTTP Response Code: 200

Response:

{

"success": 1,

"leadId" or “customerId”: 9457 (customer id on antcrm) }

**d. Delete customer**

URL: <https://apiring.antbuddy.com>/contacts

Method: DELETE

Content-Type: application/json

| **Parameters**                            | **Type** | **Cat ch set c**         | **Explain**                                      |
| ----------------------------------------- | -------- | ------------------------ | ------------------------------------------------ |
| leadId or customerId or customerIdApiRing | string   | <p>A</p><p>N</p><p>D</p> | Customer id on antcrm or customer code passed in |

Results returned:

HTTP Response Code: 200

Response:

{

"success": 1

}

**e. Bulk Add Customers**

URL: <https://apiring.antbuddy.com>/contacts/package

Method: POST

Content-Type: application/json

Limit 100 contacts per request

Body: \[{customer data A}, {customer data B}]

| **Parameters**    | **Type**     | **Cat ch set c**         | **Explain**                                                                                                                                                                                                                                                                                                                                                     |
| ----------------- | ------------ | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name              | string       | <p>A</p><p>N</p><p>D</p> | Customer name                                                                                                                                                                                                                                                                                                                                                   |
| customerIdApiRing | string       | <p>A</p><p>N</p><p>D</p> | Customer's code                                                                                                                                                                                                                                                                                                                                                 |
| type              | string       |                          | Customer Type. (0: contact, 1: account). Default is 0                                                                                                                                                                                                                                                                                                           |
| contactType       | string       |                          | “lead" or “customer". Default is lead                                                                                                                                                                                                                                                                                                                           |
| dateOfBirth       | string       |                          | Date of birth. (“March 15, 2000”)                                                                                                                                                                                                                                                                                                                               |
| gender addresses  | string array |                          | <p>Sex. (0: Male, 1: Female, 2: Other). Default is 2</p><p>Customer address.</p><p>\[{ city: "Ho Chi Minh City", state: "Tan Binh District", street: "319", (house number) streetName: "Nguyen Kiem", wards: "Ward 12",</p><p>"country": {</p><p>"code": "VN",</p><p>"name": "Vietnam"</p><p>}</p><p>}]</p><p>Record the same as the address on the system.</p> |
| phones            | array        |                          | <p>Phone number.</p><p>\[{type:”Work”, value: “01223223”} ]</p>                                                                                                                                                                                                                                                                                                 |
| emails            | array        |                          | <p>Email</p><p>\[{type: “Work”, value: “<xyz@example.com>”}]</p>                                                                                                                                                                                                                                                                                                |
| industry          | string       |                          | Industry (“Real Estate”)                                                                                                                                                                                                                                                                                                                                        |
| in the            | array        |                          | <p>Social network.</p><p>\[{protocol: “Facebook”, “value”: “<https://abc.com”>}]</p>                                                                                                                                                                                                                                                                            |
| bgInfo            | string       |                          | Note. (“VIP Customer”)                                                                                                                                                                                                                                                                                                                                          |
| stage             | string       |                          | Status. ("A new customer")                                                                                                                                                                                                                                                                                                                                      |
| tags              | string       |                          | <p>Label.</p><p>\[ “Not yet contacted”, “Contacted” ]</p>                                                                                                                                                                                                                                                                                                       |
| sourceContact     | string       |                          | Contact source. ("Advertisement")                                                                                                                                                                                                                                                                                                                               |
| responsibleStaff  | string       |                          | Email of the person in charge. (“<nhanvien1@gmail.com>”)                                                                                                                                                                                                                                                                                                        |
| cusFields         | array        |                          | <p>Custom fields on AntCRM.</p><p>\[</p><p>{ name: "Shipping unit", value: “Fast delivery”</p><p>}</p><p>]</p>                                                                                                                                                                                                                                                  |

Results returned:

HTTP Response Code: 200

Response:

{

"success": 1,

"leadId" or “customerId”: \[9457, 9458, 9459] (customer id on antcrm) }

**f. List deleted Customer**

URL: <https://apiring.antbuddy.com>/contacts/list-deleted

Method: GET

Content-Type: application/json

| **Parameters**     | **Type** | **Required** | **Getting Explained**                                             |
| ------------------ | -------- | ------------ | ----------------------------------------------------------------- |
| contactType        | string   |              | “lead” or “customer”                                              |
| phone              | string   |              | phone number                                                      |
| name               | string   |              | name                                                              |
| email              | string   |              | email                                                             |
| <p>page</p><p></p> | number   |              | Sequence number of pages, each page has a maximum of 20 customers |
| limit              | number   |              | Number of records per page                                        |

Results returned:

HTTP Response Code: 200

Response:

```json
{
  "success": true,
  "page": 1,
  "limit": 20,
  "total": 1,
  "data": [
    {
      "_id": "6969faa3999a1791900c8089",
      "contactType": "lead",
      "membership": 0,
      "fullInfoTransactionApiRing": false,
      "fullInfoCustomerApiRing": false,
      "type": 0,
      "normalize": "dai-toan",
      "title": "",
      "lastname": "",
      "passport": "",
      "gender": 2,
      "dateOfBirth": null,
      "dateOfBirth2": "",
      "dayOfBirth": null,
      "monthOfBirth": null,
      "yearOfBirth": null,
      "avatar": "",
      "facebook": "",
      "linkedin": "",
      "twitter": "",
      "sourceLead": null,
      "sourceContact": null,
      "leadStatus": null,
      "bgInfo": "",
      "tags": [],
      "noteCount": 0,
      "favorites": [],
      "contactId": [
        "2709044346175608620"
      ],
      "stage": null,
      "leadStage": null,
      "sendSMSCount": 0,
      "sendEmailCount": 0,
      "calledCount": 0,
      "industry": null,
      "normalizeCompanyLead": "",
      "isConvertedLead": false,
      "segments": [],
      "isFollowOA": false,
      "blockedFB": false,
      "zalo_id": "",
      "omniName": "",
      "pageId": "2129871364684708154",
      "zaloPAFriendStatus": "not_friend",
      "name": "Đại Toàn",
      "org": "6721f763a959f80f166c94ec",
      "createdBy": "6721f757a959f80f166c94e8",
      "createdByBot": "PERSONAL_ZALO",
      "phones": [],
      "addresses": [
        {
          "type": "Work",
          "street": "",
          "streetName": "",
          "city": "",
          "state": "",
          "wards": "",
          "cityCode": "",
          "stateCode": "",
          "wardsCode": "",
          "zip": "",
          "_id": "6969faa3999a1791900c808a",
          "country": {
            "code": "VN",
            "name": "Vietnam"
          }
        }
      ],
      "emails": [],
      "im": [],
      "websites": [],
      "cusFields": [],
      "permit": {
        "status": 1
      },
      "createdAt": 1768553123782,
      "historiesAds": [],
      "updatedAt": 1770000187327,
      "responsibleStaff": "6721f757a959f80f166c94e8",
      "leadId": 1231,
      "__v": 0,
      "inTrash": {
        "_id": "69800f3b8184a173bdaf85bb",
        "trashAt": 1770000187310,
        "trashBy": "6721f757a959f80f166c94e8"
      }
    }
  ]
}
```

**g. List merge customer**

URL: <https://apiring.antbuddy.com>/contacts/merged

Method: GET

Content-Type: application/json

| **Parameters**     | **Type** | **Required** | **Getting Explained**                                             |
| ------------------ | -------- | ------------ | ----------------------------------------------------------------- |
| phone              | string   |              | phone number                                                      |
| name               | string   |              | name                                                              |
| email              | string   |              | email                                                             |
| <p>page</p><p></p> | number   |              | Sequence number of pages, each page has a maximum of 20 customers |
| limit              | number   |              | Number of records per page                                        |

Results returned:

HTTP Response Code: 200

Response:

```json
{
  "success": true,
  "page": 1,
  "limit": 20,
  "total": 1,
  "data": [
    {
      "_id": "68246bf18cd2b8bf9efb3d86",
      "contactType": "customer",
      "membership": 0,
      "fullInfoTransactionApiRing": false,
      "fullInfoCustomerApiRing": false,
      "type": 0,
      "normalize": "tuong-huynh",
      "title": "",
      "lastname": "Huynh",
      "passport": "",
      "gender": 2,
      "dateOfBirth": null,
      "dateOfBirth2": "",
      "dayOfBirth": null,
      "monthOfBirth": null,
      "yearOfBirth": null,
      "avatar": "",
      "facebook": "",
      "linkedin": "",
      "twitter": "",
      "sourceLead": null,
      "sourceContact": null,
      "leadStatus": null,
      "bgInfo": "",
      "tags": [],
      "noteCount": 0,
      "favorites": [],
      "contactId": [],
      "stage": null,
      "leadStage": null,
      "sendSMSCount": 0,
      "sendEmailCount": 0,
      "calledCount": 0,
      "industry": null,
      "normalizeCompanyLead": "",
      "isConvertedLead": false,
      "segments": [],
      "blockedFB": false,
      "zalo_id": "",
      "omniName": "",
      "files": [],
      "scoreAvailable": 0,
      "scoreRank": 0,
      "pageId": "",
      "name": "Tuong",
      "permit": {
        "status": 1,
        "group": null,
        "users": []
      },
      "responsibleStaff": "6721f757a959f80f166c94e8",
      "emails": [
        {
          "type": "Work",
          "_id": "68246bf18cd2b8bf9efb3d87",
          "value": "tuonghuynh76@gmail.com"
        }
      ],
      "phones": [
        {
          "type": "Work",
          "_id": "68246bf18cd2b8bf9efb3d88",
          "value": "0948747491"
        }
      ],
      "createdBy": "6721f757a959f80f166c94e8",
      "org": "6721f763a959f80f166c94ec",
      "assignedAt": 1747217393209,
      "reassignLeadStatus": "",
      "addresses": [
        {
          "type": "Work",
          "street": "",
          "streetName": "",
          "city": "",
          "state": "",
          "wards": "",
          "cityCode": "",
          "stateCode": "",
          "wardsCode": "",
          "zip": "",
          "_id": "68246bf18cd2b8bf9efb3d89",
          "country": {
            "code": "VN",
            "name": "Vietnam"
          }
        }
      ],
      "im": [],
      "websites": [],
      "cusFields": [
        {
          "_id": "68343db51d97091cc3b510b5",
          "id": "6747f575862cf9129dd35273",
          "value": "255"
        },
        {
          "_id": "68343de51d97091cc3b511f4",
          "id": "68343ddb1d97091cc3b5110e",
          "value": "20000"
        },
        {
          "_id": "68343e3b1d97091cc3b515b2",
          "id": "68343da11d97091cc3b50fc7",
          "value": "KH9943538"
        }
      ],
      "createdAt": 1747217393214,
      "historiesAds": [],
      "updatedAt": 1764647275405,
      "customerId": 12,
      "__v": 0,
      "zaloPAFriendStatus": "unfriend",
      "inTrash": {
        "_id": "689570943412a91900277beb",
        "name": "Tường Huỳnh",
        "phones": [
          {
            "type": "Work",
            "_id": "689aee5e223ce9b349fa7bc9",
            "value": "0948747491"
          }
        ],
        "emails": [
          {
            "type": "Work",
            "_id": "68246bf18cd2b8bf9efb3d87",
            "value": "tuonghuynh76@gmail.com"
          }
        ]
      }
    }
  ]
}
```
