basically trying to grab this metric, without having to go into salesforce?


Had a look at /services/data/vxx.x/limits

Didnt see it here.

Also looked at tooling api and whats available via /services/data/vxx.x/

Didnt see it available.

  • 1
    select count(Id) , sum(LengthWithoutComments ) from ApexClass where NamespacePrefix = '' Can kinda do this but it doesnt exclude test classes. Commented May 4, 2022 at 14:17
  • See related question to get this data via SOQL - Query Code Used Limit (Total Characters) Commented Dec 8, 2022 at 0:34
  • Thanks @DanielBallinger we still dont have the character limit for the org listed anywhere, ie. 6,000,000 If i were to execute SELECT SUM(LengthWithoutComments) FROM ApexClass where NamespacePrefix = '' This would still include test classes, which dont included in the calculation for apex code Commented Dec 8, 2022 at 13:59

1 Answer 1


That bit of limit is not exposed as an API at the moment. If you really want to get it, you could screen scrape that page. We have implemented screen-scrapping in few places (like to get list of Metadata Deployments or Download Report as a whole) and it has worked fine for us.

To screen-scrape, you would need to first get session id, then login to Salesforce using frontdoor.jsp, which should return cookies. Next time, goto Apex Classes page and extract the text.

  • Yeah, thought as much that it wasnt exposed. I'll have read a bit about screen scraping to understand more and put out a idea to salesforce. Commented May 12, 2022 at 8:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .