--- title: Metafield description: Add metafields to store resources. api_version: unstable api_name: admin-rest api_type: rest source_url: html: https://shopify.dev/docs/api/admin-rest/unstable/resources/metafield md: https://shopify.dev/docs/api/admin-rest/unstable/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/unstable/resources/metafield#post-blogs-blog-id-metafields) [/admin/api/unstable/blogs/{blog\_​id}/metafields.​json](https://shopify.dev/docs/api/admin-rest/unstable/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/unstable/resources/metafield#get-blogs-blog-id-metafields) [/admin/api/unstable/blogs/{blog\_​id}/metafields.​json](https://shopify.dev/docs/api/admin-rest/unstable/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/unstable/resources/metafield#get-blogs-blog-id-metafields-metafield-id) [/admin/api/unstable/blogs/{blog\_​id}/metafields/{metafield\_​id}.​json](https://shopify.dev/docs/api/admin-rest/unstable/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/unstable/resources/metafield#get-blogs-blog-id-metafields-count) [/admin/api/unstable/blogs/{blog\_​id}/metafields/count.​json](https://shopify.dev/docs/api/admin-rest/unstable/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/unstable/resources/metafield#put-blogs-blog-id-metafields-metafield-id) [/admin/api/unstable/blogs/{blog\_​id}/metafields/{metafield\_​id}.​json](https://shopify.dev/docs/api/admin-rest/unstable/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/unstable/resources/metafield#delete-blogs-blog-id-metafields-metafield-id) [/admin/api/unstable/blogs/{blog\_​id}/metafields/{metafield\_​id}.​json](https://shopify.dev/docs/api/admin-rest/unstable/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/unstable/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/unstable/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/unstable/blogs/382285388/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'blogs/382285388/metafields', data: {"metafield":{"namespace":"my_fields","key":"sponsor","type":"single_line_text_field","value":"Shopify"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'blogs/382285388/metafields', body: { "metafield": { "namespace": "my_fields", "key": "sponsor", "type": "single_line_text_field", "value": "Shopify" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'blogs/382285388/metafields', data: {"metafield":{"namespace":"my_fields","key":"sponsor","type":"single_line_text_field","value":"Shopify"}}, type: DataType.JSON, }); ``` #### 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/unstable/collections/482865238/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'collections/482865238/metafields', data: {"metafield":{"namespace":"my_fields","key":"discount","type":"single_line_text_field","value":"25%"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'collections/482865238/metafields', body: { "metafield": { "namespace": "my_fields", "key": "discount", "type": "single_line_text_field", "value": "25%" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'collections/482865238/metafields', data: {"metafield":{"namespace":"my_fields","key":"discount","type":"single_line_text_field","value":"25%"}}, type: DataType.JSON, }); ``` #### 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/unstable/customers/207119551/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'customers/207119551/metafields', data: {"metafield":{"namespace":"discounts","key":"special","value":"yes","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'customers/207119551/metafields', body: { "metafield": { "namespace": "discounts", "key": "special", "value": "yes", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'customers/207119551/metafields', data: {"metafield":{"namespace":"discounts","key":"special","value":"yes","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/draft_orders/622762746/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'draft_orders/622762746/metafields', data: {"metafield":{"namespace":"my_fields","key":"purchase_order","type":"single_line_text_field","value":"97453"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'draft_orders/622762746/metafields', body: { "metafield": { "namespace": "my_fields", "key": "purchase_order", "type": "single_line_text_field", "value": "97453" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'draft_orders/622762746/metafields', data: {"metafield":{"namespace":"my_fields","key":"purchase_order","type":"single_line_text_field","value":"97453"}}, type: DataType.JSON, }); ``` #### 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/unstable/pages/131092082/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'pages/131092082/metafields', data: {"metafield":{"namespace":"my_fields","key":"subtitle","type":"single_line_text_field","value":"A subtitle for my page"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'pages/131092082/metafields', body: { "metafield": { "namespace": "my_fields", "key": "subtitle", "type": "single_line_text_field", "value": "A subtitle for my page" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'pages/131092082/metafields', data: {"metafield":{"namespace":"my_fields","key":"subtitle","type":"single_line_text_field","value":"A subtitle for my page"}}, type: DataType.JSON, }); ``` #### 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/unstable/products/632910392/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'products/632910392/metafields', data: {"metafield":{"namespace":"inventory","key":"warehouse","value":25,"type":"number_integer"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'products/632910392/metafields', body: { "metafield": { "namespace": "inventory", "key": "warehouse", "value": 25, "type": "number_integer" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'products/632910392/metafields', data: {"metafield":{"namespace":"inventory","key":"warehouse","value":25,"type":"number_integer"}}, type: DataType.JSON, }); ``` #### 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/unstable/product_images/850703190/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'product_images/850703190/metafields', data: {"metafield":{"namespace":"translation","key":"title_spanish","type":"single_line_text_field","value":"botas"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'product_images/850703190/metafields', body: { "metafield": { "namespace": "translation", "key": "title_spanish", "type": "single_line_text_field", "value": "botas" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'product_images/850703190/metafields', data: {"metafield":{"namespace":"translation","key":"title_spanish","type":"single_line_text_field","value":"botas"}}, type: DataType.JSON, }); ``` #### 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/unstable/variants/49148385/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'variants/49148385/metafields', data: {"metafield":{"namespace":"my_fields","key":"liner_material","type":"single_line_text_field","value":"synthetic leather"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'variants/49148385/metafields', body: { "metafield": { "namespace": "my_fields", "key": "liner_material", "type": "single_line_text_field", "value": "synthetic leather" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'variants/49148385/metafields', data: {"metafield":{"namespace":"my_fields","key":"liner_material","type":"single_line_text_field","value":"synthetic leather"}}, type: DataType.JSON, }); ``` #### 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/unstable/articles/674387490/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'articles/674387490/metafields', data: {"metafield":{"namespace":"my_fields","key":"category","type":"single_line_text_field","value":"outdoors"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'articles/674387490/metafields', body: { "metafield": { "namespace": "my_fields", "key": "category", "type": "single_line_text_field", "value": "outdoors" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'articles/674387490/metafields', data: {"metafield":{"namespace":"my_fields","key":"category","type":"single_line_text_field","value":"outdoors"}}, type: DataType.JSON, }); ``` #### 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/unstable/orders/450789469/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'orders/450789469/metafields', data: {"metafield":{"namespace":"my_fields","key":"purchase_order","type":"single_line_text_field","value":"123"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'orders/450789469/metafields', body: { "metafield": { "namespace": "my_fields", "key": "purchase_order", "type": "single_line_text_field", "value": "123" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'orders/450789469/metafields', data: {"metafield":{"namespace":"my_fields","key":"purchase_order","type":"single_line_text_field","value":"123"}}, type: DataType.JSON, }); ``` #### 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/unstable/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'metafields', data: {"metafield":{"namespace":"my_fields","key":"my_items","value":"{\"items\":[\"some item\"]}","type":"json"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'metafields', body: { "metafield": { "namespace": "my_fields", "key": "my_items", "value": "{"items":["some item"]}", "type": "json" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'metafields', data: {"metafield":{"namespace":"my_fields","key":"my_items","value":"{\"items\":[\"some item\"]}","type":"json"}}, type: DataType.JSON, }); ``` #### 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/unstable/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'metafields', data: {"metafield":{"key":null}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.post( path: 'metafields', body: { "metafield": { "key": null } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.post({ path: 'metafields', data: {"metafield":{"key":null}}, type: DataType.JSON, }); ``` #### 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/unstable/blogs/382285388/metafields.​json ```bash curl -X GET "https://your-development-store.myshopify.com/admin/api/unstable/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/unstable/blogs/382285388/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'blogs/382285388/metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'blogs/382285388/metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'blogs/382285388/metafields', }); ``` #### 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/unstable/collections/482865238/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'collections/482865238/metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'collections/482865238/metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'collections/482865238/metafields', }); ``` #### 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/unstable/customers/207119551/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'customers/207119551/metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'customers/207119551/metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'customers/207119551/metafields', }); ``` #### 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/unstable/draft_orders/622762746/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'draft_orders/622762746/metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'draft_orders/622762746/metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'draft_orders/622762746/metafields', }); ``` #### 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/unstable/pages/131092082/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'pages/131092082/metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'pages/131092082/metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'pages/131092082/metafields', }); ``` #### 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/unstable/products/632910392/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'products/632910392/metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'products/632910392/metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'products/632910392/metafields', }); ``` #### 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/unstable/product_images/850703190/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'product_images/850703190/metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'product_images/850703190/metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'product_images/850703190/metafields', }); ``` #### 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/unstable/variants/49148385/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'variants/49148385/metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'variants/49148385/metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'variants/49148385/metafields', }); ``` #### 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/unstable/articles/674387490/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'articles/674387490/metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'articles/674387490/metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'articles/674387490/metafields', }); ``` #### 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/unstable/orders/450789469/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'orders/450789469/metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'orders/450789469/metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'orders/450789469/metafields', }); ``` #### 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/unstable/metafields.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'metafields', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'metafields', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'metafields', }); ``` #### 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/unstable/metafields.json?since_id=721389482" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'metafields', query: {"since_id":"721389482"}, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'metafields', query: { "since_id": "721389482" }, ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'metafields', query: {"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/unstable/blogs/382285388/metafields/534526895.​json ```bash curl -X GET "https://your-development-store.myshopify.com/admin/api/unstable/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/unstable/blogs/382285388/metafields/534526895.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'blogs/382285388/metafields/534526895', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'blogs/382285388/metafields/534526895', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'blogs/382285388/metafields/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/unstable/collections/482865238/metafields/1010236510.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'collections/482865238/metafields/1010236510', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'collections/482865238/metafields/1010236510', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'collections/482865238/metafields/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/unstable/customers/207119551/metafields/220591908.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'customers/207119551/metafields/220591908', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'customers/207119551/metafields/220591908', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'customers/207119551/metafields/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/unstable/draft_orders/622762746/metafields/106172460.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'draft_orders/622762746/metafields/106172460', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'draft_orders/622762746/metafields/106172460', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'draft_orders/622762746/metafields/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/unstable/pages/131092082/metafields/290519330.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'pages/131092082/metafields/290519330', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'pages/131092082/metafields/290519330', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'pages/131092082/metafields/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/unstable/products/632910392/metafields/1001077698.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'products/632910392/metafields/1001077698', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'products/632910392/metafields/1001077698', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'products/632910392/metafields/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/unstable/product_images/850703190/metafields/625663657.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'product_images/850703190/metafields/625663657', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'product_images/850703190/metafields/625663657', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'product_images/850703190/metafields/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/unstable/variants/49148385/metafields/323119633.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'variants/49148385/metafields/323119633', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'variants/49148385/metafields/323119633', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'variants/49148385/metafields/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/unstable/articles/674387490/metafields/838981074.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'articles/674387490/metafields/838981074', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'articles/674387490/metafields/838981074', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'articles/674387490/metafields/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/unstable/orders/450789469/metafields/915396079.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'orders/450789469/metafields/915396079', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'orders/450789469/metafields/915396079', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'orders/450789469/metafields/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/unstable/metafields/721389482.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'metafields/721389482', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'metafields/721389482', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'metafields/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/unstable/blogs/382285388/metafields/count.​json ```bash curl -X GET "https://your-development-store.myshopify.com/admin/api/unstable/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/unstable/blogs/382285388/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'blogs/382285388/metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'blogs/382285388/metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'blogs/382285388/metafields/count', }); ``` #### 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/unstable/collections/482865238/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'collections/482865238/metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'collections/482865238/metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'collections/482865238/metafields/count', }); ``` #### 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/unstable/customers/207119551/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'customers/207119551/metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'customers/207119551/metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'customers/207119551/metafields/count', }); ``` #### 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/unstable/draft_orders/622762746/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'draft_orders/622762746/metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'draft_orders/622762746/metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'draft_orders/622762746/metafields/count', }); ``` #### 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/unstable/pages/131092082/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'pages/131092082/metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'pages/131092082/metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'pages/131092082/metafields/count', }); ``` #### 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/unstable/products/632910392/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'products/632910392/metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'products/632910392/metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'products/632910392/metafields/count', }); ``` #### 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/unstable/product_images/850703190/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'product_images/850703190/metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'product_images/850703190/metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'product_images/850703190/metafields/count', }); ``` #### 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/unstable/variants/49148385/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'variants/49148385/metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'variants/49148385/metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'variants/49148385/metafields/count', }); ``` #### 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/unstable/articles/674387490/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'articles/674387490/metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'articles/674387490/metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'articles/674387490/metafields/count', }); ``` #### 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/unstable/orders/450789469/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'orders/450789469/metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'orders/450789469/metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'orders/450789469/metafields/count', }); ``` #### 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/unstable/metafields/count.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'metafields/count', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.get( path: 'metafields/count', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.get({ path: 'metafields/count', }); ``` #### 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/unstable/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/unstable/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/unstable/blogs/382285388/metafields/534526895.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'blogs/382285388/metafields/534526895', data: {"metafield":{"id":534526895,"value":"a translated blog title","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'blogs/382285388/metafields/534526895', body: { "metafield": { "id": 534526895, "value": "a translated blog title", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'blogs/382285388/metafields/534526895', data: {"metafield":{"id":534526895,"value":"a translated blog title","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/collections/482865238/metafields/1010236510.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'collections/482865238/metafields/1010236510', data: {"metafield":{"id":1010236510,"value":"seo title","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'collections/482865238/metafields/1010236510', body: { "metafield": { "id": 1010236510, "value": "seo title", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'collections/482865238/metafields/1010236510', data: {"metafield":{"id":1010236510,"value":"seo title","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/customers/207119551/metafields/220591908.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'customers/207119551/metafields/220591908', data: {"metafield":{"id":220591908,"value":"yes","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'customers/207119551/metafields/220591908', body: { "metafield": { "id": 220591908, "value": "yes", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'customers/207119551/metafields/220591908', data: {"metafield":{"id":220591908,"value":"yes","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/draft_orders/622762746/metafields/106172460.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'draft_orders/622762746/metafields/106172460', data: {"metafield":{"id":106172460,"value":"110000","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'draft_orders/622762746/metafields/106172460', body: { "metafield": { "id": 106172460, "value": "110000", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'draft_orders/622762746/metafields/106172460', data: {"metafield":{"id":106172460,"value":"110000","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/pages/131092082/metafields/290519330.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'pages/131092082/metafields/290519330', data: {"metafield":{"id":290519330,"value":"An updated translation","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'pages/131092082/metafields/290519330', body: { "metafield": { "id": 290519330, "value": "An updated translation", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'pages/131092082/metafields/290519330', data: {"metafield":{"id":290519330,"value":"An updated translation","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/products/632910392/metafields/1001077698.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'products/632910392/metafields/1001077698', data: {"metafield":{"id":1001077698,"value":"having fun","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'products/632910392/metafields/1001077698', body: { "metafield": { "id": 1001077698, "value": "having fun", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'products/632910392/metafields/1001077698', data: {"metafield":{"id":1001077698,"value":"having fun","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/product_images/850703190/metafields/625663657.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'product_images/850703190/metafields/625663657', data: {"metafield":{"id":625663657,"value":"translated description","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'product_images/850703190/metafields/625663657', body: { "metafield": { "id": 625663657, "value": "translated description", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'product_images/850703190/metafields/625663657', data: {"metafield":{"id":625663657,"value":"translated description","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/variants/49148385/metafields/323119633.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'variants/49148385/metafields/323119633', data: {"metafield":{"id":323119633,"value":"Red","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'variants/49148385/metafields/323119633', body: { "metafield": { "id": 323119633, "value": "Red", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'variants/49148385/metafields/323119633', data: {"metafield":{"id":323119633,"value":"Red","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/metafields/721389482.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'metafields/721389482', data: {"metafield":{"id":721389482,"value":"[\"something new\"]","type":"list.single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'metafields/721389482', body: { "metafield": { "id": 721389482, "value": "["something new"]", "type": "list.single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'metafields/721389482', data: {"metafield":{"id":721389482,"value":"[\"something new\"]","type":"list.single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/articles/674387490/metafields/838981074.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'articles/674387490/metafields/838981074', data: {"metafield":{"id":838981074,"value":"a translated title","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'articles/674387490/metafields/838981074', body: { "metafield": { "id": 838981074, "value": "a translated title", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'articles/674387490/metafields/838981074', data: {"metafield":{"id":838981074,"value":"a translated title","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/orders/450789469/metafields/915396079.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'orders/450789469/metafields/915396079', data: {"metafield":{"id":915396079,"value":"Provided a discount code","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.put( path: 'orders/450789469/metafields/915396079', body: { "metafield": { "id": 915396079, "value": "Provided a discount code", "type": "single_line_text_field" } }, ) ``` ##### ```node import { DataType } from '@shopify/shopify-api'; const client = new shopify.clients.Rest({session}); const data = await client.put({ path: 'orders/450789469/metafields/915396079', data: {"metafield":{"id":915396079,"value":"Provided a discount code","type":"single_line_text_field"}}, type: DataType.JSON, }); ``` #### 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/unstable/blogs/382285388/metafields/534526895.​json ```bash curl -X DELETE "https://your-development-store.myshopify.com/admin/api/unstable/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/unstable/blogs/382285388/metafields/534526895.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'blogs/382285388/metafields/534526895', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'blogs/382285388/metafields/534526895', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'blogs/382285388/metafields/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/unstable/collections/482865238/metafields/1010236510.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'collections/482865238/metafields/1010236510', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'collections/482865238/metafields/1010236510', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'collections/482865238/metafields/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/unstable/customers/207119551/metafields/220591908.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'customers/207119551/metafields/220591908', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'customers/207119551/metafields/220591908', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'customers/207119551/metafields/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/unstable/draft_orders/622762746/metafields/106172460.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'draft_orders/622762746/metafields/106172460', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'draft_orders/622762746/metafields/106172460', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'draft_orders/622762746/metafields/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/unstable/pages/131092082/metafields/290519330.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'pages/131092082/metafields/290519330', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'pages/131092082/metafields/290519330', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'pages/131092082/metafields/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/unstable/products/632910392/metafields/1001077698.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'products/632910392/metafields/1001077698', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'products/632910392/metafields/1001077698', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'products/632910392/metafields/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/unstable/product_images/850703190/metafields/625663657.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'product_images/850703190/metafields/625663657', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'product_images/850703190/metafields/625663657', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'product_images/850703190/metafields/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/unstable/variants/49148385/metafields/323119633.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'variants/49148385/metafields/323119633', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'variants/49148385/metafields/323119633', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'variants/49148385/metafields/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/unstable/articles/674387490/metafields/838981074.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'articles/674387490/metafields/838981074', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'articles/674387490/metafields/838981074', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'articles/674387490/metafields/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/unstable/orders/450789469/metafields/915396079.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'orders/450789469/metafields/915396079', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'orders/450789469/metafields/915396079', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'orders/450789469/metafields/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/unstable/metafields/721389482.json" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'metafields/721389482', }); ``` ##### ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Rest::Admin.new( session: session ) response = client.delete( path: 'metafields/721389482', ) ``` ##### ```node const client = new shopify.clients.Rest({session}); const data = await client.delete({ path: 'metafields/721389482', }); ``` #### response ```json HTTP/1.1 200 OK{} ```