--- title: Metafield description: Add metafields to store resources. api_version: 2025-10 api_name: admin-rest api_type: rest source_url: html: https://shopify.dev/docs/api/admin-rest/latest/resources/metafield md: https://shopify.dev/docs/api/admin-rest/latest/resources/metafield.md --- ![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg) The REST Admin API is a legacy API as of October 1, 2024. Starting April 1, 2025, all new public apps must be built exclusively with the [GraphQL Admin API](https://shopify.dev/docs/api/admin-graphql). For details and migration steps, visit our [migration guide](https://shopify.dev/docs/apps/build/graphql/migrate). # Metafield 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 * [Article](https://shopify.dev/api/admin-rest/latest/resources/article) * [Blog](https://shopify.dev/api/admin-rest/latest/resources/blog) * [Collection](https://shopify.dev/api/admin-rest/latest/resources/collection) * [Smart Collection](https://shopify.dev/api/admin-rest/latest/resources/smartcollection) * [Customer](https://shopify.dev/api/admin-rest/latest/resources/customer) * [Draft Order](https://shopify.dev/api/admin-rest/latest/resources/draftorder) * [Location](https://shopify.dev/api/admin-rest/latest/resources/location) * [Order](https://shopify.dev/api/admin-rest/latest/resources/order) * [Page](https://shopify.dev/api/admin-rest/latest/resources/page) * [Product](https://shopify.dev/api/admin-rest/latest/resources/product) * [Product Image](https://shopify.dev/api/admin-rest/latest/resources/product-image) * [Product Variant](https://shopify.dev/api/admin-rest/latest/resources/product-variant) * [Shop](https://shopify.dev/api/admin-rest/latest/resources/shop) \# ## Endpoints * [post](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#post-blogs-blog-id-metafields) [/admin/api/latest/blogs/{blog\_​id}/metafields.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#post-blogs-blog-id-metafields) Create a metafield [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsSet?example=create-a-metafield) [metafieldsSet](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsSet?example=create-a-metafield) * [get](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#get-blogs-blog-id-metafields) [/admin/api/latest/blogs/{blog\_​id}/metafields.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#get-blogs-blog-id-metafields) Retrieve a list of metafields from the resource's endpoint [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/queries/product) [product](https://shopify.dev/docs/api/admin-graphql/latest/queries/product) * [get](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#get-blogs-blog-id-metafields-metafield-id) [/admin/api/latest/blogs/{blog\_​id}/metafields/{metafield\_​id}.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#get-blogs-blog-id-metafields-metafield-id) Retrieve a specific metafield [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/queries/product) [product](https://shopify.dev/docs/api/admin-graphql/latest/queries/product) * [get](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#get-blogs-blog-id-metafields-count) [/admin/api/latest/blogs/{blog\_​id}/metafields/count.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#get-blogs-blog-id-metafields-count) Retrieve a count of a resource's metafields. [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/queries/metafieldDefinition?example=retrieve-a-count-of-a-resources-metafields) [metafieldDefinition](https://shopify.dev/docs/api/admin-graphql/latest/queries/metafieldDefinition?example=retrieve-a-count-of-a-resources-metafields) * [put](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#put-blogs-blog-id-metafields-metafield-id) [/admin/api/latest/blogs/{blog\_​id}/metafields/{metafield\_​id}.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#put-blogs-blog-id-metafields-metafield-id) Updates a metafield [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsSet?example=updates-a-metafield) [metafieldsSet](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsSet?example=updates-a-metafield) * [del](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#delete-blogs-blog-id-metafields-metafield-id) [/admin/api/latest/blogs/{blog\_​id}/metafields/{metafield\_​id}.​json](https://shopify.dev/docs/api/admin-rest/latest/resources/metafield#delete-blogs-blog-id-metafields-metafield-id) Deletes a metafield by its ID [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsDelete?example=deletes-a-metafield-by-its-id) [metafieldsDelete](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsDelete?example=deletes-a-metafield-by-its-id) *** ## The Metafield resource ### Properties *** created\_at read-only -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.createdAt) [createdAt](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.createdAt) The date and time ([ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601)) when the metafield was created. *** description -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.description) [description](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.description) The description of the metafield. *** id read-only -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.id) [id](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.id) The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. *** key -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.key) [key](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. *** namespace -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.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. *** owner\_id -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.owner) [owner](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.owner) The unique ID of the resource that the metafield is attached to. *** owner\_resource -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.ownerType) [ownerType](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.ownerType) The type of resource that the metafield is attached to. *** updated\_at read-only -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.updatedAt) [updatedAt](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.updatedAt) The date and time ([ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601)) when the metafield was last updated. *** value -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.value) [value](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. *** type -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.type) [type](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield#field-Metafield.fields.type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). *** {} ## The Metafield resource ```json { "created_at": "2012-03-13T16:09:54-04:00", "description": "The number of units at the warehouse.", "id": 915396206, "key": "warehouse", "namespace": "inventory", "owner_id": 548380009, "owner_resource": "product", "updated_at": "2012-08-24T14:02:15-04:00", "value": "25", "type": "single_line_text_field" } ``` *** ## postCreate a metafield [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsSet?example=create-a-metafield) [metafieldsSet](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsSet?example=create-a-metafield) You can create any number of metafields for a resource. To create metafields, use the corresponding resource's endpoint as listed on the examples. ### Parameters *** api\_version string required *** blog\_id string required *** ### Examples Create a metafield for a blog Path parameters blog\_​id=​382285388 string required Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"my\_fields" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"sponsor" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.type:​"single\_line\_text\_field" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). metafield.value:​"Shopify" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. Create a metafield for a collection Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"my\_fields" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"discount" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.type:​"single\_line\_text\_field" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). metafield.value:​"25%" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. Create a metafield for a customer Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"discounts" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"special" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.value:​"yes" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Create a metafield for a draft order Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"my\_fields" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"purchase\_order" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.type:​"single\_line\_text\_field" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). metafield.value:​"97453" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. Create a metafield for a page Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"my\_fields" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"subtitle" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.type:​"single\_line\_text\_field" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). metafield.value:​"A subtitle for my page" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. Create a metafield for a product Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"inventory" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"warehouse" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.value:​25 -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"number\_integer" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Create a metafield for a product image Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"translation" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"title\_spanish" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.type:​"single\_line\_text\_field" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). metafield.value:​"botas" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. Create a metafield for a product variant Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"my\_fields" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"liner\_material" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.type:​"single\_line\_text\_field" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). metafield.value:​"synthetic leather" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. Create a metafield for an article Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"my\_fields" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"category" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.type:​"single\_line\_text\_field" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). metafield.value:​"outdoors" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. Create a metafield for an order Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"my\_fields" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"purchase\_order" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.type:​"single\_line\_text\_field" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). metafield.value:​"123" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. Create a metafield for the Shop resource Request body metafield​ Metafield resource Show metafield properties metafield.namespace:​"my\_fields" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-namespace) [namespace](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-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. metafield.key:​"my\_items" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. metafield.value:​"{\\"items\\":\[\\"some item\\"]}" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"json" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) [type](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-type) The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Creating a metafield without a key will fail and return an error Request body metafield​ Metafield resource Show metafield properties metafield.key:​null -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) [key](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldDefinitionInput#fields-key) The unique identifier for a metafield within its namespace.\ Must be 3-64 characters long and can contain alphanumeric, hyphen, and underscore characters. post ## /admin/api/2025-10/blogs/382285388/metafields.​json ```bash curl -d '{"metafield":{"namespace":"my_fields","key":"sponsor","type":"single_line_text_field","value":"Shopify"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` {} ## Response JSON ```json HTTP/1.1 201 Created { "metafield": { "id": 1069228948, "namespace": "my_fields", "key": "sponsor", "value": "Shopify", "description": null, "owner_id": 382285388, "created_at": "2025-10-01T14:33:08-04:00", "updated_at": "2025-10-01T14:33:08-04:00", "owner_resource": "blog", "type": "single_line_text_field", "admin_graphql_api_id": "gid://shopify/Metafield/1069228948" } } ``` ### examples * #### Create a metafield for a blog ##### ```curl curl -d '{"metafield":{"namespace":"my_fields","key":"sponsor","type":"single_line_text_field","value":"Shopify"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.blog_id = 382285388; metafield.namespace = "my_fields"; metafield.key = "sponsor"; metafield.type = "single_line_text_field"; metafield.value = "Shopify"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.blog_id = 382285388 metafield.namespace = "my_fields" metafield.key = "sponsor" metafield.type = "single_line_text_field" metafield.value = "Shopify" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.blog_id = 382285388; metafield.namespace = "my_fields"; metafield.key = "sponsor"; metafield.type = "single_line_text_field"; metafield.value = "Shopify"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228948,"namespace":"my_fields","key":"sponsor","value":"Shopify","description":null,"owner_id":382285388,"created_at":"2025-10-01T14:33:08-04:00","updated_at":"2025-10-01T14:33:08-04:00","owner_resource":"blog","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228948"}} ``` * #### Create a metafield for a collection ##### ```curl curl -d '{"metafield":{"namespace":"my_fields","key":"discount","type":"single_line_text_field","value":"25%"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/collections/482865238/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.collection_id = 482865238; metafield.namespace = "my_fields"; metafield.key = "discount"; metafield.type = "single_line_text_field"; metafield.value = "25%"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.collection_id = 482865238 metafield.namespace = "my_fields" metafield.key = "discount" metafield.type = "single_line_text_field" metafield.value = "25%" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.collection_id = 482865238; metafield.namespace = "my_fields"; metafield.key = "discount"; metafield.type = "single_line_text_field"; metafield.value = "25%"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228939,"namespace":"my_fields","key":"discount","value":"25%","description":null,"owner_id":482865238,"created_at":"2025-10-01T14:32:46-04:00","updated_at":"2025-10-01T14:32:46-04:00","owner_resource":"collection","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228939"}} ``` * #### Create a metafield for a customer ##### ```curl curl -d '{"metafield":{"namespace":"discounts","key":"special","value":"yes","type":"single_line_text_field"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/customers/207119551/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.customer_id = 207119551; metafield.namespace = "discounts"; metafield.key = "special"; metafield.value = "yes"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.customer_id = 207119551 metafield.namespace = "discounts" metafield.key = "special" metafield.value = "yes" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.customer_id = 207119551; metafield.namespace = "discounts"; metafield.key = "special"; metafield.value = "yes"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228955,"namespace":"discounts","key":"special","value":"yes","description":null,"owner_id":207119551,"created_at":"2025-10-01T14:33:23-04:00","updated_at":"2025-10-01T14:33:23-04:00","owner_resource":"customer","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228955"}} ``` * #### Create a metafield for a draft order ##### ```curl curl -d '{"metafield":{"namespace":"my_fields","key":"purchase_order","type":"single_line_text_field","value":"97453"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/draft_orders/622762746/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.draft_order_id = 622762746; metafield.namespace = "my_fields"; metafield.key = "purchase_order"; metafield.type = "single_line_text_field"; metafield.value = "97453"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.draft_order_id = 622762746 metafield.namespace = "my_fields" metafield.key = "purchase_order" metafield.type = "single_line_text_field" metafield.value = "97453" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.draft_order_id = 622762746; metafield.namespace = "my_fields"; metafield.key = "purchase_order"; metafield.type = "single_line_text_field"; metafield.value = "97453"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228954,"namespace":"my_fields","key":"purchase_order","value":"97453","description":null,"owner_id":622762746,"created_at":"2025-10-01T14:33:19-04:00","updated_at":"2025-10-01T14:33:19-04:00","owner_resource":"draft_order","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228954"}} ``` * #### Create a metafield for a page ##### ```curl curl -d '{"metafield":{"namespace":"my_fields","key":"subtitle","type":"single_line_text_field","value":"A subtitle for my page"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/pages/131092082/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.page_id = 131092082; metafield.namespace = "my_fields"; metafield.key = "subtitle"; metafield.type = "single_line_text_field"; metafield.value = "A subtitle for my page"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.page_id = 131092082 metafield.namespace = "my_fields" metafield.key = "subtitle" metafield.type = "single_line_text_field" metafield.value = "A subtitle for my page" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.page_id = 131092082; metafield.namespace = "my_fields"; metafield.key = "subtitle"; metafield.type = "single_line_text_field"; metafield.value = "A subtitle for my page"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228943,"namespace":"my_fields","key":"subtitle","value":"A subtitle for my page","description":null,"owner_id":131092082,"created_at":"2025-10-01T14:32:57-04:00","updated_at":"2025-10-01T14:32:57-04:00","owner_resource":"page","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228943"}} ``` * #### Create a metafield for a product ##### ```curl curl -d '{"metafield":{"namespace":"inventory","key":"warehouse","value":25,"type":"number_integer"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/products/632910392/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.product_id = 632910392; metafield.namespace = "inventory"; metafield.key = "warehouse"; metafield.value = 25; metafield.type = "number_integer"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.product_id = 632910392 metafield.namespace = "inventory" metafield.key = "warehouse" metafield.value = 25 metafield.type = "number_integer" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.product_id = 632910392; metafield.namespace = "inventory"; metafield.key = "warehouse"; metafield.value = 25; metafield.type = "number_integer"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228933,"namespace":"inventory","key":"warehouse","value":25,"description":null,"owner_id":632910392,"created_at":"2025-10-01T14:32:22-04:00","updated_at":"2025-10-01T14:32:22-04:00","owner_resource":"product","type":"number_integer","admin_graphql_api_id":"gid://shopify/Metafield/1069228933"}} ``` * #### Create a metafield for a product image ##### ```curl curl -d '{"metafield":{"namespace":"translation","key":"title_spanish","type":"single_line_text_field","value":"botas"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/product_images/850703190/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.product_image_id = 850703190; metafield.namespace = "translation"; metafield.key = "title_spanish"; metafield.type = "single_line_text_field"; metafield.value = "botas"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.product_image_id = 850703190 metafield.namespace = "translation" metafield.key = "title_spanish" metafield.type = "single_line_text_field" metafield.value = "botas" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.product_image_id = 850703190; metafield.namespace = "translation"; metafield.key = "title_spanish"; metafield.type = "single_line_text_field"; metafield.value = "botas"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228940,"namespace":"translation","key":"title_spanish","value":"botas","description":null,"owner_id":850703190,"created_at":"2025-10-01T14:32:51-04:00","updated_at":"2025-10-01T14:32:51-04:00","owner_resource":"product_image","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228940"}} ``` * #### Create a metafield for a product variant ##### ```curl curl -d '{"metafield":{"namespace":"my_fields","key":"liner_material","type":"single_line_text_field","value":"synthetic leather"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/variants/49148385/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.variant_id = 49148385; metafield.namespace = "my_fields"; metafield.key = "liner_material"; metafield.type = "single_line_text_field"; metafield.value = "synthetic leather"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.variant_id = 49148385 metafield.namespace = "my_fields" metafield.key = "liner_material" metafield.type = "single_line_text_field" metafield.value = "synthetic leather" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.variant_id = 49148385; metafield.namespace = "my_fields"; metafield.key = "liner_material"; metafield.type = "single_line_text_field"; metafield.value = "synthetic leather"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228950,"namespace":"my_fields","key":"liner_material","value":"synthetic leather","description":null,"owner_id":49148385,"created_at":"2025-10-01T14:33:13-04:00","updated_at":"2025-10-01T14:33:13-04:00","owner_resource":"variant","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228950"}} ``` * #### Create a metafield for an article ##### ```curl curl -d '{"metafield":{"namespace":"my_fields","key":"category","type":"single_line_text_field","value":"outdoors"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/articles/674387490/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.article_id = 674387490; metafield.namespace = "my_fields"; metafield.key = "category"; metafield.type = "single_line_text_field"; metafield.value = "outdoors"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.article_id = 674387490 metafield.namespace = "my_fields" metafield.key = "category" metafield.type = "single_line_text_field" metafield.value = "outdoors" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.article_id = 674387490; metafield.namespace = "my_fields"; metafield.key = "category"; metafield.type = "single_line_text_field"; metafield.value = "outdoors"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228942,"namespace":"my_fields","key":"category","value":"outdoors","description":null,"owner_id":674387490,"created_at":"2025-10-01T14:32:55-04:00","updated_at":"2025-10-01T14:32:55-04:00","owner_resource":"article","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228942"}} ``` * #### Create a metafield for an order ##### ```curl curl -d '{"metafield":{"namespace":"my_fields","key":"purchase_order","type":"single_line_text_field","value":"123"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/orders/450789469/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.order_id = 450789469; metafield.namespace = "my_fields"; metafield.key = "purchase_order"; metafield.type = "single_line_text_field"; metafield.value = "123"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.order_id = 450789469 metafield.namespace = "my_fields" metafield.key = "purchase_order" metafield.type = "single_line_text_field" metafield.value = "123" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.order_id = 450789469; metafield.namespace = "my_fields"; metafield.key = "purchase_order"; metafield.type = "single_line_text_field"; metafield.value = "123"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228944,"namespace":"my_fields","key":"purchase_order","value":"123","description":null,"owner_id":450789469,"created_at":"2025-10-01T14:32:57-04:00","updated_at":"2025-10-01T14:32:57-04:00","owner_resource":"order","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228944"}} ``` * #### Create a metafield for the Shop resource ##### ```curl curl -d '{"metafield":{"namespace":"my_fields","key":"my_items","value":"{\"items\":[\"some item\"]}","type":"json"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.namespace = "my_fields"; metafield.key = "my_items"; metafield.value = "{\"items\":[\"some item\"]}"; metafield.type = "json"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.namespace = "my_fields" metafield.key = "my_items" metafield.value = "{\"items\":[\"some item\"]}" metafield.type = "json" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.namespace = "my_fields"; metafield.key = "my_items"; metafield.value = "{\"items\":[\"some item\"]}"; metafield.type = "json"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 201 Created{"metafield":{"id":1069228952,"namespace":"my_fields","key":"my_items","value":"{\"items\":[\"some item\"]}","description":null,"owner_id":548380009,"created_at":"2025-10-01T14:33:15-04:00","updated_at":"2025-10-01T14:33:15-04:00","owner_resource":"shop","type":"json","admin_graphql_api_id":"gid://shopify/Metafield/1069228952"}} ``` * #### Creating a metafield without a key will fail and return an error ##### ```curl curl -d '{"metafield":{"key":null}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-10/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.key = null; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.key = nil metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.key = null; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 422 Unprocessable Entity{"errors":{"type":["can't be blank"],"namespace":["can't be blank","is too short (minimum is 3 characters)"],"key":["can't be blank","is too short (minimum is 2 characters)"]}} ``` *** ## getRetrieve a list of metafields from the resource's endpoint [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/queries/product) [product](https://shopify.dev/docs/api/admin-graphql/latest/queries/product) Retrieves a list of metafields attached to a particular resource by using the resource's endpoint. ### Parameters *** 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](https://shopify.dev/apps/metafields/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) *** ### Examples Retrieve metafields attached to a Blog Path parameters blog\_​id=​382285388 string required Retrieve metafields attached to a Collection Retrieve metafields attached to a Customer Retrieve metafields attached to a Draft Order Retrieve metafields attached to a Page Retrieve metafields attached to a Product Retrieve metafields attached to a Product Image Retrieve metafields attached to a Product Variant Retrieve metafields attached to an Article Retrieve metafields attached to an Order Retrieve metafields attached to the Shop Retrieve metafields attached to the Shop after the specified ID Query parameters since\_​id=​721389482 Show metafields created after the specified ID. get ## /admin/api/2025-10/blogs/382285388/metafields.​json ```bash curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` {} ## Response JSON ```json HTTP/1.1 200 OK { "metafields": [ { "id": 1069228941, "namespace": "my_fields", "key": "sponsor", "value": "Shopify", "description": null, "owner_id": 382285388, "created_at": "2025-10-01T14:32:53-04:00", "updated_at": "2025-10-01T14:32:53-04:00", "owner_resource": "blog", "type": "single_line_text_field", "admin_graphql_api_id": "gid://shopify/Metafield/1069228941" } ] } ``` ### examples * #### Retrieve metafields attached to a Blog ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, blog_id: 382285388, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, blog_id: 382285388, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, blog_id: 382285388, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":1069228941,"namespace":"my_fields","key":"sponsor","value":"Shopify","description":null,"owner_id":382285388,"created_at":"2025-10-01T14:32:53-04:00","updated_at":"2025-10-01T14:32:53-04:00","owner_resource":"blog","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228941"}]} ``` * #### Retrieve metafields attached to a Collection ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/collections/482865238/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, collection_id: 482865238, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, collection_id: 482865238, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, collection_id: 482865238, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":519046726,"namespace":"notes","key":"descriptionription","value":"Collection description","description":"Custom Collection notes","owner_id":482865238,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"collection","type":"multi_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/519046726"},{"id":624849518,"namespace":"global","key":"description_tag","value":"Some seo description value","description":null,"owner_id":482865238,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"collection","type":"multi_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/624849518"},{"id":1010236510,"namespace":"global","key":"title_tag","value":"Some seo title value","description":null,"owner_id":482865238,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"collection","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1010236510"},{"id":1069228934,"namespace":"my_fields","key":"discount","value":"25%","description":null,"owner_id":482865238,"created_at":"2025-10-01T14:32:24-04:00","updated_at":"2025-10-01T14:32:24-04:00","owner_resource":"collection","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228934"}]} ``` * #### Retrieve metafields attached to a Customer ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/customers/207119551/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, customer_id: 207119551, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, customer_id: 207119551, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, customer_id: 207119551, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":220591908,"namespace":"discounts","key":"returning_customer","value":"no","description":"Customer deserves discount","owner_id":207119551,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"customer","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/220591908"},{"id":1069228949,"namespace":"discounts","key":"special","value":"yes","description":null,"owner_id":207119551,"created_at":"2025-10-01T14:33:11-04:00","updated_at":"2025-10-01T14:33:11-04:00","owner_resource":"customer","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228949"}]} ``` * #### Retrieve metafields attached to a Draft Order ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/draft_orders/622762746/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, draft_order_id: 622762746, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, draft_order_id: 622762746, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, draft_order_id: 622762746, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":106172460,"namespace":"notes","key":"note","value":"B flat","description":"This is for notes","owner_id":622762746,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"draft_order","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/106172460"},{"id":1069228935,"namespace":"my_fields","key":"purchase_order","value":"97453","description":null,"owner_id":622762746,"created_at":"2025-10-01T14:32:33-04:00","updated_at":"2025-10-01T14:32:33-04:00","owner_resource":"draft_order","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228935"}]} ``` * #### Retrieve metafields attached to a Page ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/pages/131092082/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, page_id: 131092082, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, page_id: 131092082, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, page_id: 131092082, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":290519330,"namespace":"translation","key":"title_fr","value":"Le TOS","description":"Page French title translation","owner_id":131092082,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"page","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/290519330"},{"id":1069228945,"namespace":"my_fields","key":"subtitle","value":"A subtitle for my page","description":null,"owner_id":131092082,"created_at":"2025-10-01T14:32:58-04:00","updated_at":"2025-10-01T14:32:58-04:00","owner_resource":"page","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228945"}]} ``` * #### Retrieve metafields attached to a Product ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/products/632910392/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, product_id: 632910392, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, product_id: 632910392, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, product_id: 632910392, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":51714266,"namespace":"my_namespace","key":"my_key","value":"Hello","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/51714266"},{"id":116539875,"namespace":"descriptors","key":"subtitle","value":"The best ipod","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/116539875"},{"id":263497237,"namespace":"installments","key":"disable","value":true,"description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"boolean","admin_graphql_api_id":"gid://shopify/Metafield/263497237"},{"id":273160493,"namespace":"facts","key":"isbn","value":"978-0-14-004259-7","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/273160493"},{"id":524118066,"namespace":"facts","key":"ean","value":"0123456789012","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/524118066"},{"id":543636738,"namespace":"reviews","key":"rating_count","value":1,"description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"number_integer","admin_graphql_api_id":"gid://shopify/Metafield/543636738"},{"id":572384404,"namespace":"reviews","key":"rating","value":"{\"value\": \"3.5\", \"scale_min\": \"1.0\", \"scale_max\": \"5.0\"}","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"rating","admin_graphql_api_id":"gid://shopify/Metafield/572384404"},{"id":613330208,"namespace":"shopify_filter","key":"display","value":"retina","description":"This field keeps track of the type of display","owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/613330208"},{"id":779326701,"namespace":"facts","key":"upc","value":"012345678901","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/779326701"},{"id":845366454,"namespace":"translations","key":"title_fr","value":"produit","description":"French product title","owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/845366454"},{"id":861799889,"namespace":"my_other_fields","key":"organic","value":true,"description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"boolean","admin_graphql_api_id":"gid://shopify/Metafield/861799889"},{"id":870326793,"namespace":"descriptors","key":"care_guide","value":"Wash in cold water","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":null,"admin_graphql_api_id":"gid://shopify/Metafield/870326793"},{"id":908250163,"namespace":"my_other_fields","key":"shipping_policy","value":"Ships for free in Canada","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"multi_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/908250163"},{"id":925288667,"namespace":"my_other_fields","key":"year_released","value":2019,"description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"number_integer","admin_graphql_api_id":"gid://shopify/Metafield/925288667"},{"id":1001077698,"namespace":"my_fields","key":"best_for","value":"travel","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1001077698"},{"id":1029402048,"namespace":"my_other_fields","key":"ingredients","value":"[\"apple\", \"music\", \"u2\"]","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"list.single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1029402048"},{"id":1069228938,"namespace":"inventory","key":"warehouse","value":25,"description":null,"owner_id":632910392,"created_at":"2025-10-01T14:32:45-04:00","updated_at":"2025-10-01T14:32:45-04:00","owner_resource":"product","type":"number_integer","admin_graphql_api_id":"gid://shopify/Metafield/1069228938"}]} ``` * #### Retrieve metafields attached to a Product Image ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/product_images/850703190/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, product_image_id: 850703190, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, product_image_id: 850703190, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, product_image_id: 850703190, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":625663657,"namespace":"translation","key":"title_fr","value":"tbn","description":"French product image title","owner_id":498048120,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"media_image","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/625663657"},{"id":1069228953,"namespace":"translation","key":"title_spanish","value":"botas","description":null,"owner_id":498048120,"created_at":"2025-10-01T14:33:16-04:00","updated_at":"2025-10-01T14:33:16-04:00","owner_resource":"media_image","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228953"}]} ``` * #### Retrieve metafields attached to a Product Variant ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/variants/49148385/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, variant_id: 49148385, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, variant_id: 49148385, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, variant_id: 49148385, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":1069228947,"namespace":"my_fields","key":"liner_material","value":"synthetic leather","description":null,"owner_id":49148385,"created_at":"2025-10-01T14:33:06-04:00","updated_at":"2025-10-01T14:33:06-04:00","owner_resource":"variant","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228947"}]} ``` * #### Retrieve metafields attached to an Article ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/articles/674387490/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, article_id: 674387490, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, article_id: 674387490, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, article_id: 674387490, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":1069228936,"namespace":"my_fields","key":"category","value":"outdoors","description":null,"owner_id":674387490,"created_at":"2025-10-01T14:32:36-04:00","updated_at":"2025-10-01T14:32:36-04:00","owner_resource":"article","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228936"}]} ``` * #### Retrieve metafields attached to an Order ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/orders/450789469/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, order_id: 450789469, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, order_id: 450789469, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, order_id: 450789469, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":915396079,"namespace":"notes","key":"buyer","value":"Notes about this buyer","description":"This field is for buyer notes","owner_id":450789469,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"order","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/915396079"},{"id":1069228946,"namespace":"my_fields","key":"purchase_order","value":"123","description":null,"owner_id":450789469,"created_at":"2025-10-01T14:33:02-04:00","updated_at":"2025-10-01T14:33:02-04:00","owner_resource":"order","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1069228946"}]} ``` * #### Retrieve metafields attached to the Shop ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":721389482,"namespace":"affiliates","key":"app_key","value":"app_key","description":null,"owner_id":548380009,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"shop","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/721389482"}]} ``` * #### Retrieve metafields attached to the Shop after the specified ID ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/metafields.json?since_id=721389482" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.all({ session: session, since_id: "721389482", }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.all( session: test_session, since_id: "721389482", ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.all({ session: session, since_id: "721389482", }); ``` #### response ```json HTTP/1.1 200 OK{"metafields":[{"id":1069228951,"namespace":"my_fields","key":"my_items","value":"{\"items\":[\"some item\"]}","description":null,"owner_id":548380009,"created_at":"2025-10-01T14:33:14-04:00","updated_at":"2025-10-01T14:33:14-04:00","owner_resource":"shop","type":"json","admin_graphql_api_id":"gid://shopify/Metafield/1069228951"}]} ``` *** ## getRetrieve a specific metafield [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/queries/product) [product](https://shopify.dev/docs/api/admin-graphql/latest/queries/product) Retrieve a metafield by specifying the ID. All fields of a metafield are returned unless specific fields are named. ### Parameters *** 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. *** ### Examples Retrieve a single metafield by its ID attached to a Blog Retrieve a single metafield by its ID attached to a Collection Retrieve a single metafield by its ID attached to a Customer Retrieve a single metafield by its ID attached to a Draft Order Retrieve a single metafield by its ID attached to a Page Retrieve a single metafield by its ID attached to a Product Retrieve a single metafield by its ID attached to a Product Image Retrieve a single metafield by its ID attached to a Product Variant Retrieve a single metafield by its ID attached to an Article Retrieve a single metafield by its ID attached to an Order Retrieve a single metafield by its ID attached to the Shop resource get ## /admin/api/2025-10/blogs/382285388/metafields/534526895.​json ```bash curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields/534526895.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` {} ## Response JSON ```json HTTP/1.1 200 OK { "metafield": { "id": 534526895, "namespace": "translation", "key": "title_fr", "value": "Le iPod", "description": "Blog French title translation", "owner_id": 241253187, "created_at": "2025-10-01T14:30:56-04:00", "updated_at": "2025-10-01T14:30:56-04:00", "owner_resource": "blog", "type": "single_line_text_field", "admin_graphql_api_id": "gid://shopify/Metafield/534526895" } } ``` ### examples * #### Retrieve a single metafield by its ID attached to a Blog ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields/534526895.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, blog_id: 382285388, id: 534526895, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, blog_id: 382285388, id: 534526895, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, blog_id: 382285388, id: 534526895, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":534526895,"namespace":"translation","key":"title_fr","value":"Le iPod","description":"Blog French title translation","owner_id":241253187,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"blog","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/534526895"}} ``` * #### Retrieve a single metafield by its ID attached to a Collection ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/collections/482865238/metafields/1010236510.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, collection_id: 482865238, id: 1010236510, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, collection_id: 482865238, id: 1010236510, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, collection_id: 482865238, id: 1010236510, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":1010236510,"namespace":"global","key":"title_tag","value":"Some seo title value","description":null,"owner_id":482865238,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"collection","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1010236510"}} ``` * #### Retrieve a single metafield by its ID attached to a Customer ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/customers/207119551/metafields/220591908.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, customer_id: 207119551, id: 220591908, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, customer_id: 207119551, id: 220591908, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, customer_id: 207119551, id: 220591908, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":220591908,"namespace":"discounts","key":"returning_customer","value":"no","description":"Customer deserves discount","owner_id":207119551,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"customer","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/220591908"}} ``` * #### Retrieve a single metafield by its ID attached to a Draft Order ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/draft_orders/622762746/metafields/106172460.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, draft_order_id: 622762746, id: 106172460, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, draft_order_id: 622762746, id: 106172460, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, draft_order_id: 622762746, id: 106172460, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":106172460,"namespace":"notes","key":"note","value":"B flat","description":"This is for notes","owner_id":622762746,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"draft_order","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/106172460"}} ``` * #### Retrieve a single metafield by its ID attached to a Page ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/pages/131092082/metafields/290519330.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, page_id: 131092082, id: 290519330, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, page_id: 131092082, id: 290519330, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, page_id: 131092082, id: 290519330, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":290519330,"namespace":"translation","key":"title_fr","value":"Le TOS","description":"Page French title translation","owner_id":131092082,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"page","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/290519330"}} ``` * #### Retrieve a single metafield by its ID attached to a Product ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/products/632910392/metafields/1001077698.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, product_id: 632910392, id: 1001077698, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, product_id: 632910392, id: 1001077698, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, product_id: 632910392, id: 1001077698, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":1001077698,"namespace":"my_fields","key":"best_for","value":"travel","description":null,"owner_id":632910392,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"product","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1001077698"}} ``` * #### Retrieve a single metafield by its ID attached to a Product Image ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/product_images/850703190/metafields/625663657.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, product_image_id: 850703190, id: 625663657, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, product_image_id: 850703190, id: 625663657, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, product_image_id: 850703190, id: 625663657, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":625663657,"namespace":"translation","key":"title_fr","value":"tbn","description":"French product image title","owner_id":498048120,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"media_image","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/625663657"}} ``` * #### Retrieve a single metafield by its ID attached to a Product Variant ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/variants/49148385/metafields/323119633.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, variant_id: 49148385, id: 323119633, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, variant_id: 49148385, id: 323119633, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, variant_id: 49148385, id: 323119633, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":323119633,"namespace":"my_fields","key":"color","value":"Pink","description":null,"owner_id":808950810,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"variant","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/323119633"}} ``` * #### Retrieve a single metafield by its ID attached to an Article ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/articles/674387490/metafields/838981074.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, article_id: 674387490, id: 838981074, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, article_id: 674387490, id: 838981074, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, article_id: 674387490, id: 838981074, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":838981074,"namespace":"translation","key":"title_fr","value":"Le Article","description":"Article French title translation","owner_id":134645308,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"article","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/838981074"}} ``` * #### Retrieve a single metafield by its ID attached to an Order ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/orders/450789469/metafields/915396079.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, order_id: 450789469, id: 915396079, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, order_id: 450789469, id: 915396079, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, order_id: 450789469, id: 915396079, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":915396079,"namespace":"notes","key":"buyer","value":"Notes about this buyer","description":"This field is for buyer notes","owner_id":450789469,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"order","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/915396079"}} ``` * #### Retrieve a single metafield by its ID attached to the Shop resource ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/metafields/721389482.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.find({ session: session, id: 721389482, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.find( session: test_session, id: 721389482, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.find({ session: session, id: 721389482, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"id":721389482,"namespace":"affiliates","key":"app_key","value":"app_key","description":null,"owner_id":548380009,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:30:56-04:00","owner_resource":"shop","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/721389482"}} ``` *** ## getRetrieve a count of a resource's metafields. [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/queries/metafieldDefinition?example=retrieve-a-count-of-a-resources-metafields) [metafieldDefinition](https://shopify.dev/docs/api/admin-graphql/latest/queries/metafieldDefinition?example=retrieve-a-count-of-a-resources-metafields) Get a count of all metafields that belong to a particular resource. ### Parameters *** api\_version string required *** blog\_id string required *** ### Examples Retrieve a count of metafields attached to a Blog Path parameters blog\_​id=​382285388 string required Retrieve a count of metafields attached to a Collection Retrieve a count of metafields attached to a Customer Retrieve a count of metafields attached to a Draft Order Retrieve a count of metafields attached to a Page Retrieve a count of metafields attached to a Product Retrieve a count of metafields attached to a Product Image Retrieve a count of metafields attached to a Product Variant Retrieve a count of metafields attached to an Article Retrieve a count of metafields attached to an Order Retrieve a count of metafields attached to the Shop resource get ## /admin/api/2025-10/blogs/382285388/metafields/count.​json ```bash curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` {} ## Response JSON ```json HTTP/1.1 200 OK { "count": 0 } ``` ### examples * #### Retrieve a count of metafields attached to a Blog ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, blog_id: 382285388, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, blog_id: 382285388, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, blog_id: 382285388, }); ``` #### response ```json HTTP/1.1 200 OK{"count":0} ``` * #### Retrieve a count of metafields attached to a Collection ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/collections/482865238/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, collection_id: 482865238, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, collection_id: 482865238, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, collection_id: 482865238, }); ``` #### response ```json HTTP/1.1 200 OK{"count":3} ``` * #### Retrieve a count of metafields attached to a Customer ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/customers/207119551/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, customer_id: 207119551, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, customer_id: 207119551, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, customer_id: 207119551, }); ``` #### response ```json HTTP/1.1 200 OK{"count":1} ``` * #### Retrieve a count of metafields attached to a Draft Order ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/draft_orders/622762746/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, draft_order_id: 622762746, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, draft_order_id: 622762746, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, draft_order_id: 622762746, }); ``` #### response ```json HTTP/1.1 200 OK{"count":1} ``` * #### Retrieve a count of metafields attached to a Page ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/pages/131092082/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, page_id: 131092082, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, page_id: 131092082, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, page_id: 131092082, }); ``` #### response ```json HTTP/1.1 200 OK{"count":1} ``` * #### Retrieve a count of metafields attached to a Product ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/products/632910392/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, product_id: 632910392, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, product_id: 632910392, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, product_id: 632910392, }); ``` #### response ```json HTTP/1.1 200 OK{"count":16} ``` * #### Retrieve a count of metafields attached to a Product Image ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/product_images/850703190/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, product_image_id: 850703190, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, product_image_id: 850703190, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, product_image_id: 850703190, }); ``` #### response ```json HTTP/1.1 200 OK{"count":1} ``` * #### Retrieve a count of metafields attached to a Product Variant ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/variants/49148385/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, variant_id: 49148385, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, variant_id: 49148385, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, variant_id: 49148385, }); ``` #### response ```json HTTP/1.1 200 OK{"count":0} ``` * #### Retrieve a count of metafields attached to an Article ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/articles/674387490/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, article_id: 674387490, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, article_id: 674387490, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, article_id: 674387490, }); ``` #### response ```json HTTP/1.1 200 OK{"count":0} ``` * #### Retrieve a count of metafields attached to an Order ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/orders/450789469/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, order_id: 450789469, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, order_id: 450789469, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, order_id: 450789469, }); ``` #### response ```json HTTP/1.1 200 OK{"count":1} ``` * #### Retrieve a count of metafields attached to the Shop resource ##### ```curl curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-10/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.count({ session: session, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.count( session: test_session, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.count({ session: session, }); ``` #### response ```json HTTP/1.1 200 OK{"count":1} ``` *** ## putUpdates a metafield [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsSet?example=updates-a-metafield) [metafieldsSet](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsSet?example=updates-a-metafield) Updates a metafield. The properties that can be updated are `value` and `type`. ### Parameters *** api\_version string required *** blog\_id string required *** metafield\_id string required *** ### Examples Update a metafield for a Blog Request body metafield​ Metafield resource Show metafield properties metafield.id:​534526895 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"a translated blog title" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Update a metafield for a Collection Request body metafield​ Metafield resource Show metafield properties metafield.id:​1010236510 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"seo title" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Update a metafield for a Customer Request body metafield​ Metafield resource Show metafield properties metafield.id:​220591908 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"yes" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Update a metafield for a Draft Order Request body metafield​ Metafield resource Show metafield properties metafield.id:​106172460 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"110000" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Update a metafield for a Page Request body metafield​ Metafield resource Show metafield properties metafield.id:​290519330 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"An updated translation" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Update a metafield for a Product Request body metafield​ Metafield resource Show metafield properties metafield.id:​1001077698 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"having fun" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Update a metafield for a Product Image Request body metafield​ Metafield resource Show metafield properties metafield.id:​625663657 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"translated description" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Update a metafield for a Product Variant Request body metafield​ Metafield resource Show metafield properties metafield.id:​323119633 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"Red" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Update a metafield for a Shop resource Request body metafield​ Metafield resource Show metafield properties metafield.id:​721389482 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"\[\\"something new\\"]" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"list.single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Update a metafield for an Article Request body metafield​ Metafield resource Show metafield properties metafield.id:​838981074 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"a translated title" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). Update a metafield for an Order Request body metafield​ Metafield resource Show metafield properties metafield.id:​915396079 read-only The unique ID of the metafield.\ Required when updating a metafield, but should not be included when creating as it's created automatically. metafield.value:​"Provided a discount code" -> [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MetafieldsSetInput#fields-value) The data stored in the metafield. Always stored as a string, regardless of the metafield's type. metafield.type:​"single\_line\_text\_field" The type of data that is stored in the metafield. Refer to the list of [supported types](https://shopify.dev/apps/metafields/types). put ## /admin/api/2025-10/blogs/382285388/metafields/534526895.​json ```bash curl -d '{"metafield":{"id":534526895,"value":"a translated blog title","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields/534526895.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` {} ## Response JSON ```json HTTP/1.1 200 OK { "metafield": { "value": "a translated blog title", "owner_id": 241253187, "namespace": "translation", "key": "title_fr", "id": 534526895, "description": "Blog French title translation", "created_at": "2025-10-01T14:30:56-04:00", "updated_at": "2025-10-01T14:32:20-04:00", "owner_resource": "blog", "type": "single_line_text_field", "admin_graphql_api_id": "gid://shopify/Metafield/534526895" } } ``` ### examples * #### Update a metafield for a Blog ##### ```curl curl -d '{"metafield":{"id":534526895,"value":"a translated blog title","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields/534526895.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.blog_id = 382285388; metafield.id = 534526895; metafield.value = "a translated blog title"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.blog_id = 382285388 metafield.id = 534526895 metafield.value = "a translated blog title" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.blog_id = 382285388; metafield.id = 534526895; metafield.value = "a translated blog title"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"a translated blog title","owner_id":241253187,"namespace":"translation","key":"title_fr","id":534526895,"description":"Blog French title translation","created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:32:20-04:00","owner_resource":"blog","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/534526895"}} ``` * #### Update a metafield for a Collection ##### ```curl curl -d '{"metafield":{"id":1010236510,"value":"seo title","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/collections/482865238/metafields/1010236510.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.collection_id = 482865238; metafield.id = 1010236510; metafield.value = "seo title"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.collection_id = 482865238 metafield.id = 1010236510 metafield.value = "seo title" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.collection_id = 482865238; metafield.id = 1010236510; metafield.value = "seo title"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"seo title","owner_id":482865238,"namespace":"global","key":"title_tag","id":1010236510,"description":null,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:32:41-04:00","owner_resource":"collection","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1010236510"}} ``` * #### Update a metafield for a Customer ##### ```curl curl -d '{"metafield":{"id":220591908,"value":"yes","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/customers/207119551/metafields/220591908.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.customer_id = 207119551; metafield.id = 220591908; metafield.value = "yes"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.customer_id = 207119551 metafield.id = 220591908 metafield.value = "yes" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.customer_id = 207119551; metafield.id = 220591908; metafield.value = "yes"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"yes","owner_id":207119551,"namespace":"discounts","key":"returning_customer","id":220591908,"description":"Customer deserves discount","created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:32:30-04:00","owner_resource":"customer","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/220591908"}} ``` * #### Update a metafield for a Draft Order ##### ```curl curl -d '{"metafield":{"id":106172460,"value":"110000","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/draft_orders/622762746/metafields/106172460.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.draft_order_id = 622762746; metafield.id = 106172460; metafield.value = "110000"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.draft_order_id = 622762746 metafield.id = 106172460 metafield.value = "110000" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.draft_order_id = 622762746; metafield.id = 106172460; metafield.value = "110000"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"110000","owner_id":622762746,"namespace":"notes","key":"note","id":106172460,"description":"This is for notes","created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:33:12-04:00","owner_resource":"draft_order","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/106172460"}} ``` * #### Update a metafield for a Page ##### ```curl curl -d '{"metafield":{"id":290519330,"value":"An updated translation","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/pages/131092082/metafields/290519330.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.page_id = 131092082; metafield.id = 290519330; metafield.value = "An updated translation"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.page_id = 131092082 metafield.id = 290519330 metafield.value = "An updated translation" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.page_id = 131092082; metafield.id = 290519330; metafield.value = "An updated translation"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"An updated translation","owner_id":131092082,"namespace":"translation","key":"title_fr","id":290519330,"description":"Page French title translation","created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:33:08-04:00","owner_resource":"page","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/290519330"}} ``` * #### Update a metafield for a Product ##### ```curl curl -d '{"metafield":{"id":1001077698,"value":"having fun","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/products/632910392/metafields/1001077698.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.product_id = 632910392; metafield.id = 1001077698; metafield.value = "having fun"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.product_id = 632910392 metafield.id = 1001077698 metafield.value = "having fun" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.product_id = 632910392; metafield.id = 1001077698; metafield.value = "having fun"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"having fun","owner_id":632910392,"namespace":"my_fields","key":"best_for","id":1001077698,"description":null,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:32:14-04:00","owner_resource":"product","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/1001077698"}} ``` * #### Update a metafield for a Product Image ##### ```curl curl -d '{"metafield":{"id":625663657,"value":"translated description","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/product_images/850703190/metafields/625663657.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.product_image_id = 850703190; metafield.id = 625663657; metafield.value = "translated description"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.product_image_id = 850703190 metafield.id = 625663657 metafield.value = "translated description" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.product_image_id = 850703190; metafield.id = 625663657; metafield.value = "translated description"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"translated description","owner_id":498048120,"namespace":"translation","key":"title_fr","id":625663657,"description":"French product image title","created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:32:17-04:00","owner_resource":"media_image","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/625663657"}} ``` * #### Update a metafield for a Product Variant ##### ```curl curl -d '{"metafield":{"id":323119633,"value":"Red","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/variants/49148385/metafields/323119633.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.variant_id = 49148385; metafield.id = 323119633; metafield.value = "Red"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.variant_id = 49148385 metafield.id = 323119633 metafield.value = "Red" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.variant_id = 49148385; metafield.id = 323119633; metafield.value = "Red"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"Red","owner_id":808950810,"namespace":"my_fields","key":"color","id":323119633,"description":null,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:32:36-04:00","owner_resource":"variant","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/323119633"}} ``` * #### Update a metafield for a Shop resource ##### ```curl curl -d '{"metafield":{"id":721389482,"value":"[\"something new\"]","type":"list.single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/metafields/721389482.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.id = 721389482; metafield.value = "[\"something new\"]"; metafield.type = "list.single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.id = 721389482 metafield.value = "[\"something new\"]" metafield.type = "list.single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.id = 721389482; metafield.value = "[\"something new\"]"; metafield.type = "list.single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"[\"something new\"]","owner_id":548380009,"namespace":"affiliates","key":"app_key","id":721389482,"description":null,"created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:32:49-04:00","owner_resource":"shop","type":"list.single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/721389482"}} ``` * #### Update a metafield for an Article ##### ```curl curl -d '{"metafield":{"id":838981074,"value":"a translated title","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/articles/674387490/metafields/838981074.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.article_id = 674387490; metafield.id = 838981074; metafield.value = "a translated title"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.article_id = 674387490 metafield.id = 838981074 metafield.value = "a translated title" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.article_id = 674387490; metafield.id = 838981074; metafield.value = "a translated title"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"a translated title","owner_id":134645308,"namespace":"translation","key":"title_fr","id":838981074,"description":"Article French title translation","created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:32:14-04:00","owner_resource":"article","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/838981074"}} ``` * #### Update a metafield for an Order ##### ```curl curl -d '{"metafield":{"id":915396079,"value":"Provided a discount code","type":"single_line_text_field"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/orders/450789469/metafields/915396079.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const metafield = new admin.rest.resources.Metafield({session: session}); metafield.order_id = 450789469; metafield.id = 915396079; metafield.value = "Provided a discount code"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session metafield = ShopifyAPI::Metafield.new(session: test_session) metafield.order_id = 450789469 metafield.id = 915396079 metafield.value = "Provided a discount code" metafield.type = "single_line_text_field" metafield.save! ``` ##### ```node // Session is built by the OAuth process const metafield = new shopify.rest.Metafield({session: session}); metafield.order_id = 450789469; metafield.id = 915396079; metafield.value = "Provided a discount code"; metafield.type = "single_line_text_field"; await metafield.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"metafield":{"value":"Provided a discount code","owner_id":450789469,"namespace":"notes","key":"buyer","id":915396079,"description":"This field is for buyer notes","created_at":"2025-10-01T14:30:56-04:00","updated_at":"2025-10-01T14:32:37-04:00","owner_resource":"order","type":"single_line_text_field","admin_graphql_api_id":"gid://shopify/Metafield/915396079"}} ``` *** ## delDeletes a metafield by its ID [![](https://shopify.dev/images/logos/GraphQL.svg)![](https://shopify.dev/images/logos/GraphQL-dark.svg)](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsDelete?example=deletes-a-metafield-by-its-id) [metafieldsDelete](https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsDelete?example=deletes-a-metafield-by-its-id) Deletes a metafield by its ID. ### Parameters *** api\_version string required *** blog\_id string required *** metafield\_id string required *** ### Examples Delete a metafield by its ID for a Blog Delete a metafield by its ID for a Collection Delete a metafield by its ID for a Customer Delete a metafield by its ID for a Draft Order Delete a metafield by its ID for a Page Delete a metafield by its ID for a Product Delete a metafield by its ID for a Product Image Delete a metafield by its ID for a Product Variant Delete a metafield by its ID for an Article Delete a metafield by its ID for an Order Delete a metafield by its ID for the Shop resource del ## /admin/api/2025-10/blogs/382285388/metafields/534526895.​json ```bash curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields/534526895.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` {} ## Response JSON ```json HTTP/1.1 200 OK {} ``` ### examples * #### Delete a metafield by its ID for a Blog ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/blogs/382285388/metafields/534526895.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, blog_id: 382285388, id: 534526895, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, blog_id: 382285388, id: 534526895, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, blog_id: 382285388, id: 534526895, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Delete a metafield by its ID for a Collection ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/collections/482865238/metafields/1010236510.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, collection_id: 482865238, id: 1010236510, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, collection_id: 482865238, id: 1010236510, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, collection_id: 482865238, id: 1010236510, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Delete a metafield by its ID for a Customer ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/customers/207119551/metafields/220591908.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, customer_id: 207119551, id: 220591908, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, customer_id: 207119551, id: 220591908, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, customer_id: 207119551, id: 220591908, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Delete a metafield by its ID for a Draft Order ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/draft_orders/622762746/metafields/106172460.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, draft_order_id: 622762746, id: 106172460, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, draft_order_id: 622762746, id: 106172460, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, draft_order_id: 622762746, id: 106172460, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Delete a metafield by its ID for a Page ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/pages/131092082/metafields/290519330.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, page_id: 131092082, id: 290519330, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, page_id: 131092082, id: 290519330, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, page_id: 131092082, id: 290519330, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Delete a metafield by its ID for a Product ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/products/632910392/metafields/1001077698.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, product_id: 632910392, id: 1001077698, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, product_id: 632910392, id: 1001077698, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, product_id: 632910392, id: 1001077698, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Delete a metafield by its ID for a Product Image ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/product_images/850703190/metafields/625663657.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, product_image_id: 850703190, id: 625663657, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, product_image_id: 850703190, id: 625663657, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, product_image_id: 850703190, id: 625663657, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Delete a metafield by its ID for a Product Variant ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/variants/49148385/metafields/323119633.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, variant_id: 49148385, id: 323119633, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, variant_id: 49148385, id: 323119633, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, variant_id: 49148385, id: 323119633, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Delete a metafield by its ID for an Article ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/articles/674387490/metafields/838981074.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, article_id: 674387490, id: 838981074, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, article_id: 674387490, id: 838981074, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, article_id: 674387490, id: 838981074, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Delete a metafield by its ID for an Order ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/orders/450789469/metafields/915396079.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, order_id: 450789469, id: 915396079, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, order_id: 450789469, id: 915396079, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, order_id: 450789469, id: 915396079, }); ``` #### response ```json HTTP/1.1 200 OK{} ``` * #### Delete a metafield by its ID for the Shop resource ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/metafields/721389482.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Metafield.delete({ session: session, id: 721389482, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Metafield.delete( session: test_session, id: 721389482, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Metafield.delete({ session: session, id: 721389482, }); ``` #### response ```json HTTP/1.1 200 OK{} ```