The REST Admin API is a legacy API as of October 1, 2024. All apps and integrations should be built with the GraphQL Admin API. For details and migration steps, visit our migration guide.
Metafields are a flexible way to attach additional information to a Shopify resource (e.g. Product, Collection, etc.). Some examples of data stored using metafields include specifications, size charts, downloadable documents, release dates, images, or part numbers. Metafields are identified by an owner resource, a namespace, and a key and they store a value along with type information for that context.
Resources that can have metafields
Was this section helpful?
Properties
The date and time (ISO 8601 format) when the metafield was created.
description
The description of the metafield.
The unique ID of the metafield.
Required when updating a metafield, but should not be included when creating as it's created automatically.
Required when updating a metafield, but should not be included when creating as it's created automatically.
key
->key
The unique identifier for a metafield within its namespace.
Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters.
Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters.
namespace
The container for a group of metafields that the metafield is or will be associated with. Used in tandem with
`key` to lookup a metafield on a resource, preventing conflicts with other metafields with the same `key`.
Must be 3-255 characters long and can contain alphanumeric, hyphen, and underscore characters.
Must be 3-255 characters long and can contain alphanumeric, hyphen, and underscore characters.
owner_id
->owner
The unique ID of the resource that the metafield is attached to.
owner_resource
The type of resource that the metafield is attached to.
The date and time (ISO 8601 format) when the metafield was last updated.
value
->value
The data stored in the metafield. Always stored as a string, regardless of the metafield's type.
type
->type
The type of data that is stored in the metafield.
Refer to the list of supported types.
Was this section helpful?
You can create any number of metafields for a resource.
To create metafields, use the corresponding resource's endpoint as listed on the examples.
api_version
string
required
blog_id
string
required
Was this section helpful?
Path parameters
string
required
Request body
Metafield resource
Was this section helpful?
Retrieves a list of metafields attached to a particular resource by using the resource's endpoint.
api_version
string
required
blog_id
string
required
created_at_max
Show metafields created before date (format: 2022-02-25T16:15:47-04:00)
created_at_min
Show metafields created after date (format: 2022-02-25T16:15:47-04:00)
fields
Retrieve only certain fields, specified by a comma-separated list of fields names.
key
Show metafields with given key
limit
≤ 250
default 50
The maximum number of results to show on a page.
namespace
Show metafields with given namespace
since_id
Show metafields created after the specified ID.
type
The type of data that the metafield stores in the `value` field.
Refer to the list of supported types.
updated_at_max
Show metafields last updated before date (format: 2022-02-25T16:15:47-04:00)
updated_at_min
Show metafields last updated after date (format: 2022-02-25T16:15:47-04:00)
Was this section helpful?
Path parameters
string
required
Was this section helpful?
Retrieve a metafield by specifying the ID. All fields of a metafield are returned unless specific fields are named.
api_version
string
required
blog_id
string
required
metafield_id
string
required
fields
Retrieve only certain fields, specified by a comma-separated list of fields names.
Was this section helpful?
Was this section helpful?
Get a count of all metafields that belong to a particular resource.
api_version
string
required
blog_id
string
required
Was this section helpful?
Path parameters
string
required
Was this section helpful?
Updates a metafield. The properties that can be updated are
value
and type
.api_version
string
required
blog_id
string
required
metafield_id
string
required
Was this section helpful?
Request body
Metafield resource
Was this section helpful?
Deletes a metafield by its ID.
api_version
string
required
blog_id
string
required
metafield_id
string
required
Was this section helpful?
Was this section helpful?