Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full Entity entry
How-to guide

How to query Entity metadata via the Tooling API

Querying Entity metadata is useful when you need to build introspection-driven UIs, document the schema, or audit customizations. The Tooling API exposes EntityDefinition and EntityParticle for this purpose.

By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated May 21, 2026

Querying Entity metadata is useful when you need to build introspection-driven UIs, document the schema, or audit customizations. The Tooling API exposes EntityDefinition and EntityParticle for this purpose.

  1. Open the Developer Console

    Click your avatar, then Developer Console. The Query Editor at the bottom lets you run SOQL against the Tooling API.

  2. Toggle Use Tooling API

    At the top of the Query Editor, check Use Tooling API. This switches the query target from the data layer to the metadata layer.

  3. Query EntityDefinition

    Run: SELECT QualifiedApiName, Label, IsCustomizable FROM EntityDefinition LIMIT 50. The result lists every entity in your org with its API name and label.

  4. Filter for custom entities

    Add a filter: WHERE IsCustomizable = true AND IsCustomSetting = false. This narrows to entities you can customize (standard plus custom objects, excluding custom settings).

  5. Query EntityParticle for a specific entity

    Run: SELECT QualifiedApiName, Label, DataType, Length FROM EntityParticle WHERE EntityDefinition.QualifiedApiName = Account AND IsAccessible = true. The result lists every accessible field on Account.

  6. Use the results in code or documentation

    Export the results to CSV. Feed them into Apex for introspection, generate documentation, or audit which entities have specific fields. EntityDefinition and EntityParticle are the foundation of many third-party governance tools.

Key options
EntityDefinitionremember

Tooling API object exposing object-level metadata. One row per addressable entity in the org.

EntityParticleremember

Tooling API object exposing field-level metadata. Many rows per EntityDefinition.

DescribeSObjectsremember

Apex method returning similar metadata at runtime. Use in Apex; pair with EntityDefinition for governance UIs.

Schema.getGlobalDescribe()remember

Apex method returning all objects. The runtime equivalent of EntityDefinition.

Gotchas
  • Tooling API EntityDefinition does not return platform-managed entities like SharingHierarchy or ContentVersion in some contexts. Add specific filters as needed.
  • IsCustomizable does not mean the entity is editable by your user. It means the metadata supports custom field additions. Profile permissions are a separate gate.
  • EntityParticle returns archived and deprecated fields. Filter for IsAccessible if you only want fields the current user can see.
  • Query limits apply to the Tooling API. Massive metadata queries can hit SOQL row limits; paginate with LIMIT and OFFSET.

See the full Entity entry

Entity includes the definition, worked example, deep dive, related terms, and a quiz.