# Blog - admin-graphql - OBJECT Version: 2024-10 ## Description Shopify stores come with a built-in blogging engine, allowing a shop to have one or more blogs. Blogs are meant to be used as a type of magazine or newsletter for the shop, with content that changes over time. ### Access Scopes `read_content` access scope or `read_online_store_pages` access scope. ## Fields * [articlesCount](/docs/api/admin-graphql/2024-10/objects/Count): Count - Count of articles. * [commentPolicy](/docs/api/admin-graphql/2024-10/enums/CommentPolicy): CommentPolicy! - Indicates whether readers can post comments to the blog and if comments are moderated or not. * [createdAt](/docs/api/admin-graphql/2024-10/scalars/DateTime): DateTime! - The date and time when the blog was created. * [feed](/docs/api/admin-graphql/2024-10/objects/BlogFeed): BlogFeed - FeedBurner provider details. Any blogs that aren't already integrated with FeedBurner can't use the service. * [handle](/docs/api/admin-graphql/2024-10/scalars/String): String! - A unique, human-friendly string for the blog. If no handle is specified, a handle will be generated automatically from the blog title. The handle is customizable and is used by the Liquid templating language to refer to the blog. * [id](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - A globally-unique ID. * [metafield](/docs/api/admin-graphql/2024-10/objects/Metafield): Metafield - A [custom field](https://shopify.dev/docs/apps/build/custom-data), including its `namespace` and `key`, that's associated with a Shopify resource for the purposes of adding and storing additional information. * [privateMetafield](/docs/api/admin-graphql/2024-10/objects/PrivateMetafield): PrivateMetafield - Returns a private metafield by namespace and key that belongs to the resource. * [tags](/docs/api/admin-graphql/2024-10/scalars/String): String! - A list of tags associated with the 200 most recent blog articles. * [templateSuffix](/docs/api/admin-graphql/2024-10/scalars/String): String - The name of the template a blog is using if it's using an alternate template. Returns `null` if a blog is using the default blog.liquid template. * [title](/docs/api/admin-graphql/2024-10/scalars/String): String! - The title of the blog. * [translations](/docs/api/admin-graphql/2024-10/objects/Translation): Translation! - The published translations associated with the resource. * [updatedAt](/docs/api/admin-graphql/2024-10/scalars/DateTime): DateTime - The date and time when the blog was update. ## Connections * [articles](/docs/api/admin-graphql/2024-10/connections/ArticleConnection): ArticleConnection! * [events](/docs/api/admin-graphql/2024-10/connections/EventConnection): EventConnection! * [metafieldDefinitions](/docs/api/admin-graphql/2024-10/connections/MetafieldDefinitionConnection): MetafieldDefinitionConnection! * [metafields](/docs/api/admin-graphql/2024-10/connections/MetafieldConnection): MetafieldConnection! * [privateMetafields](/docs/api/admin-graphql/2024-10/connections/PrivateMetafieldConnection): PrivateMetafieldConnection! ## Related queries * [blog](/docs/api/admin-graphql/2024-10/queries/blog) Returns a Blog resource by ID. * [blogs](/docs/api/admin-graphql/2024-10/queries/blogs) List of the shop's blogs. ## Related mutations * [blogCreate](/docs/api/admin-graphql/2024-10/mutations/blogCreate) Creates a blog. * [blogUpdate](/docs/api/admin-graphql/2024-10/mutations/blogUpdate) Updates a blog. ## Related Unions * [MetafieldReferencer](/docs/api/admin-graphql/2024-10/unions/MetafieldReferencer) Types of resources that may use metafields to reference other resources. ## Examples ### Receive a single Blog 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 BlogShow($id: ID!) { blog(id: $id) { id title handle } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Blog/397675442\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query BlogShow($id: ID!) {\n blog(id: $id) {\n id\n title\n handle\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Blog/397675442\"\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 BlogShow($id: ID!) {\n blog(id: $id) {\n id\n title\n handle\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Blog/397675442\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query BlogShow($id: ID!) {\n blog(id: $id) {\n id\n title\n handle\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Blog/397675442\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query BlogShow($id: ID!) {\n blog(id: $id) {\n id\n title\n handle\n }\n}" #### Graphql Input { "id": "gid://shopify/Blog/397675442" } #### Graphql Response { "data": { "blog": { "id": "gid://shopify/Blog/397675442", "title": "Yo Blog", "handle": "smallcheese-blog" } } } ### Retrieves a count of all articles from a blog 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 BlogArticleCount($id: ID!) { blog(id: $id) { articlesCount { count precision } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Blog/397675442\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query BlogArticleCount($id: ID!) {\n blog(id: $id) {\n articlesCount {\n count\n precision\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Blog/397675442\"\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 BlogArticleCount($id: ID!) {\n blog(id: $id) {\n articlesCount {\n count\n precision\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Blog/397675442\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query BlogArticleCount($id: ID!) {\n blog(id: $id) {\n articlesCount {\n count\n precision\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Blog/397675442\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query BlogArticleCount($id: ID!) {\n blog(id: $id) {\n articlesCount {\n count\n precision\n }\n }\n}" #### Graphql Input { "id": "gid://shopify/Blog/397675442" } #### Graphql Response { "data": { "blog": { "articlesCount": { "count": 1, "precision": "EXACT" } } } } ### Retrieves a list of all articles from a blog 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 BlogArticleList($id: ID!) { blog(id: $id) { id articles(first: 10) { nodes { id handle author { firstName lastName } body } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Blog/397675442\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query BlogArticleList($id: ID!) {\n blog(id: $id) {\n id\n articles(first: 10) {\n nodes {\n id\n handle\n author {\n firstName\n lastName\n }\n body\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Blog/397675442\"\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 BlogArticleList($id: ID!) {\n blog(id: $id) {\n id\n articles(first: 10) {\n nodes {\n id\n handle\n author {\n firstName\n lastName\n }\n body\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Blog/397675442\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query BlogArticleList($id: ID!) {\n blog(id: $id) {\n id\n articles(first: 10) {\n nodes {\n id\n handle\n author {\n firstName\n lastName\n }\n body\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Blog/397675442\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query BlogArticleList($id: ID!) {\n blog(id: $id) {\n id\n articles(first: 10) {\n nodes {\n id\n handle\n author {\n firstName\n lastName\n }\n body\n }\n }\n }\n}" #### Graphql Input { "id": "gid://shopify/Blog/397675442" } #### Graphql Response { "data": { "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.

" } ] } } } }