function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFGSFG 

Is there a way to query SF to see how many API calls I have left?

I did A LOT of testing yesterday and I tried to come back in this morning and I'm getting a message saying I blew through the total number of allowed API calls in a 24-hr period. Moving forward, I'd love to put something in my code that can check to see how many calls I have left. I want it to be in the actual code and not rely on setting up the email notifications in SF to tell me when I'm low. Anybody have any ideas? I've done some searches through the docs and I'm not seeing anything.

 

Also, when does the clock start/stop. For example, when does the 24-hr marker start? Is it the same for every org or does it different for us all?

 

Thanks for the help!

MiddhaMiddha

Not sure about the query but the API call counter doesnt resets itself to 0 on some hour. I have noticed it in my dev org once i consumed all my 5000 API calls they start reducing the consumed calls every hour and after couple of hours i had all the available 5000 calls with me to start all over again.

Jake GmerekJake Gmerek

The API call limit is in a rolling 24 hour period, so if you make a call it counts torward your limit for the next 24 hours then it comes off of your total.