• Help Desk reporting gives you real-time visibility into your support operation without the manual work. Ask our experts about which metrics matter most! AMA Dec 8-12.

    Ask us anything

Custom code - API limit

ChrisChiha
Top Contributor

Hello,
 
I have a workflow that runs daily at 10am, and enrolls some records that will reach a custom code action that is calling an API endpoint.
 
However as we have the 150 api call limit/10 seconds for private apps, we are receiving some errors that we are hitting the secondly limit.

{"status":"error","message":"You have reached your secondly limit.","correlationId":"df810f00-273c-4e41-bc8d-0ab2acf8684c","category":"RATE_LIMITS"}


   
What could be the best way to avoid these errors when we enroll 200+ records into a custom code that calls an API endpoint?
 
Thank you!

0 Upvotes
2 Replies 2
Jaycee_Lewis
Thought Leader

Hey, @ChrisChiha 👋 Can you share with the community which endpoint you are calling? Also, of the suggestions here, can you share which you have alreeady ruled out? To help prevent giving you redundant information 😊 

 

Best,

Jaycee





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes
ChrisChiha
Top Contributor

Hey @Jaycee_Lewis ,
 
One of the workflows is checking if the enrolled email address exists in the HubDB table using this endpoint:
GET /cms/v3/hubdb/tables/TABLEID/rows?portalId=PORTALID&limit=1&email=${email}
 
Basically this workflow runs everyday at 10 am and enrolls around 200 contacts, and it generates a lot of "429" errors:

 

{"status":"error","message":"You have reached your ten_secondly_rolling limit.","errorType":"RATE_LIMIT","correlationId":"3ebb4dda-0a35-42f8-a26b-e1b523a11c48","policyName":"TEN_SECONDLY_ROLLING","groupName":"publicapi:private_app-api-calls-ten-secondly:1143560:19597989"}

 

 

I tried adding a random delay just before this custom code:
 

 

function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive
}

exports.main = async (event) => {
setTimeout(
() => { console.log("Delay"); },
getRandomInt(4000,16000)
);
}

 


 but it didn't solve the issue

0 Upvotes