APIs & Integrations

SAMsan
Participant

Getting response code 400 - bad request requesting Deals on API v3

SOLVE

Hello,

 

I'm trying to request deals per Pipeline using API v3 Search  method.

I can get entries at some point.

Using "after"=999 is working but "after"=9999 fails returning 400 - bad request.

Here are the logs :

{limit=100.0, filters=[{propertyName=pipeline, value=571502.0, operator=EQ}], after=999, sorts=[{propertyName=createdate, direction=ASCENDING}], properties=[dealname, amount, dealstage, sign_par, hubspot_owner_id, rdv_vecu, produit_vendu, type_de_produit, statut_dossier, origine, motif_de_contact, raison_des_clotures, lead_brut_lead_net_contacts, url_site]}
----- RETURN -----
UrlFetchApp result: 200.0 {total=10875, paging={next={after=1099}}}


{limit=100.0, filters=[{propertyName=pipeline, value=571502.0, operator=EQ}], after=9999, sorts=[{propertyName=createdate, direction=ASCENDING}], properties=[dealname, amount, dealstage, sign_par, hubspot_owner_id, rdv_vecu, produit_vendu, type_de_produit, statut_dossier, origine, motif_de_contact, raison_des_clotures, lead_brut_lead_net_contacts, url_site]}
----- RETURN -----
UrlFetchApp Failed: 400.0 {"status":"error","message":"There was a problem with the request.","correlationId":"27d1f756-d1ee-4943-a4e4-610611b1a0b6","requestId":"412b9bca-7814-41f4-9fb4-72d1ebb76215"}

Obviously, I won't be able to request all my deals...

1 Accepted solution
Willson
Solution
HubSpot Employee
HubSpot Employee

Getting response code 400 - bad request requesting Deals on API v3

SOLVE

Hey @SAMsan 

 

Thanks for your patience here! I was able to dig into this internally and find that this is a known limitation currently, as such, we've updated the new documenation to include this now. 

The new limitation reads:

The search endpoints are limited to 10,000 total results in the response. Attempting to page beyond 10,000 will generate a 400 error.

See here: https://developers.hubspot.com/docs-beta/crm/search

 

I hope this helps!

Product Manager @ HubSpot

View solution in original post

0 Upvotes
9 Replies 9
adley_amzovski_
Participant

Getting response code 400 - bad request requesting Deals on API v3

SOLVE

Hi @Willson

 

Is there a timeline to fix this limitation? We have updates of 800K contacts to be pulled on a daily basis that we're filtering using the lastmodifieddate param. Do you have a better solution to achieve the data pulls?

0 Upvotes
Willson
HubSpot Employee
HubSpot Employee

Getting response code 400 - bad request requesting Deals on API v3

SOLVE

Hi @SAMsan 

 

Thanks for providing this! To confirm, the after parameter is used to access the next page of results and the value entered is the paging.next.after property seen in the previous response.

 

If the paging.next.after property isn’t provided, there are no additional results to display.

 

As you're searching Deals in your Pipelines, I would not expect you to be fetching this many results that the paging.next.after value returned is 9999. Can you confirm?

Product Manager @ HubSpot
0 Upvotes
SAMsan
Participant

Getting response code 400 - bad request requesting Deals on API v3

SOLVE

@Willson 
I do indeed receive the after parameter once the first limit is reached.

My code loops until the after parameter is absent.

As I request all deals from one pipeline for analytics purpose, request's total items is above 10k.

 

Thank you for your help

0 Upvotes
Willson
Solution
HubSpot Employee
HubSpot Employee

Getting response code 400 - bad request requesting Deals on API v3

SOLVE

Hey @SAMsan 

 

Thanks for your patience here! I was able to dig into this internally and find that this is a known limitation currently, as such, we've updated the new documenation to include this now. 

The new limitation reads:

The search endpoints are limited to 10,000 total results in the response. Attempting to page beyond 10,000 will generate a 400 error.

See here: https://developers.hubspot.com/docs-beta/crm/search

 

I hope this helps!

Product Manager @ HubSpot
0 Upvotes
StanBartczak
Participant | Diamond Partner
Participant | Diamond Partner

Getting response code 400 - bad request requesting Deals on API v3

SOLVE

Hi @Willson is there no way to only check the number of contacts/deals matching some criteria if there are more than 10k results?

0 Upvotes
saps
Member

Getting response code 400 - bad request requesting Deals on API v3

SOLVE

Hi @Willson , when will this issue be resolved? While it isn't a big problem for Deals, it is a massive problem for Contacts - the Contacts API (without filterable results) provides too much information from past (years/months) whereas the Search API gives too less. Having more than 10k active Contacts is pretty normal and not an edge case.

Willson
HubSpot Employee
HubSpot Employee

Getting response code 400 - bad request requesting Deals on API v3

SOLVE

Hi @SAMsan 

 

I just wanted to follow-up here! I am looking into this further from my end and will revert with an update once I have more for you.

 

Feel free to add any questions you may have in the meantime. Thanks

Product Manager @ HubSpot
0 Upvotes
Willson
HubSpot Employee
HubSpot Employee

Getting response code 400 - bad request requesting Deals on API v3

SOLVE

Hi @SAMsan 

 

In order to assist, would you be able to forward on the exact Request URL you're currently using and the associated v3 documentation you're referencing too for me? Thanks!

Product Manager @ HubSpot
0 Upvotes
SAMsan
Participant

Getting response code 400 - bad request requesting Deals on API v3

SOLVE
0 Upvotes