Get Contacts at a Company method does not work

SOLVE
New Contributor

Hi support,

 

I'm working with the hubspot API and I'm having some problems.

 

I'd like to fetch contacts associated to a company starting from the compony id.

 

The company page at url https://app.hubspot.com/contacts/5930439/company/2233360699/ looks like this:

Schermata 2019-09-10 alle 17.22.32.png

 

where 2233360699 is the id of the company.

 

To reach my goal of having contacts related to the company (basically I want to have the contact on the right bar) I'm using this method API https://api.hubapi.com/companies/v2/companies/2233360699/contacts?hapikey=MYSECRET but the list of the contacts is empty.

 

Why?  What am I doing wrong?

 

Thanks

 

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Highlighted
Community Manager

Hey @mirko_ds ,

 

Ah, make sense, that's a common pitfall. Thanks for coming back to post your solution!

 

Also, this endpoint is currently deprecated, but will continue to be supported in its current form for a while. I don't have any definite timeframe for when it will be fully sunset, but we'll communicate the change on the Developer Changelog before we do: https://developers.hubspot.com/changelog

Reply
0 Upvotes
3 Replies 3
Community Manager

Hi @mirko_ds ,

 

Can you give me the raw response you get from HubSpot? I'm able to see the associated contact vids when making that same request to your portal, so I'm not quite sure what's going on.

 

Also, quick side note: While that endpoint technically still works, it's been deprecated in favor of the more robust Associations API. I'm happy to help figure out what's going on with the endpoint you're using, but I'd also recommend switching to the Associations API whenever possible.

Reply
0 Upvotes
New Contributor

Hi Derek,

 

sorry it was my fault because i was using the apikey of another hubspot account.

 

So basically this endpoint will be deprecated soon? 

 

Thanks

 

Reply
0 Upvotes
Highlighted
Community Manager

Hey @mirko_ds ,

 

Ah, make sense, that's a common pitfall. Thanks for coming back to post your solution!

 

Also, this endpoint is currently deprecated, but will continue to be supported in its current form for a while. I don't have any definite timeframe for when it will be fully sunset, but we'll communicate the change on the Developer Changelog before we do: https://developers.hubspot.com/changelog

Reply
0 Upvotes