I'm getting intermittent 504 errors when calling the API