Create and manage ecommerce order data.
POST
request to crm/v3/objects/order
.
In the request body, you can include the properties
and associations
objects to set property values and associate the order with other CRM objects (e.g., contacts and line items). Learn more about order properties and associations below.
properties
object in the request body. For example, the request body below would create an order with some basic order and shipping details based on the information provided by the buyer at checkout.
associations
array. You can also use the associations API to update existing orders after creation.
In the associations
array, include an object for each associated record using the following fields:
Fields | Type | Description |
---|---|---|
toObjectId | String | The ID of the record that you want to associate the order with. |
associationTypeId | String | A unique identifier to indicate the association type between the order and the other object. Below are the CRM objects that you can associate orders with, along with their associationTypeId :
GET request to /crm/v4/associations/{fromObjectType}/{toObjectType}/labels . |
POST
request body below would create an order that’s associated with a specific contact and two line items. Properties are also included below the associations for setting initial order information.
GET
request to /crm/v3/objects/order
.GET
request to the above URL and specify an order ID. For example: /crm/v3/objects/order/44446244097
.POST
request to the search endpoint and include filters in the request body. Learn more about searching the CRM.properties
query parameter in the request URL along with comma-separated property names. For example, making a GET
request to the following URL would result in the response below:
/crm/v3/objects/order?properties=hs_order_name,hs_source_store
GET
request to crm/v3/properties/order
.
Learn more about order properties.
POST
request that includes your filter criteria in the request body.
For example, to search for all orders placed at a specific store, you would make a POST
request to crm/v3/objects/order/search
with the following request body:
GET
request to crm/v3/objects/order/{orderId}/associations/{objectName}
For example, to retrieve an order and its associated contacts, you would use the following URL:
crm/v3/objects/order/{orderId}/associations/contact
This will return the IDs of the currently associated contacts, along with meta information about the association type.
GET
request to crm/v3/objects/contacts/{contactId}
.
filters
array specifies the search criteria, while the properties
array specifies which properties to return.
PATCH
request to /crm/v3/objects/order/{orderId}
. In the request body, include a properties
object containing the properties that you want to update.
For example, if you wanted to update an order with the shipping tracking number, you could send the following request body:
PUT
request to /crm/v3/objects/order/{orderId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}
. You can also use the associations API.
associationTypeId
values for order-to-object associations. You can also make a GET
request to /crm/v4/associations/{fromObjectType}/{toObjectType}/labels
.To see all a list of all values, check out the associations API documentation.PUT
request to the following URL:
/crm/v3/objects/order/{orderId}/associations/commerce_payments/{paymentId}/523
The response will return a set of default properties along with an associations
object containing information about the association that you set.
DELETE
request to the following URL:
/crm/v3/objects/order/{orderId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}
For example, if you wanted to remove an associated payment from an order, your request URL would be the following:
/crm/v3/objects/order/{orderId}/associations/commerce_payments/{paymentId}/523
GET
request to /crm/v3/properties/order
. Learn more about using the properties API.
Property name | Label in UI | Description |
---|---|---|
hs_order_name | Name | The name of the order. |
hs_currency_code | Currency Code | The currency that the order was placed in. |
hs_source_store | Source Store | The store that that the order came from. |
hs_fulfillment_status | Fulfillment Status | The current fulfillment / shipping status of the order. |
hs_shipping_status_url | Shipping Status URL | A URL for tracking the shipment status. |
hs_shipping_tracking_number | Shipping Tracking Number | The tracking number for shipping. |
hs_shipping_address_street | Shipping Street | The street address for shipping. |
hs_shipping_address_city | Shipping City | The city in the shipping address. |
hs_shipping_address_postal_code | Shipping ZIP/Postal Code | The zip code of the shipping address. |
hs_pipeline | Pipeline | The pipeline that the order is in. Pipelines contain stages for tracking the order’s progress. Learn more about pipelines and stages below. |
hs_pipeline_stage | Stage | The order’s progress within its current pipeline. Learn more about pipelines and stages below. |
POST
request to crm/v3/pipelines/order
. In the request body, you’ll include a label
for the pipeline, displayOrder
for the display in HubSpot, and a stages
array with objects for each stage.
Parameter | Type | Description |
---|---|---|
label | String | The pipeline’s label as it should appear in HubSpot. |
displayOrder | Number | The order for displaying the pipeline in HubSpot. If two pipelines have a matching displayOrder , they will be sorted alphabetically by label. |
stages | Array | An array containing the pipeline stages. Each stage is an object containing the following fields:
|