I have created a custom metadata type in my dev org. I want to pull that cmdt (and included fields) down to my machine using the CLI (sfdx command).

I found this command but it only retrieves a record of the given custom metadata type.

sfdx force:source:retrieve -m CustomMetadata:MetadataTypeAPIName.MetadataRecordAPIName

I'm looking for a command that actually retrieves the definition of the custom meta data type itself and not just a single record. I want to do that so the custom metadata type can use VS Code "Deploy Source To Org" to deploy that type in another org and later include it in my managed package.

1 Answer 1


To get the Custom Metadata Type itself (including its fields), you use the CustomObject metadata type. The API name just uses __mdt instead of __c.

sfdx force:source:retrieve -m CustomObject:My_Custom_Metadata_Type__mdt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.