Created Deals have sourceID as null and isn't returned in all deals


#1

When I create deals using the API. The deal shows up on or Hupspot dashboard but when I do
GET https://api.hubapi.com/deals/v1/deal/paged?hapikey=our_API_KEY&properties=dealname&properties=dealstage&properties=pipeline&properties=dealowner, the deals are not there. However I call GET https://api.hubapi.com/deals/v1/deal/recent/created?hapikey=our_api_key, I see them. What am I doing wrong? How do I request so all the deals are returned?

This is the request I send to create the deals { "associations": {}, "properties": [ { "value": "Slack Bot Deal", "name": "dealname" }, { "value": "11ace7b3-cbe1-4d5c-952e-ae0108d4cdd0", "name": "dealstage" }, { "value": "d9421974-2bca-405e-b670-3a40a5612251", "name": "pipeline" }, { "value": "30875693", "name": "hubspot_owner_id" } ] }

In the response, the sourceID is null. Is there another way to create deals so that they:
a) show up in the list of deals returned by the API and
b) show the valid sourceId (the email address of the hubspot_owner_id that owns the deal


#2

Hi @Ik_Obi,

Can you direct message me your Hub ID so that I can do some troubleshooting in your portal?


#3

Thanks @Derek_Gervais
Our hubID is 858559


#4

Hi @pmanca @Derek_Gervais any update on this?


#5

Hi @Ik_Obi,

Thank you for your patience here, and sorry for the delay. I did some testing in your portal and I was able to create a deal via the ‘Create a deal’ endpoint, and then see it in the response to the ‘Get all deals’ endpoint. It appeared on the second page of results; did you page through the results from the ‘Get all deals’ endpoint?

Regarding your second question; the sourceId field is automatically populated based on the source of the property change. Since you’re updating the property via the API, this will always be null.


#6

Hi @Derek_Gervais thank you for your response.

  1. How do I get to the second page of the deals results when I call them through the endpoint?
  2. Does this mean that all the deals I create with the API are always going to have the sourceId as null? If yes, how do I update the deal to contain the sourceId as this is very important for filtering transactions.

#7

Hi @Ik_Obi,

  1. The response you get from the ‘Get all deals’ endpoint will include hasMore and offset fields; when hasMore is true, it means there are more deals in your portal. You then just need to make another request including the offset parameter from the previous response to get the next page.
  2. Yes, the sourceId field will be null whenever the update comes from the API. I’m not sure this field is what you’re looking for; the sourceId field (that I’m referring to, correct me if I’ve misunderstood) provides additional information to the source field. This is related to property updates, not necessarily the creation of the object itself. If you need to track some sort of transaction source, you should create a custom deal property that you populate when creating the deal.

#8

The sourceId usually contains the email of the person who created the deal, or so I thought


#9

Hi @Ik_Obi,

That’s likely true when deals are created via the HubSpot UI. Creating a deal updates the deal’s properties, and the source for that update is CRM_UI and the sourceId is the email of the user that made the change (i.e. created the deal). If the deal properties were updated by some other method (workflow, API, etc.) this source and sourceId will differ.