Are you using a Free App on the Mendix Cloud to host this REST API?
If you are using Free Apps these go to sleep after an hour of inactivity, so if you access them after that they will take a while to respond.
https://docs.mendix.com/developerportal/deploy/mendix-cloud-deploy/
Hope this helps.