--- title: blog - GraphQL Admin description: Returns a `Blog` resource by ID. api_version: 2026-01 api_name: admin type: query api_type: graphql source_url: html: 'https://shopify.dev/docs/api/admin-graphql/latest/queries/blog' md: 'https://shopify.dev/docs/api/admin-graphql/latest/queries/blog.md' --- # blog query Returns a `Blog` resource by ID. ## Arguments * id *** ## Possible returns * Blog *** ## Examples * ### Receive a single Blog #### Query ```graphql query BlogShow($id: ID!) { blog(id: $id) { id title handle } } ``` #### Variables ```json { "id": "gid://shopify/Blog/397675442" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query BlogShow($id: ID!) { blog(id: $id) { id title handle } }", "variables": { "id": "gid://shopify/Blog/397675442" } }' ``` #### 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 BlogShow($id: ID!) { blog(id: $id) { id title handle } }`, { variables: { "id": "gid://shopify/Blog/397675442" }, }, ); 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 BlogShow($id: ID!) { blog(id: $id) { id title handle } } QUERY variables = { "id": "gid://shopify/Blog/397675442" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query BlogShow($id: ID!) { blog(id: $id) { id title handle } }`, "variables": { "id": "gid://shopify/Blog/397675442" }, }, }); ``` #### Response ```json { "blog": { "id": "gid://shopify/Blog/397675442", "title": "Yo Blog", "handle": "smallcheese-blog" } } ``` * ### Retrieves a count of all articles from a blog #### Query ```graphql query BlogArticleCount($id: ID!) { blog(id: $id) { articlesCount { count precision } } } ``` #### Variables ```json { "id": "gid://shopify/Blog/397675442" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query BlogArticleCount($id: ID!) { blog(id: $id) { articlesCount { count precision } } }", "variables": { "id": "gid://shopify/Blog/397675442" } }' ``` #### 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 BlogArticleCount($id: ID!) { blog(id: $id) { articlesCount { count precision } } }`, { variables: { "id": "gid://shopify/Blog/397675442" }, }, ); 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 BlogArticleCount($id: ID!) { blog(id: $id) { articlesCount { count precision } } } QUERY variables = { "id": "gid://shopify/Blog/397675442" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query BlogArticleCount($id: ID!) { blog(id: $id) { articlesCount { count precision } } }`, "variables": { "id": "gid://shopify/Blog/397675442" }, }, }); ``` #### Response ```json { "blog": { "articlesCount": { "count": 1, "precision": "EXACT" } } } ``` * ### Retrieves a list of all articles from a blog #### Query ```graphql query BlogArticleList($id: ID!) { blog(id: $id) { id articles(first: 10) { nodes { id handle author { firstName lastName } body } } } } ``` #### Variables ```json { "id": "gid://shopify/Blog/397675442" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query BlogArticleList($id: ID!) { blog(id: $id) { id articles(first: 10) { nodes { id handle author { firstName lastName } body } } } }", "variables": { "id": "gid://shopify/Blog/397675442" } }' ``` #### 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 BlogArticleList($id: ID!) { blog(id: $id) { id articles(first: 10) { nodes { id handle author { firstName lastName } body } } } }`, { variables: { "id": "gid://shopify/Blog/397675442" }, }, ); 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 BlogArticleList($id: ID!) { blog(id: $id) { id articles(first: 10) { nodes { id handle author { firstName lastName } body } } } } QUERY variables = { "id": "gid://shopify/Blog/397675442" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query BlogArticleList($id: ID!) { blog(id: $id) { id articles(first: 10) { nodes { id handle author { firstName lastName } body } } } }`, "variables": { "id": "gid://shopify/Blog/397675442" }, }, }); ``` #### Response ```json { "blog": { "id": "gid://shopify/Blog/397675442", "articles": { "nodes": [ { "id": "gid://shopify/Article/959752435", "handle": "you-should-buy-this", "author": { "firstName": "", "lastName": "" }, "body": "
Go for it, get three.
" } ] } } } ```