You can retrieve metafields with the [Storefront API](/docs/api/storefront) to access additional information from different types of resources. This guide describes how to expose metafields to the Storefront API, retrieve them, and hide them from the Storefront API. ## Requirements - You've completed the [Getting started with the Storefront API](/docs/storefronts/headless/building-with-the-storefront-api/getting-started) guide. - You're familiar with [querying products and collections](/docs/storefronts/headless/building-with-the-storefront-api/products-collections/getting-started). - You've created [resources that support metafields](/docs/storefronts/headless/building-with-the-storefront-api/products-collections#retrieving-metafields) in your store, and you've [created metafields](/docs/apps/build/custom-data/metafields/manage-metafields#step-1-create-a-metafield) for those resources. - You're familiar with [how metafields work](/docs/apps/build/custom-data/metafields). > Note: > You can't create, update, or delete metafields with the Storefront API. If you want to perform these types of operations on metafields, then you need to use the [GraphQL Admin API](/docs/api/admin-graphql/latest/objects/metafield). ## Step 1: Expose metafields To create a [`MetafieldStorefrontVisibility`](/docs/api/admin-graphql/latest/objects/metafieldstorefrontvisibility) record, you can use the [`metafieldStorefrontVisibilityCreate`](/docs/api/admin-graphql/latest/mutations/metafieldstorefrontvisibilitycreate) mutation in the GraphQL Admin API. The input object for the mutation uses the following fields: - `namespace` — The namespace of the metafields to be visible to the Storefront API. - `key` — The key of the metafields to be visible to the Storefront API. - `ownerType` — The core resource that owns this metafield. For example, `PRODUCT`. The following example creates a `MetafieldStorefrontVisibility` record that exposes all product metafields that have the namespace `testapp` and the key `pizza-size-inches`: