Q: “How do I determine which Apex Classes each Apex Class depends on?”
A: Tooling API, baby. Here’re the steps I run:
- Open Developer Console
- Click the “Query Editor” tab of the Console
- Activate the “Use Tooling API” checkbox at the bottom of the screen
- Paste the following query into the Query Editor:
SELECT MetadataComponentId, MetadataComponentName, MetadataComponentNamespace, MetadataComponentType, RefMetadataComponentId, RefMetadataComponentName, RefMetadataComponentNamespace, RefMetadataComponentType
FROM MetadataComponentDependency
WHERE MetadataComponentType='ApexClass'
AND RefMetadataComponentType='ApexClass'
- Use your favorite table-copying utility (I use Table Capture) to copy the results into your favorite spreadsheet
And here’s the first five rows of what I got:

Random Notes:
- Querying the Tooling API is always weird. If I run the above query without a
WHERE
clause, I get thousands of lines back. . . and none of them has aMetadataComponentType
orRefMetadataComponentType
ofApexClass
. Shouldn’t I get all rows? Apparently not, wtf - Here’s documentation for the Tooling API’s
MetadataComponentDependency
object - Why didn’t I hide the first three characters of the returned IDs? Because
01p
is the prefix of all Apex Classes everywhere, always. Daniel Ballinger’s Fish of Prey list has maintained the list of standard Salesforce ID prefixes for over 11 years!