How to add deal?


#1

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


#2

We are waiting for response.


#3

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:


#4

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?


#5

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.


#6

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


#7

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:


#8

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


#9

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.


#10

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


#11

Hi @ansar,

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

https://api.hubapi.com/crm-objects/v1/objects/products?hapikey=((YOUR API KEY))

Body:

[
  {
    "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"
  }
]

#12

Hello,

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.

Thanks!


#13

Can we get any response?


#15

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
}