curl --request POST \
--url https://api.hubapi.com/crm-objects/v1/objects/line_items/batch-read
"\nExample POST URL (without properties):\nhttps://api.hubapi.com/crm-objects/v1/objects/line_items/batch-read\n\nExample POST JSON:\n{\n \"ids\": [\n 9845651,\n 9867373\n ]\n}\n\nExample Response:\n{\n \"9845651\": {\n \"objectType\": \"LINE_ITEM\",\n \"portalId\": 62515,\n \"objectId\": 9845651,\n \"properties\": {\n \"hs_product_id\": {\n \"versions\": [\n {\n \"name\": \"hs_product_id\",\n \"value\": \"1645342\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"1645342\",\n \"timestamp\": 0,\n \"source\": null,\n \"sourceId\": null\n }\n },\n \"version\": 1,\n \"isDeleted\": false\n },\n \"9867373\": {\n \"objectType\": \"LINE_ITEM\",\n \"portalId\": 62515,\n \"objectId\": 9867373,\n \"properties\": {\n \"hs_product_id\": {\n \"versions\": [\n {\n \"name\": \"hs_product_id\",\n \"value\": \"1645187\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"1645187\",\n \"timestamp\": 0,\n \"source\": null,\n \"sourceId\": null\n }\n },\n \"version\": 1,\n \"isDeleted\": false\n }\n}\n\n\nExample POST URL (with properties):\nhttps://api.hubapi.com/crm-objects/v1/objects/line_items/batch-read?properties=name&properties=quantity&properties=price\n\nExample POST JSON:\n{\n \"ids\": [\n 9845651,\n 9867373\n ]\n}\n\nExample response:\n{\n \"9845651\": {\n \"objectType\": \"LINE_ITEM\",\n \"portalId\": 62515,\n \"objectId\": 9845651,\n \"properties\": {\n \"quantity\": {\n \"versions\": [\n {\n \"name\": \"quantity\",\n \"value\": \"25\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"25\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"price\": {\n \"versions\": [\n {\n \"name\": \"price\",\n \"value\": \"27.50\",\n \"timestamp\": 1525299376761,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"27.50\",\n \"timestamp\": 1525299376761,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"name\": {\n \"versions\": [\n {\n \"name\": \"name\",\n \"value\": \"A custom name for the product for this line item.\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"A custom name for the product for this line item.\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"hs_product_id\": {\n \"versions\": [\n {\n \"name\": \"hs_product_id\",\n \"value\": \"1645342\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"1645342\",\n \"timestamp\": 0,\n \"source\": null,\n \"sourceId\": null\n }\n },\n \"version\": 1,\n \"isDeleted\": false\n },\n \"9867373\": {\n \"objectType\": \"LINE_ITEM\",\n \"portalId\": 62515,\n \"objectId\": 9867373,\n \"properties\": {\n \"quantity\": {\n \"versions\": [\n {\n \"name\": \"quantity\",\n \"value\": \"25\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"25\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"price\": {\n \"versions\": [\n {\n \"name\": \"price\",\n \"value\": \"9.00\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"9.00\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"name\": {\n \"versions\": [\n {\n \"name\": \"name\",\n \"value\": \"Widgets, special discount price\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"Widgets, special discount price\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"hs_product_id\": {\n \"versions\": [\n {\n \"name\": \"hs_product_id\",\n \"value\": \"1645187\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"1645187\",\n \"timestamp\": 0,\n \"source\": null,\n \"sourceId\": null\n }\n },\n \"version\": 1,\n \"isDeleted\": false\n }\n}"
Create a group of line items. Up to 100 line items can be created in a single request. This would allow you to create all of the line items for an entire order (or multiple orders) in a single request. The request body will be an array, with each entry being a list of properties you want to set for each new line item. Please see the example for more details. You must set the hs_product_id property when creating a line item. This property needs to be the objectId of a product object, and represents the product being sold.
curl --request POST \
--url https://api.hubapi.com/crm-objects/v1/objects/line_items/batch-read
"\nExample POST URL (without properties):\nhttps://api.hubapi.com/crm-objects/v1/objects/line_items/batch-read\n\nExample POST JSON:\n{\n \"ids\": [\n 9845651,\n 9867373\n ]\n}\n\nExample Response:\n{\n \"9845651\": {\n \"objectType\": \"LINE_ITEM\",\n \"portalId\": 62515,\n \"objectId\": 9845651,\n \"properties\": {\n \"hs_product_id\": {\n \"versions\": [\n {\n \"name\": \"hs_product_id\",\n \"value\": \"1645342\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"1645342\",\n \"timestamp\": 0,\n \"source\": null,\n \"sourceId\": null\n }\n },\n \"version\": 1,\n \"isDeleted\": false\n },\n \"9867373\": {\n \"objectType\": \"LINE_ITEM\",\n \"portalId\": 62515,\n \"objectId\": 9867373,\n \"properties\": {\n \"hs_product_id\": {\n \"versions\": [\n {\n \"name\": \"hs_product_id\",\n \"value\": \"1645187\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"1645187\",\n \"timestamp\": 0,\n \"source\": null,\n \"sourceId\": null\n }\n },\n \"version\": 1,\n \"isDeleted\": false\n }\n}\n\n\nExample POST URL (with properties):\nhttps://api.hubapi.com/crm-objects/v1/objects/line_items/batch-read?properties=name&properties=quantity&properties=price\n\nExample POST JSON:\n{\n \"ids\": [\n 9845651,\n 9867373\n ]\n}\n\nExample response:\n{\n \"9845651\": {\n \"objectType\": \"LINE_ITEM\",\n \"portalId\": 62515,\n \"objectId\": 9845651,\n \"properties\": {\n \"quantity\": {\n \"versions\": [\n {\n \"name\": \"quantity\",\n \"value\": \"25\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"25\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"price\": {\n \"versions\": [\n {\n \"name\": \"price\",\n \"value\": \"27.50\",\n \"timestamp\": 1525299376761,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"27.50\",\n \"timestamp\": 1525299376761,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"name\": {\n \"versions\": [\n {\n \"name\": \"name\",\n \"value\": \"A custom name for the product for this line item.\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"A custom name for the product for this line item.\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"hs_product_id\": {\n \"versions\": [\n {\n \"name\": \"hs_product_id\",\n \"value\": \"1645342\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"1645342\",\n \"timestamp\": 0,\n \"source\": null,\n \"sourceId\": null\n }\n },\n \"version\": 1,\n \"isDeleted\": false\n },\n \"9867373\": {\n \"objectType\": \"LINE_ITEM\",\n \"portalId\": 62515,\n \"objectId\": 9867373,\n \"properties\": {\n \"quantity\": {\n \"versions\": [\n {\n \"name\": \"quantity\",\n \"value\": \"25\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"25\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"price\": {\n \"versions\": [\n {\n \"name\": \"price\",\n \"value\": \"9.00\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"9.00\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"name\": {\n \"versions\": [\n {\n \"name\": \"name\",\n \"value\": \"Widgets, special discount price\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"Widgets, special discount price\",\n \"timestamp\": 1525369755209,\n \"source\": \"API\",\n \"sourceId\": null\n },\n \"hs_product_id\": {\n \"versions\": [\n {\n \"name\": \"hs_product_id\",\n \"value\": \"1645187\",\n \"sourceVid\": []\n }\n ],\n \"value\": \"1645187\",\n \"timestamp\": 0,\n \"source\": null,\n \"sourceId\": null\n }\n },\n \"version\": 1,\n \"isDeleted\": false\n }\n}"
Successful response - Create a group of line items
The response is of type object
.
Was this page helpful?