> 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/2.-api-get-order.md).

# 2. API get order

a. L**ist of order or details of order  via id on Ant CRM**&#x20;

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

Method: GET

Content-Type: application/json

| **Parameters** | **Type** | **Required** | **Explain**                            |
| -------------- | -------- | ------------ | -------------------------------------- |
| number         | string   |              | Id of opportunity                      |
| page           | number   |              | Page number, maximum 20 Order per page |
| limit          | number   |              | Number of records per page             |
| phones         | string   |              | Phone number of the related customer   |
| customerId     | string   |              | ID of the related customer             |

Results returned:

| **Parameters**                      | **Type**                   | **Required** | **Explain**                                                                                                                                                                           |
| ----------------------------------- | -------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name                                | string                     | AND          | Trading name                                                                                                                                                                          |
| receiverName                        | string                     | AND          | Customer name                                                                                                                                                                         |
| opportunityIdApiRing                | string                     |              | Code orders                                                                                                                                                                           |
| dealByUsers                         | array                      |              | Officer in charge. For example: \[“<thong.nguyen@antbuddy.com>”]                                                                                                                      |
| <p>dealWith</p><p>receiverPhone</p> | <p>Object</p><p>string</p> |              | <p>{</p><p>“customerId”: “123”,</p><p>“name”: “thong”,</p><p>“phones”: \[{type: “Work”, value: “023232”}],</p><p>“customerIdApiRing”: “Customer Id” }</p><p>Customer phone number</p> |

HTTP Response Code: 200

Response:

```
[
  {
    "_id": "672aeafb392be6610aa6ecc0",
    "receiverAddressObj": {
      "street": "",
      "streetName": "",
      "city": "",
      "state": "",
      "wards": "",
      "cityCode": "",
      "stateCode": "",
      "wardsCode": "",
      "zip": "",
      "country": {
        "code": "VN",
        "name": "Vietnam"
      }
    },
    "normalize": "",
    "status": "LOST",
    "description": "",
    "dealBy": {
      "users": [],
      "groups": []
    },
    "contacts": [],
    "shipping_cost": 0,
    "value": 3000000,
    "discount": 0,
    "quantity": 1,
    "canEdit": false,
    "typeDiscount": 0,
    "currency": "VND",
    "coupons": [],
    "package": [],
    "files": [],
    "inActive": false,
    "dealId": "",
    "isCreatedByConvertLead": false,
    "isSampleData": false,
    "totalPayment": 0,
    "tags": [],
    "cusFields": [],
    "deferredDate": null,
    "timeDelivery": null,
    "stage": "672aeae1176c0a60e758996c",
    "permit": {
      "status": 1,
      "groups": []
    },
    "name": "Test",
    "dealWith": {
      "_id": "671eefdb171a8c2a7cb980ee",
      "contactType": "customer",
      "lastname": "",
      "name": "Thuận Trần",
      "phones": [
        {
          "type": "Work",
          "_id": "671eefdb171a8c2a7cb980ef",
          "value": "0349767037"
        }
      ],
      "emails": [],
      "customerId": 2
    },
    "receiverName": "Nghĩa Antbuddy",
    "receiverAddress": "Vietnam",
    "receiverPhone": "0349767038",
    "groupPackage": [],
    "category": "672add3c392be6610aa6856d",
    "subCategory": null,
    "subSubCategory": null,
    "closeDate": 1733504398999,
    "typeTimeDelivery": null,
    "createdBy": "671eeb8a3e1b267430cedcac",
    "org": "671eeb8b3e1b267430cedcaf",
    "createdAt": 1730865915015,
    "stageUpdatedAt": 1730865915015,
    "payments": [],
    "updatedAt": 1748850720184,
    "number": 1,
    "__v": 0
  }
]

```

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

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

Method: POST

Content-Type: application/json

| receiverAddressObj | object |   | <p>Customer address. For example: {</p><p>city: "Ho Chi Minh City",</p><p>state: "Tan Binh district", street: "3", //(apartment number) streetName: "Nguyen Kiem",</p><p>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>                                                                                                                                                                |
| ------------------ | ------ | - | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| groupPackage       | array  |   | <p>Information line. For example:</p><p>\[</p><p>{ name: "Beef combo", // product name quantity: 1, // quantity</p><p>typeDiscount: 1, (0: cash, 1: percent) // type of discount discount: 10, // discount amount or % discount value: 1000, // Product price productIdApiRing: “1”, // product id note: "Grilled beef" // Note, code: “Sku” // Product code</p><p>}</p><p>]</p><p>Note:</p><p>- The combo name and product in the combo must match the corresponding combo and product name</p> |
| value              | number |   | Value of the order. If there is no value, the system will calculate the value of the order according to the price on the system.                                                                                                                                                                                                                                                                                                                                                                 |
| receiverNote       | string |   | Delivery notes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| description        | string |   | order description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| stage              | string |   | order status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| branch             | string |   | Store or branch name                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| cusFields          | array  |   | <p>AntCRM custom fields. \[</p><p>{</p><p>name: "Shipping unit", value: “Fast delivery”</p><p>}</p><p>]</p>                                                                                                                                                                                                                                                                                                                                                                                      |

Results returned:

| createdAt      | Number |   | <p>Creation time</p><p>Type: Timestamp</p> |
| -------------- | ------ | - | ------------------------------------------ |
| shipping\_cost | Number |   | Shipping Fee                               |

HTTP Response Code: 200

Response:

{

"success": 1,

"number”: 9457 (id of order on antcrm) }

**c. Edit order**&#x20;

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

Method: PUT

Content-Type: application/json

| **Parameters** | **Type** | **Required** | **Explain**           |
| -------------- | -------- | ------------ | --------------------- |
| number         | string   | AND          | id on crm             |
| name           | string   |              | Trading name          |
| receiverName   | string   |              | Customer name         |
| receiverPhone  | string   |              | Customer phone number |

| <p>receiverAddress Obj</p><p>groupPackage</p> | <p>object</p><p>array</p> |   | <p>Customer address. For example: {</p><p>city: "Ho Chi Minh City",</p><p>state: "Tan Binh district", street: "3", //(apartment number) streetName: "Nguyen Kiem",</p><p>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>Information line. For example:</p><p>\[</p><p>{ name: "Beef combo", // product name quantity: 1, // quantity</p><p>typeDiscount: 1, (0: cash, 1: percent) //</p><p>type of discount discount: 10, // discount amount or % discount value: 1000, // Product price productIdApiRing: “1”, // product id note: "Grilled beef" // Note, code: “Sku” // Product code</p><p>}</p><p>]</p><p>Note:</p><p>- The combo name and product in the combo must match the corresponding combo and product name on the system.</p> |
| --------------------------------------------- | ------------------------- | - | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| value                                         | number                    |   | Value of the order. If there is no value, the system will calculate the value of the order according to the price on the system.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| receiverNote                                  | string                    |   | Delivery notes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| description                                   | string                    |   | order description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| stage                                         | string                    |   | order status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| branch                                        | string                    |   | Store or branch name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| cusFields                                     | array                     |   | <p>Custom fields on AntCRM.</p><p>\[</p><p>{</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
|                                               |                           |   | <p>name: "Shipping unit", value: “Fast delivery”</p><p>}</p><p>]</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| shipping\_cost                                | Number                    |   | Shipping fee                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

Results returned:

HTTP Response Code: 200

Response:

{

"success": 1,

"number”: 9457 (id of order on antcrm) }

**d. Delete order**&#x20;

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

Method: DELETE

Content-Type: application/json

| number | string | <p>A</p><p>N</p><p>D</p> | id of the order on antcrm |
| ------ | ------ | ------------------------ | ------------------------- |

Results returned: HTTP Response Code: 200

Response:

{

"success": 1 }

**e. Add bulk order**&#x20;

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

Method: POST

Content-Type: application/json

Limit 100 orders per request

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

| **Parameters** | **Type** | **Required** | **Explain** |
| -------------- | -------- | ------------ | ----------- |

| name                                | string                     | AND | Trading name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------------------------------- | -------------------------- | --- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| receiverName                        | string                     | AND | Customer name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| opportunityIdApiRing                | string                     |     | Code orders                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| dealByUsers                         | array                      |     | Officer in charge. For example: \[“<thong.nguyen@antbuddy.com>”]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p>dealWith</p><p>receiverPhone</p> | <p>Object</p><p>string</p> |     | <p>{</p><p>“customerId”: “123”,</p><p>“name”: “thong”,</p><p>“phones”: \[{type: “Work”, value: “023232”}],</p><p>“customerIdApiRing”: “Customer Id” }</p><p>Customer phone number</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| receiverAddressObj                  | object                     |     | <p>Customer address. For example: {</p><p>city: "Ho Chi Minh City",</p><p>state: "Tan Binh district", street: "3", //(apartment number) streetName: "Nguyen Kiem",</p><p>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>                                                                                                                                                                                                                                                                                                                     |
| groupPackage                        | array                      |     | <p>Information line. For example:</p><p>\[</p><p>{name: "Beef combo", // product name quantity: 1, // quantity typeDiscount: 1, (0: cash, 1: percent) //</p><p>type of discount discount: 10, // discount amount or % discount value: 1000, // Product price productIdApiRing: “1”, // product id note: "Grilled beef" // Note, code: “Sku” // Product code</p><p>}</p><p>]</p><p>Note:</p><p>- The combo name and product in the combo must match the corresponding combo and product name on the system.</p><p>Value of the order. If there is no value, the system will calculate the value of the order according to the price on the system.</p> |
| value                               | number                     |     | The order value. If no value is provided, the system will calculate the order value based on the system's pricing                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| receiverNote                        | number                     |     | Delivery notes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| description                         | string                     |     | order description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| stage                               | string                     |     | order status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| branch                              | string                     |     | Store or branch name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| cusFields                           | array                      |     | <p>Custom fields on AntCRM.</p><p>\[</p><p>{ name: "Shipping unit", value: “Fast delivery”</p><p>}</p><p>]</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| createdAt                           | Number                     |     | <p>Creation time</p><p>Type: Timestamp</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| shipping\_cost                      | Number                     |     | Shipping fee                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

Results returned: HTTP Response Code: 200

Response:

{

"success": 1,

"number”: \[9457, 9458, 9459] (antcrm order id) }

**f. Edit a bulk of oder**

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

Method: PUT

Content-Type: application/json Limit 100 orders per request

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

| **Parameters**                                | **Type**                  | **Required** | **Explain**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| --------------------------------------------- | ------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| number                                        | string                    | AND          | id on crm                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| name                                          | string                    |              | Trading name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| receiverName                                  | string                    |              | Customer name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| receiverPhone                                 | string                    |              | Customer phone number                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| <p>receiverAddress Obj</p><p>groupPackage</p> | <p>object</p><p>array</p> |              | <p>Customer address. For example: {</p><p>city: "Ho Chi Minh City",</p><p>state: "Tan Binh district", street: "3", //(apartment number) streetName: "Nguyen Kiem",</p><p>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>Information line. For example:</p><p>\[</p><p>{ name: "Beef combo", // product name quantity: 1, // quantity typeDiscount: 1, (0: cash, 1: percent) // type</p><p>of discount discount: 10, // discount amount or % discount value: 1000, // Product price productIdApiRing: “1”, // product id note: "Grilled beef" // Note,</p> |
|                                               |                           |              | <p>code: “Sku” // Product code</p><p>}</p><p>]</p><p>Note:</p><p>- The combo name and product in the combo must match the corresponding combo and product name on the system.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| value                                         | number                    |              | Value of the order . If there is no value, the system will calculate the value of the order according to the price on the system.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| receiverNote                                  | string                    |              | Delivery notes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| description                                   | string                    |              | order description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| stage                                         | string                    |              | order status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| branch                                        | string                    |              | Store or branch name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| cusFields                                     | array                     |              | <p>AntCRM custom fields.</p><p>\[</p><p>{ name: "Shipping unit", value: “Fast delivery”</p><p>}</p><p>]</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| shipping\_cost                                | Number                    |              | Shipping Fee                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

Results returned:

HTTP Response Code: 200

Response:

{

"success": 1,

"number”: \[9457, 9458] (antcrm order id) }
