---
schema_version: "1"
id: 50aaf564450ad3213e1348158c524c4746ac53ff219912bf1f4dc025a8ebdcc1
title: describeMetadata()
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_describe.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_describe.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7d4b46909129e756fdc13b5def5957765c78fdab15f2619a9c8b9991a6684f20
description: This call retrieves the metadata that describes your organization. This information includes Apex classes and triggers, custom objects, custom fields on standard objects, tab sets that define an app, and many other metadata types.
---
# describeMetadata()

This call retrieves the metadata that describes your organization. This information includes Apex classes and triggers, custom objects, custom fields on standard objects, tab sets that define an app, and many other metadata types.

## Syntax

 DescribeMetadataResult = metadataConnection.describeMetadata(double apiVersion);

## Arguments

### apiVersion

- **Type**: double
- **Description**: The API version for which you want metadata, for example, 68.0.

## Permissions

Your client application must be logged in with the Modify Metadata Through Metadata API Functions or Modify All Data permission.

![Note](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png)

#### Note

If a user requires access to metadata but not to data, enable the [Modify Metadata Through Metadata API Functions](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_metadata_perm.htm "To use Metadata API, a user must have these things.") permission. Otherwise, enable the Modify All Data permission.

## Sample Code—Java

public void describeMetadata() {
  try {
    double apiVersion = 21.0;
    // Assuming that the SOAP binding has already been established.
    DescribeMetadataResult res = 
        metadataConnection.describeMetadata(apiVersion);
    StringBuffer sb = new StringBuffer();
    if (res != null && res.getMetadataObjects().length > 0) {
      for (DescribeMetadataObject obj : res.getMetadataObjects()) {
        sb.append("\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\\n");
        sb.append("XMLName: " + obj.getXmlName() + "\\n");
        sb.append("DirName: " + obj.getDirectoryName() + "\\n");
        sb.append("Suffix: " + obj.getSuffix() + "\\n");
        sb.append("\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\\n");
      }
    } else {
      sb.append("Failed to obtain metadata types.");
    }
    System.out.println(sb.toString());
  } catch (ConnectionException ce) {
    ce.printStackTrace();
  }
}

## Response

[DescribeMetadataResult](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_describemeta_result.htm "Contains information about the organization that is useful for developers working with declarative metadata.")

## When to Use describeMetadata() and describeValueType()?

Use the describeMetadata() call to get high-level information about all the metadata types that are available for your organization, such as type names and file suffixes. Use the describeValueType() call to get granular information about a specific metadata type, such as fields contained within the type.