What can I do to fix a 504 gateway timeout when accessing an API?

I’m trying to pull data from an API using jQuery, but I keep running into a 504 gateway timeout error. The same thing happens even when I test the API using Postman, so I don’t think it’s a front-end issue.

What steps can I take to resolve a 504 gateway timeout, especially when the issue seems to be on the server or network side? Any suggestions for debugging or working around this would be really appreciated!