---
schema_version: "1"
id: 8091e1a1619ac2f17f37149a43adb59115e7c3a214751f98d0b9bc73bba93fbd
title: Metadata
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_metadata.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_metadata.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 30a3ed4c91d357f1740e257d39c89a6998f26e375c31de334d1a755438b65eec
description: Salesforce uses metadata types and components to represent org configuration and customization. Metadata is used for org settings that admins control, or configuration information applied by installed apps and packages.
---
# Metadata

Salesforce uses metadata types and components to represent org configuration and customization. Metadata is used for org settings that admins control, or configuration information applied by installed apps and packages.

Use the classes in the Metadata namespace to access metadata from within Apex code for tasks that include:

- Customizing app installs or upgrades—During or after an install (or upgrade), your app can create or update metadata to let users configure your app.
- Customizing apps after installation—After your app is installed, you can use metadata in Apex to let admins configure your app using the UI that your app provides rather than having admins manually use the standard Salesforce setup UI.
- Securely accessing protected metadata—Update metadata that your app uses internally without exposing these types and components to your users.
- Creating custom configuration tools—Use metadata in Apex to provide custom tools for admins to customize apps and packages.

Metadata access in Apex is available for Apex classes using API version 40.0 and later.

For more information on metadata types and components, see the [Metadata API Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/meta_intro.htm "HTML (New Window)") and [Custom Metadata Types](https://help.salesforce.com/s/articleView?id=platform.custommetadatatypes_overview.htm&language=en_US "HTML (New Window)").

- **[Retrieving and Deploying Metadata](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_metadata_retrieve_deploy.htm)**  
    Retrieve and deploy metadata by using the Metadata.Operations class.
- **[Supported Metadata Types](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_metadata_supported_types.htm)**  
    Apex supports a subset of metadata types and components.
- **[Security Considerations](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_metadata_security.htm)**  
    Be aware of security considerations when using Apex to access metadata.
- **[Testing Metadata Deployments](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_metadata_testing.htm)**  
    Apex code that accesses metadata must be properly tested.

#### See Also

- [_Apex Reference Guide_: Metadata Namespace](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_namespace_Metadata.htm "Apex Reference Guide: Metadata Namespace - HTML (New Window)")