--- title: Metafield - Customer API description: |- The custom metadata attached to a resource. Metafields can be sorted into namespaces and are comprised of keys, values, and value types. api_version: 2025-10 api_name: customer type: object api_type: graphql source_url: html: https://shopify.dev/docs/api/customer/latest/objects/metafield md: https://shopify.dev/docs/api/customer/latest/objects/metafield.md --- # Metafield object The custom metadata attached to a resource. Metafields can be sorted into namespaces and are comprised of keys, values, and value types. ## Fields * compare​Digest [String!](https://shopify.dev/docs/api/customer/latest/scalars/String) non-null The data stored in the resource, represented as a digest. * created​At [Date​Time!](https://shopify.dev/docs/api/customer/latest/scalars/DateTime) non-null The date and time when the metafield was created. * id [ID!](https://shopify.dev/docs/api/customer/latest/scalars/ID) non-null[Pre-auth accessible](https://shopify.dev/docs/apps/build/customer-accounts/order-status-page#customer-account-api) A globally-unique ID. * json​Value [JSON!](https://shopify.dev/docs/api/customer/latest/scalars/JSON) non-null The data stored in the metafield in JSON format. * key [String!](https://shopify.dev/docs/api/customer/latest/scalars/String) non-null[Pre-auth accessible](https://shopify.dev/docs/apps/build/customer-accounts/order-status-page#customer-account-api) The key name for a metafield. * namespace [String!](https://shopify.dev/docs/api/customer/latest/scalars/String) non-null[Pre-auth accessible](https://shopify.dev/docs/apps/build/customer-accounts/order-status-page#customer-account-api) The namespace for a metafield. * type [String!](https://shopify.dev/docs/api/customer/latest/scalars/String) non-null[Pre-auth accessible](https://shopify.dev/docs/apps/build/customer-accounts/order-status-page#customer-account-api) The type name of the metafield. See the list of [supported types](https://shopify.dev/apps/metafields/definitions/types). * updated​At [Date​Time!](https://shopify.dev/docs/api/customer/latest/scalars/DateTime) non-null The date and time when the metafield was updated. * value [String!](https://shopify.dev/docs/api/customer/latest/scalars/String) non-null[Pre-auth accessible](https://shopify.dev/docs/apps/build/customer-accounts/order-status-page#customer-account-api) The value of a metafield. * description [String](https://shopify.dev/docs/api/customer/latest/scalars/String) Deprecated *** ## Map ### Fields with this object * {}[Company.metafield](https://shopify.dev/docs/api/customer/latest/objects/Company#field-metafield) * {}[Company.metafields](https://shopify.dev/docs/api/customer/latest/objects/Company#field-metafields) * {}[CompanyLocation.metafield](https://shopify.dev/docs/api/customer/latest/objects/CompanyLocation#field-metafield) * {}[CompanyLocation.metafields](https://shopify.dev/docs/api/customer/latest/objects/CompanyLocation#field-metafields) * {}[Customer.metafield](https://shopify.dev/docs/api/customer/latest/objects/Customer#field-metafield) * {}[Customer.metafields](https://shopify.dev/docs/api/customer/latest/objects/Customer#field-metafields) * ||-[HasMetafields.metafield](https://shopify.dev/docs/api/customer/latest/interfaces/HasMetafields#field-metafield) * ||-[HasMetafields.metafields](https://shopify.dev/docs/api/customer/latest/interfaces/HasMetafields#field-metafields) * {}[Order.metafield](https://shopify.dev/docs/api/customer/latest/objects/Order#field-metafield) * {}[Order.metafields](https://shopify.dev/docs/api/customer/latest/objects/Order#field-metafields) * {}[Shop.metafield](https://shopify.dev/docs/api/customer/latest/objects/Shop#field-metafield) * {}[Shop.metafields](https://shopify.dev/docs/api/customer/latest/objects/Shop#field-metafields) *** ## Mutations * [metafields​Set](https://shopify.dev/docs/api/customer/latest/mutations/metafieldsSet) mutation Sets metafield values. Metafield values will be set regardless if they were previously created or not. Allows a maximum of 25 metafields to be set at a time. This operation is atomic, meaning no changes are persisted if an error is encountered. As of `2024-07`, this operation supports compare-and-set functionality to better handle concurrent requests. If `compareDigest` is set for any metafield, the mutation will only set that metafield if the persisted metafield value matches the digest used on `compareDigest`. If the metafield doesn't exist yet, but you want to guarantee that the operation will run in a safe manner, set `compareDigest` to `null`. The `compareDigest` value can be acquired by querying the metafield object and selecting `compareDigest` as a field. If the `compareDigest` value does not match the digest for the persisted value, the mutation will return an error. You can opt out of write guarantees by not sending `compareDigest` in the request. *** ## <\~> Metafield Mutations ### Mutated by * <\~>[metafields​Set](https://shopify.dev/docs/api/customer/latest/mutations/metafieldsSet) *** ## Interfaces * * [Has​Compare​Digest](https://shopify.dev/docs/api/customer/latest/interfaces/HasCompareDigest) interface * [Node](https://shopify.dev/docs/api/customer/latest/interfaces/Node) interface *** ## ||-Metafield Implements ### Implements * ||-[Has​Compare​Digest](https://shopify.dev/docs/api/customer/latest/interfaces/HasCompareDigest) * ||-[Node](https://shopify.dev/docs/api/customer/latest/interfaces/Node)