Is there any way to know the requested API completed his job, now request for the next one.

    for (let company of companies) {
       let{data} =axios.get("API url"+company);

above code run perfectly but after a while showing the error “Request failed with status code 429”

Did you search for status code 429?

No, I am searching status code 429, I know what is it for. Too many requests represent the 429. I need help on one of my requirement scenarios, where I need to request many API periodically. When the program starts working it’s perfectly run but after a while, it shows the error with status code 429. I need help to resolve the issue, how to call many APIs at the same time.

let companies[1,2,3,4,…1000]
for (let company of companies) {
let{data} =await axios.get(“API url”+company);
I need to call API For each company

I assume that the first call works fine, when my program requests the next API, the first one shows that it’s not completed so I get the 429.

429 Too Many Requests

The HTTP 429 Too Many Requests response status code indicates the user has sent too many requests in a given amount of time (“rate limiting”).

The API server you are using doesn’t allow so many requests in a certain time period.
I don’t think you can do much about it. Maybe adding ```setTimeout so there will be only one request every 10 or 60 seconds., but in that case with 1000 companies it takes a long time.

Thanks for your response! I try to use the setTimeout function, there I face a problem. I set setTimeout(1000) for API first request. Sometimes first request takes much time so it may over the pause time 1000, in this situation if the next API puts the request again I get status code 429.

So. setTimeout() can not solve my problem. Is there any way to know, the first request is complete now you can put the second request?

According to status code 429 you are still doing to many requests.
Is it a public API server or is it your own API server? How many requests are you allowed, e.g. 12 in 1 hour?

It’s not my API, I need to use HubSpot CRM API, It’s usages limit is following

  • Burst: 150/10 seconds
  • Daily: 500,000

So far I remember, MOSH show in his one tutorial how to know API is load complete and how much data he retrieved. Unfortunately, I forget his technique.

Search for Axios and GET and I am sure you find examples how to do this.

Thanks for the guideline, It’s better for me if you expand your suggestion in detail. I am not looking for the code or syntax, I am looking for your guideline on how to do that.

I am a registered user of MOSH courses, but last year can not purchase the access, hope you understand and realized the coronavirus’s impact on the economy.

Here is my registered email:

I don’t have Mosh his Python course and even don’t know Python.

Based on your code Python has async/await so use that to “wait” on the response.
But if you are not looking for code I am not sure what you want.

I worked on nodejs. Is it possible to know api completed his job.

Now I am confused. Is this about Python or Javascript?

It’s nodejs, you can think it’s as javascript.

const requests = [1, 2, 3, 4, 5, 6, 7, 8];

async function getData() {

  for (const request of requests) {

    console.log(Date() + ' : This is request: ' + request);

    const response = await fetch('' + `${request}`)

    const data = await response.json();

    console.log('Id: ' +, 'Title: ' + data.title);




Something like this? Await waits on the response.

Thanks for the code and description. If you looked carefully I done the same things with axios. For me axios await not wait for the response. Let’s try the fetch. After apply your technique on my project I will inform the update.