502 Bad Gateway errors


We are synchronizing contacts to Hubspot all-day long. We are constantly updating them to keep our information consistent with our system.

Every now and then, we receive a 502 Bad Gateway as an answer. Currently, it happens about once a day. This is not much, seeing to number of synchonizations we do daily. But it still happens so often, I finally decided to ask in this forum about this error.

Naturally, I serve you with as much details as you need. Our id is 4918719.

Time of failure on our side (CEST): 2019-06-18 21:08:17,282

Country: Switzerland

URL: https://api.hubapi.com/contacts/v1/contact/vid/97158701/profile

Method: POST

Data in JSON:


My code is made to repeat the query on a 5xx failure. It seems like the second approach worked. But this timeouts still are kind of anoying.

I hope you can help me on that.

2 Replies 2
HubSpot Alumni

Hi @BiG,


These questions about 5xx errors come up every so often. We're aware that they're annoying and the usual advice we offer is to add retry logic into your app / system. If you do some searching on this forum for something like "500" you'll find some related threads about it. Here's one example that I was in recently: https://community.hubspot.com/t5/APIs-Integrations/500-Internal-Error-GET-engagements-v1-engagements....


Not long ago we were seeing elevated rates of 5xx errors to CRM endpoints. Our engineers have made changes to reduce those error rates. We've added better monitoring so that we can adjust things quicker in the future, if we see those rates increase again. We are seeing better success rates recently.


I don't have any specifics in terms of what our engineers are doing currently, since it would require pretty in-depth knowledge of our internal systems to make sense of it. But my understanding is that there's still work being done to improve reliability. I think for now, just make sure to keep using retry logic, which it sounds like you're already doing anyway. So that when you do encounter a 5xx error, that it doesn't disprupt whatever you're doing. If you are running into enough 5xx errors that it's preventing you from using our APIs or if you're seeing a significantly increased rate of those errors, definitely reply here or create a new post about it and we'll take a look. In that case usually the full response from our API is helpful for troubleshooting.


Let me know if you have any questions about it.

Leland Scanlan

HubSpot Developer Support



I am also getting a 502 Bad Gateway. Every 500 rows or so, intermittent. I plan to add the retry logic. I have 129,000 one time mass load of Contact and Deal data to do. (no, group load of 100 Contacts won't work for me). Hopefully the retry will be suffficient.


Can you please inform your help desk that these errors occur on your side? Would have saved me a lot of back and forth.