I actually managed to solve this on my own (with a little help of chatGPT).

The highlighted code is the previous query that I'm looping through.
Adding "await new Promise(resolve => setTimeout(resolve, 2500));" makes it wait for 2.5 sec with is enought to not overwhelm the API I'm calling.
Hope this helps whoever has the same problem / maybe someone has a better solution.