--- title: node - GraphQL Admin description: >- Returns a specific node (any object that implements the [Node](https://shopify.dev/api/admin-graphql/latest/interfaces/Node) interface) by ID, in accordance with the [Relay specification](https://relay.dev/docs/guides/graphql-server-specification/#object-identification). This field is commonly used for refetching an object. api_version: unstable api_name: admin source_url: html: 'https://shopify.dev/docs/api/admin-graphql/unstable/queries/node' md: 'https://shopify.dev/docs/api/admin-graphql/unstable/queries/node.md' --- # node query Returns a specific node (any object that implements the [Node](https://shopify.dev/api/admin-graphql/latest/interfaces/Node) interface) by ID, in accordance with the [Relay specification](https://relay.dev/docs/guides/graphql-server-specification/#object-identification). This field is commonly used for refetching an object. ## Arguments * id [ID!](https://shopify.dev/docs/api/admin-graphql/unstable/scalars/ID) required The ID of the `Node` to return. *** ## Possible returns * Node [Node](https://shopify.dev/docs/api/admin-graphql/unstable/interfaces/Node) An object with an ID field to support global identification, in accordance with the [Relay specification](https://relay.dev/graphql/objectidentification.htm#sec-Node-Interface). This interface is used by the [node](https://shopify.dev/api/admin-graphql/unstable/queries/node) and [nodes](https://shopify.dev/api/admin-graphql/unstable/queries/nodes) queries. *** ## Examples * ### Retrieve a product using a node query #### Description The following query retrieves a product using its ID. #### Query ```graphql query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title handle } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { node(id: \"gid://shopify/Product/108828309\") { id ... on Product { title handle } } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title handle } } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title handle } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title handle } } }`, }); ``` #### Response ```json { "node": { "id": "gid://shopify/Product/108828309", "title": "Draft", "handle": "draft" } } ``` ## Retrieve a product using a node query [Open in GraphiQL](http://localhost:3457/graphiql?query=query%20%7B%0A%20%20node\(id%3A%20%22gid%3A%2F%2Fshopify%2FProduct%2F108828309%22\)%20%7B%0A%20%20%20%20id%0A%20%20%20%20...%20on%20Product%20%7B%0A%20%20%20%20%20%20title%0A%20%20%20%20%20%20handle%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D) ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title handle } } }`, ); const json = await response.json(); return json.data; } ``` ##### GQL ``` query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title handle } } } ``` ##### cURL ``` curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { node(id: \"gid://shopify/Product/108828309\") { id ... on Product { title handle } } }" }' ``` ##### React Router ``` import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title handle } } }`, ); const json = await response.json(); return json.data; } ``` ##### Node.js ``` const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title handle } } }`, }); ``` ##### Ruby ``` session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title handle } } } QUERY response = client.query(query: query) ``` ## Response JSON ```json { "node": { "id": "gid://shopify/Product/108828309", "title": "Draft", "handle": "draft" } } ```