How to add deal?


How to add deal via api with products. Please share one complete example using curl.


We are waiting for response.


Hi @ansar,

To create a deal, you'll want to make a request to the 'Create a deal' endpoint of the Deals API. To associate the deal with a product, you'll want to create a line item and associated it with the deal via the Line Items API and CRM Associations API:


Thanks for your reply.
Hubspot is not allowing to add the products and asking for update to enterprise plan. So how use it with trial version.
Is there any api for creting products separately?


Hi @ansar,

There is a separate Products API; I'll include a link to the docs below. I'm not entirely clear on the other part of your question, though; are you in a test portal without access to products? If you give me your Hub ID, I can investigate.


Yes, we have test portal without access to products and we need access of products. Are you asking the client id?


Hi @ansar,

No not the client ID; the Hub ID is a unique 5-6 digit number that appears in the URL bar when you visit the test portal:


Here is the hub id: 4746115 . Please check it soon.


Hi @ansar,

Apologies for the delay in resolution here. This topic didn't get properly updated, but the issue here is that since products is a Sales pro feature, test portals aren't currently auto-provisioned. I've given that portal temporary access for the next 60 days, which should give you time to fully test the Products API. In the future, test portals will eventually automatically have appropriate access.


We are unable to get the product api work. So can you please share one example of product creation.


Hi @ansar,

I was able to create a product (here) with the following url & request body: API KEY))


    "name": "name",
    "value": "Test Product - Derek Gervaist"
    "name": "description",
    "value": "This is a test product created by Derek Gervais, HubSpot Developer Advocate"
    "name": "price",
    "value": "100.00"
    "name": "recurringbillingfrequency",
    "value": "quarterly"



We are now able to create product and line items. We have associated contact with deal but we are not able to associate line item/product to deal. So please send one example that how to associate line item/product to deal.



Can we get any response?


Hi @ansar,

You can associate line items to deals using the CRM Associations API. Here's an example:

  "fromObjectId": 496346, // This is the line item id
  "toObjectId": 176602, // This is the deal id
  "category": "HUBSPOT_DEFINED",
  "definitionId": 20 // This is the definitionId for a line item -> deal association