---
schema_version: "1"
id: f91d575e18769ebc3531f0c45d0063ada2bb3318fa3c30f889cedb1e175c2954
title: MetadataPackage
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_metadatapackage.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_metadatapackage.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 998893652d0a7e8f4091a3c47a9c45ab5d8d6b8a00950c43597c720f49c2f475
description: Represents a package that has been developed in the org you’re logged in to. Applies to unlocked, unmanaged, first-generation, and second-generation managed packages.
---
# MetadataPackage

Represents a package that has been developed in the org you’re logged in to. Applies to unlocked, unmanaged, first-generation, and second-generation managed packages.

## Supported Calls

describeSObjects(), query(), retrieve()

## Fields

| Field Name | Details |
| --- | --- |
| Name | 
Type

string

Properties

Filter, Group, idLookup, Sort

Description

The name of the package.





 |
| NamespacePrefix | 

Type

string

Properties

Filter, Group, Nillable, Sort

Description

For first-generation and second-generation managed packages, and unlocked packages with namespaces, this field is the namespace prefix assigned to the package. For unmanaged packages, or no-namespace unlocked packages, this field is blank.



 |
| PackageCategory | 

Type

picklist

Properties

Defaulted on create, Filter, Group, Nillable, Restricted picklist, Sort

Description

The type of package. Valid values are:

- Application (internal use only)
- Module (internal use only)
- Package—Represents either an unmanaged package or a first-generation managed package.
- Package2—Represents either an unlocked package or a second-generation managed package.

The default value is Package.

This field is available in API version 49.0 and later.





 |

## Usage

Here are examples of the types of API queries you can perform.

| Query | String |
| --- | --- |
| Show all managed and unmanaged packages in the org | SELECT Name, NamespacePrefix FROM MetadataPackage |
| Show only managed packages in the org | SELECT Name, NamespacePrefix FROM MetadataPackage WHERE NamespacePrefix <> '' |