# privateMetafield - admin-graphql - QUERY Version: 2024-10 ## Description Returns a private metafield by ID. Private metafields are accessible only by the application that created them. ### Access Scopes ## Arguments * [id](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - The ID of the `PrivateMetafield` to return. ## Returns * [createdAt](/docs/api/admin-graphql/2024-10/scalars/DateTime): DateTime! The date and time when the private metafield was created. * [id](/docs/api/admin-graphql/2024-10/scalars/ID): ID! The ID of the private metafield. * [key](/docs/api/admin-graphql/2024-10/scalars/String): String! The key name of the private metafield. * [namespace](/docs/api/admin-graphql/2024-10/scalars/String): String! The namespace of the private metafield. * [updatedAt](/docs/api/admin-graphql/2024-10/scalars/DateTime): DateTime! The date and time when the private metafield was updated. * [value](/docs/api/admin-graphql/2024-10/scalars/String): String! The value of a private metafield. * [valueType](/docs/api/admin-graphql/2024-10/enums/PrivateMetafieldValueType): PrivateMetafieldValueType! Represents the private metafield value type. ## Examples ### Retrieve a private metafield by its ID Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { privateMetafield(id: \\\"gid://shopify/PrivateMetafield/1060470840\\\") { id key namespace value } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n privateMetafield(id: \"gid://shopify/PrivateMetafield/1060470840\") {\n id\n key\n namespace\n value\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n privateMetafield(id: \"gid://shopify/PrivateMetafield/1060470840\") {\n id\n key\n namespace\n value\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n privateMetafield(id: \"gid://shopify/PrivateMetafield/1060470840\") {\n id\n key\n namespace\n value\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n privateMetafield(id: \"gid://shopify/PrivateMetafield/1060470840\") {\n id\n key\n namespace\n value\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "privateMetafield": { "id": "gid://shopify/PrivateMetafield/1060470840", "key": "buyer", "namespace": "notes", "value": "Notes about this buyer" } } }