504 - Gateway Timeout occurs frequently


Earlier one of your developers said that 502/504 timeout errors will be minimised. We have some amount of customers using our HubSpot Integration. Of them, customers having a large volume of data frequently face timeout errors while using get all/recently modified contacts, companies, deals API. Though we’re working within your API limits, we are facing this issue frequently. Some of our customers are feeling dissatisfied with our integration due to the frequent occurrence of such errors. Kindly guide us to make this work on the permanent basis.


Hi @Karthick_Shiva,

How many contacts are you requesting at once? If you’re requesting more than 100 contacts at once, you’re much more likely to run into timeouts or issues with our load balancing system. Can you give me more info on the errors you’re seeing?


@Derek_Gervais, I am sure that, I’m not requesting more than 100 contacts. Yet, it causes timeouts. The error response we’re getting is :
api.hubapi.com | 504: Gateway time-out body{margin:0;padding:0}

Error 504 Ray ID: 3e55914e1f7e58d3 • 2018-01-30 15:47:04 UTC

Gateway time-out








What happened?

The web server reported a gateway time-out error.

What can I do?

Please try again in a few minutes.

Cloudflare Ray ID: 3e55914e1f7e58d3 Your IP: x.xx.xxx.xxx Performance & security by Cloudflare


We are having this same issue. Any cause for this even if we are following rate limits it works sometimes but not others?


Also same issue here, lots and lots of timeouts for quite sometime now...


We do still have this issue and have for about a year. The max we request is 100. For us, it doesn't matter as much because everything is run in background jobs where they are automatically retried on failure, but I can see where this is an issue for most applications. I am certain Hubspot has a way to monitor how many 5xx requests it is serving per hour to narrow down these issues


Hi all,

This is an ongoing issue that is being investigated. The interim solution is to lower your batch size, as this appears to reduce the frequency of these errors.


Sounds like your servers can't keep up with the requests, doesn't take much investigating. Is there a plan to increase your capacity?


Now we're getting new error code "524", which is related to time out as well. The error response we're getting is :

api.hubspot.com | 524: A timeout occurred body{margin:0;padding:0}

Error 524 Ray ID: 3fa085d8690e5843 • 2018-03-11 19:47:21 UTC

A timeout occurred








What happened?

The origin web server timed out responding to this request.

What can I do?

If you're a visitor of this website:

Please try again in a few minutes.

If you're the owner of this website:

The connection to the origin web server was made_ but the origin web server timed out before responding. The likely cause is an overloaded background task_ database or application_ stressing the resources on your web server. To resolve_ please work with your hosting provider or web development team to free up resources for your database or overloaded application. Additional troubleshooting information here.

Cloudflare Ray ID: 3fa085d8690e5843 Your IP:(redacted) Performance & security by Cloudflare


Hi @Karthick_Shiva,

The 524 errors you're seeing don't seem to be directly related, but I'm currently digging into those as well. I'll update here when I have some more info on those.

Re. the 504 errors: Some improvements have been made that will hopefully limit these errors going forward, though the team is continuing to investigate and make improvements. If you continue to see these 504 errors consistently, feel free to bump this topic.


We have a batch script that syncs contacts to HubSpot, and I get the same 524 timeout error from CloudFlare at least once a day, usually more. We aren't uploading a huge number of contacts at once -- around 150. Would using the contact batch create/update endpoint solve this problem? Right now we are doing it with one API call per contact.


Hi @jaydev,

While I can't say for sure since we're still investigating the 524 errors, in general the batch contacts API is usually the better option wherever practical. Reducing the number of API calls you have to make almost always has a positive effect on your app's performance.


Hi @Derek_Gervais,
Can I know the status of the investigation of 524 errors?


Hi @Karthick_Shiva,

Still working on it, there are a lot of variables to pin down before we can figure out a fix for this. I'll be sure to keep you posted in this topic as soon as I have more information.


Hi @Derek_Gervais
Any updates? We're receiving more 524 errors these days.


We are getting the 524 error occasionally just updating a few properties on a single contact on an integration for our client.


We are experiencing the timeout issue as well when trying to add contacts to a company. What's the ETA for a solution here guys? We are new to this platform and frankly seeing this issue not being resolved for a long time is not a confidence builder. I can't approve moving forward with the migration to Hubspot until this issue is resolved.


Since beginning testing with the API, I haven't once been able to iterate through all contacts I wish to retrieve before getting a timeout (504). This is specifically with the test data.


Getting occasional timeout issues as well. Working with engagements api.


Hi @InProductionDev, @TommyT, and @flemingapptopia,

Can you all post more specifics on the endpoints/APIs you're seeing these errors with? @flemingapptopia it sounds like you're seeing 504s with the Engagements API?
@TommyT and @InProductionDev are you both seeing 504s with the 'Get all contacts' endpoint?

Additionally, are all of you respecting the maximum count for all of your requests? Can you try reducing the number of records you're requesting in the interim? Others have found that reducing the size of the batches you're requesting helps mitigate this problem.

If you can give me more specifics on your errors I can dig into this futher.