Salesforce package.xml generator
Quick answer
A package.xml is a manifest of metadata types, members and an API version that tells Metadata API what to retrieve or deploy. Pick types below, list members or use * for all, then copy or download the file and run it with sf project retrieve start or sf project deploy start.
Build a package.xml
The generator needs JavaScript. The explanation, example and common types below work without it.
Click the search box to load the list of types.
Selected types. Use * for all members, or list one member per line.
Commands
Save the file as package.xml, then run one of these from your project folder. Replace the placeholder with an org alias or username, or omit --target-org to use your default org.
# Retrieve the listed components from the org
sf project retrieve start --manifest package.xml --target-org <alias-or-username>
# Deploy the listed components to the org
sf project deploy start --manifest package.xml --target-org <alias-or-username>
# Or let the CLI write a manifest from your project's source folder
sf project generate manifest --source-dir force-app --name package What a package.xml is
Metadata API works with components such as Apex classes, flows and objects. A package.xml manifest says which of them a
retrieve or deploy should touch. The file has a root Package element in the
http://soap.sforce.com/2006/04/metadata namespace, one types block per metadata type, and a final
version element. Inside each types block, members lists component names and name is the
metadata type's API name, such as ApexClass.
The generator writes types and members in sorted order, removes duplicates and escapes characters that XML reserves. Sorting is a convention that keeps diffs stable; the order does not change what is retrieved.
The wildcard
A member of * asks for all components of a type. Not every metadata type supports it, so confirm the type in the
Metadata API Developer Guide or in our type guides below before relying on it. For types
that do not support the wildcard, list the members by name. Naming members is also the safer choice for deployments, because the
manifest then states exactly what will change.
Some members are qualified. A custom field is Account.Region__c, written as the object name, a dot and the field name.
Worked example
This manifest was produced at build time by the same function the generator runs, from two named Apex classes, all Lightning Web Components and one custom field.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>AccountService</members>
<members>AccountServiceTest</members>
<name>ApexClass</name>
</types>
<types>
<members>Account.Region__c</members>
<name>CustomField</name>
</types>
<types>
<members>*</members>
<name>LightningComponentBundle</name>
</types>
<version>68.0</version>
</Package>
Retrieve versus deploy
- Retrieve reads the components named in the manifest from an org into your project. Use it to pull metadata that exists in an org but not in your repository.
- Deploy sends the components named in the manifest to an org. Use it to push a defined set of changes instead of the whole project.
Both commands use the modern sf CLI and the --manifest flag. See the
Salesforce CLI reference guide for deploy and retrieve options such as test levels and validation,
and creating a scratch org for a safe place to try a deployment.
Common metadata types
These API names go in the name element. Each links to our guide for the type, which covers its fields, file layout and deployment behavior.
| API name | What it covers |
|---|---|
ApexClass | Apex classes |
ApexTrigger | Apex triggers |
ApexPage | Visualforce pages |
ApexComponent | Visualforce components |
AuraDefinitionBundle | Aura components |
LightningComponentBundle | Lightning Web Components |
CustomObject | Custom and standard objects, with their fields and other child components |
CustomField | Individual fields, as Object.Field members |
ValidationRule | Validation rules, as Object.Rule members |
RecordType | Record types, as Object.RecordType members |
Layout | Page layouts |
FlexiPage | Lightning pages |
CustomTab | Custom tabs |
CustomApplication | Apps, including Lightning apps |
Flow | Flows |
PermissionSet | Permission sets |
Profile | Profiles |
StaticResource | Static resources |
EmailTemplate | Email templates (members include the folder name) |
CustomLabels | Custom labels |
Frequently asked questions
What is a package.xml file?
A package.xml is the manifest Metadata API uses to decide which components to retrieve or deploy. It lists metadata types, the members of each type, and an API version, using the namespace http://soap.sforce.com/2006/04/metadata.
What does the * (wildcard) mean in a package.xml?
A member of * asks for all components of that type. Not every metadata type supports the wildcard, so check the type in the Metadata API reference. Listing members by name is the explicit alternative, and this generator keeps only the * when you enter it together with other members of the same type.
How do I retrieve metadata with a package.xml?
Run sf project retrieve start --manifest package.xml --target-org followed by your org alias or username. The command retrieves the components listed in the manifest from that org into your project.
How do I deploy metadata with a package.xml?
Run sf project deploy start --manifest package.xml --target-org followed by your org alias or username. Only the components listed in the manifest are deployed.
Can the Salesforce CLI create a package.xml for me?
Yes. The sf project generate manifest command writes a manifest, for example from the source directories of your project with --source-dir, or from metadata types you name with --metadata. Run it with --help for the flags your CLI version supports.
Which API version should I put in package.xml?
The version element sets the Metadata API version used for the retrieve or deploy. This generator defaults to 68.0, the API version of Winter '27. Use the version your project or sandbox supports.
Does the generator send my component names anywhere?
No. The type list is a static file on this site, and everything you type is processed in your browser.
Related guides
More tools
SFDX Talk is unofficial documentation. It is not affiliated with, endorsed by, or sponsored by Salesforce, Inc. Salesforce changes its platform every release, so confirm against the official page before relying on a value.