Metafield Definition
Defines the structure, validation rules, and permissions for Metafield objects attached to a specific owner type. Each definition establishes a schema that metafields must follow, including the data type and validation constraints.
The definition controls access permissions across different APIs, determines whether the metafield can be used for filtering or as a collection condition, and can be constrained to specific resource subtypes.
Anchor to FieldsFields
- Anchor to accessaccess•Metafield
Access! non-null The access settings associated with the metafield definition.
- Anchor to capabilitiescapabilities•Metafield
Capabilities! non-null The capabilities of the metafield definition.
- Anchor to constraintsconstraints•Metafield
Definition Constraints The constraints that determine what subtypes of resources a metafield definition applies to.
- Anchor to createdAtcreated•Date
At Time! non-null The date and time when the metafield definition was created.
- Anchor to descriptiondescription•String
The description of the metafield definition.
- •ID!non-null
A globally-unique ID.
- •String!non-null
The unique identifier for the metafield definition within its namespace.
- Anchor to metafieldsmetafields•Metafield
Connection! non-null The metafields that belong to the metafield definition.
- Anchor to metafieldsCountmetafields•Int!
Count non-null The count of the metafields that belong to the metafield definition.
- Anchor to validationStatusvalidation•Metafield
Status Validation Status The current validation status.
Arguments
- Anchor to namename•String!non-null
The human-readable name of the metafield definition.
- Anchor to namespacenamespace•String!non-null
The container for a group of metafields that the metafield definition is associated with.
- Anchor to ownerTypeowner•Metafield
Type Owner Type! non-null The resource type that the metafield definition is attached to.
- Anchor to pinnedPositionpinned•Int
Position The position of the metafield definition in the pinned list.
- Anchor to standardTemplatestandard•Standard
Template Metafield Definition Template The standard metafield definition template associated with the metafield definition.
- Anchor to typetype•Metafield
Definition Type! non-null The type of data that each of the metafields that belong to the metafield definition will store. Refer to the list of supported types.
- Anchor to updatedAtupdated•Date
At Time! non-null The date and time when the metafield definition was updated.
- Anchor to useAsCollectionConditionuse•Boolean!
As Collection Condition non-null Whether the metafield definition can be used as a collection condition.
- Anchor to validationsvalidations•[Metafield
Definition Validation!]! non-null A list of validation options for the metafields that belong to the metafield definition. For example, for a metafield definition with the type
date, you can set a minimum date validation so that each of the metafields that belong to it can only store dates after the specified minimum.- Anchor to validationStatusvalidation•Metafield
Status Definition Validation Status! non-null The validation status for the metafields that belong to the metafield definition.
Anchor to QueriesQueries
- •query
Retrieves a
by its identifier. You can identify a definition using either its owner type, namespace, and key, or its global ID.Use this query to inspect a definition's configuration, including its data type, validations, access settings, and the count of metafields using it.
- •query
Returns a list of metafield definitions.
Anchor to MutationsMutations
- •mutation
Creates a
that establishes structure and validation rules for metafields. The definition specifies the data type, validation constraints, and access permissions for metafields with a given namespace and key combination.When you create a new definition, the system validates any existing unstructured metafields matching the same owner type, namespace, and key against it. The system updates each valid metafield's type to match the definition. Invalid metafields remain unchanged but must conform to the definition when updated.
Learn more about creating metafield definitions.
- •mutation
You can organize your metafields in your Shopify admin by pinning/unpinning metafield definitions. The order of your pinned metafield definitions determines the order in which your metafields are displayed on the corresponding pages in your Shopify admin. By default, only pinned metafields are automatically displayed.
- •mutation
You can organize your metafields in your Shopify admin by pinning/unpinning metafield definitions. The order of your pinned metafield definitions determines the order in which your metafields are displayed on the corresponding pages in your Shopify admin. By default, only pinned metafields are automatically displayed.
- •mutation
Updates a
's configuration and settings. You can modify the definition's name, description, validation rules, access settings, capabilities, and constraints.The mutation updates access settings that control visibility across different APIs, such as the GraphQL Admin API, Storefront API, and Customer Account API. It also enables capabilities like admin filtering or unique value validation, and modifies constraints that determine which resource subtypes the definition applies to.
NoteThe type, namespace, key, and owner type identify the definition and so can't be changed.
Learn more about updating metafield definitions.
- •mutation
Activates the specified standard metafield definition from its template.
Refer to the list of standard metafield definition templates.
- •mutation
Enables multiple specified standard metafield definitions from their templates as a single transaction. This API is idempotent so any previously-enabled standard definitions will not cause a failure. However, invalid inputs or other user errors will prevent all of the requested definitions from being enabled.
Refer to the list of standard metafield definition templates.