HTML response with 502 error from API end-point

It’s non-sense. It’s also worth modifying your, Twitch, code to return JSON template (from nginx or something else) instead of HTML. For API end-points. It’s not too hard.

Why? Where is this “normal” described? Why HTML responses becomes “normal” for API end-points?

Why there is an HTML message at API end-point with JSON convention? Documentation says there will be JSON response. Is there any information about exclusive cases with HTML format?

So just change low-level error template from HTML to JSON.

Any documentation about these cases?

It’s also non-sense. You’re saying me “just retry a request”. And what next? What if something changed and there will be always “just retries”? These cases, HTML responses, are exception for JSON API, they should not be there in any time. If you could make HTML low-level error — you can make JSON template in the same way. So, please, do it. For API end-points (by domain, servers, anything else, as you want).