`504 Gateway Timeout` when requesting Deals


Hi there,

Our app makes requests on behalf of third party customers and retrieves deals by making a call to GET https://api.hubapi.com/deals/v1/deal/paged? with properties query parameters.

For one specific customer, we're making the GET https://api.hubapi.com/deals/v1/deal/paged? with 210 properties query params and receive a 504 gateway timeout, even across multiple retries in the same session or across different sessions.

If we reduce the properties count from 210 to just 1, we still get the 504 error.

Could you help point us in the right direction for correcting this?


Hi @dylan_sprayberry, happy to help here. Can you reply with the following:

  1. The portal ID you're trying to use this GET request for?
  2. An example of a request you made with just one property (excluding hapikey if you're using that method).
  3. are you using their hapikey, or oauth to get these deals?

Thank you!


Hi Connor,

Our team doesn't actually have access to the portal ID. We're using OAuth to handle authorization and to get deals, and an example of the request that failed with only a single property would be:

GET https://api.hubapi.com/deals/v1/deal/paged?count=250&properties=days_to_adopt_sales_cc_payment.

We can ask the client to follow up on this thread with the portal ID if that's a hard requirement for troubleshooting.


Ah no, that's fine @dylan_sprayberry, an improper assumption on my part. Can you send over your App ID from your Developer Portal in that case?

Do you happen to know the portal ID you're requesting this property from? No worries if not. I may need that later but will let you know. It's possible that the property or several properties you're requesting doesn't exist in the portal you're making the GET request to.


Hey Connor,

Our App ID is 53421.

We don't know the portal ID that this is being requested from, though if it's needed I can loop in the client as mentioned.


Thanks @dylan_sprayberry, I shouldn't need that if I'm right on the following -- Are these examples of one of the deals showing a 500 error?


Hey @dylan_sprayberry, I was able to make a successful get request to a portal that had previously experienced a 500 error by using their Oauth token. I used the following GET request: api.hubapi.com/deals/v1/deal/paged?properties=dealname&properties=days_to_adopt_sales_cc_payment&count=250. One thing to note that may be throwing some things off is that count on that deals endpoint doesn't exist. You'll want to instead use the limit property as we can see here: https://developers.hubspot.com/docs/methods/deals/get-all-deals. Changing to limit for me, I was still able to successfully request all deals.

Would you mind reaching out to the client so that I can take a look at their specific question and the specific portal they saw the error on, when including 210 properties? Just want to make sure I cover all bases here.


Hi @dylan_sprayberry, I did some more digging and was able to reproduce the 504 error. This is something our engineering team needs to look at so I passed it on over to them. I will let you know when the CRM team has looked at this and discovered the root of the problem. Thank You!


Hi @dylan_sprayberry, I understand your team has been working with some of our Technical Consultants on this issue. As you may know from the info from our developers, the issue with that portal was that it had many soft-deleted deals that our scans had to pass through to get to the ones that weren't actually deleted. Even asking for non-deleted deals without properties took about 6 seconds which is definitely too much for the amount of data that we were requesting, so we deleted the soft-deleted deals which in turn stopped those 504 errors.

Our developers gave an update that this issue should be resolved. I confirmed by making a request to this endpoint api.hubapi.com/deals/v1/deal/paged?properties=dealname&properties=days_to_adopt_sales_cc_payment&count=250 again. This time it was successful.