--- title: comments - GraphQL Admin description: List of the shop's comments. api_version: 2025-10 api_name: admin type: query api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/queries/comments md: https://shopify.dev/docs/api/admin-graphql/latest/queries/comments.md --- # comments query List of the shop's comments. ## CommentConnection arguments [CommentConnection!](https://shopify.dev/docs/api/admin-graphql/latest/connections/CommentConnection) * after [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * before [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * first [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int) The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * last [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int) The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * query [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax). * * default string * created\_at time * id id * published\_at time * published\_status string * status string - Filter by a case-insensitive search of multiple fields in a document. - Example: * `query=Bob Norman` * `query=title:green hoodie` Filter by the date and time when the comment was created. - Example: * `created_at:>'2020-10-21T23:39:20Z'` * `created_at:=1234` * `id:<=1234` Filter by the date and time when the comment was published. - Example: * `published_at:>'2020-10-21T23:39:20Z'` * `published_at:'2020-10-21T23:39:20Z'` * `updated_at: { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query CommentList { comments(first: 50) { nodes { id body bodyHtml author { name } ip publishedAt status userAgent } } }`, ); 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 CommentList { comments(first: 50) { nodes { id body bodyHtml author { name } ip publishedAt status userAgent } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query CommentList { comments(first: 50) { nodes { id body bodyHtml author { name } ip publishedAt status userAgent } } }`, }); ``` #### Response ```json { "comments": { "nodes": [ { "id": "gid://shopify/Comment/9450891", "body": "Check my casino at ... This will be marked as spam by akismet, because of the author name.", "bodyHtml": "

Check my casino at ... This will be marked as spam by akismet, because of the author name.

", "author": { "name": "viagra-test-123" }, "ip": "127.0.0.1", "publishedAt": null, "status": "SPAM", "userAgent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1" }, { "id": "gid://shopify/Comment/52127930", "body": "Hi author, I really _like_ what you're doing there.", "bodyHtml": "

Hi author, I really like what you're doing there.

", "author": { "name": "Soleone" }, "ip": "127.0.0.1", "publishedAt": null, "status": "PENDING", "userAgent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1" }, { "id": "gid://shopify/Comment/64683838", "body": "Check my casino at ... This will be marked as spam by akismet, because of the author name.", "bodyHtml": "

Check my casino at ... This will be marked as spam by akismet, because of the author name.

", "author": { "name": "viagra-test-123" }, "ip": "127.0.0.1", "publishedAt": null, "status": "PENDING", "userAgent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1" }, { "id": "gid://shopify/Comment/145356500", "body": "Great blog, love it!", "bodyHtml": "

Great blog, love it!

", "author": { "name": "Bob Bobsen" }, "ip": "127.0.0.1", "publishedAt": null, "status": "PUBLISHED", "userAgent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1" }, { "id": "gid://shopify/Comment/757536350", "body": "Check my casino at ... This will be marked as spam by akismet, because of the author name.", "bodyHtml": "

Check my casino at ... This will be marked as spam by akismet, because of the author name.

", "author": { "name": "viagra-test-123" }, "ip": "127.0.0.1", "publishedAt": null, "status": "UNAPPROVED", "userAgent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1" } ] } } ``` ## Retrieves a list of comments [Open in GraphiQL](http://localhost:3457/graphiql?query=query%20CommentList%20%7B%0A%20%20comments\(first%3A%2050\)%20%7B%0A%20%20%20%20nodes%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20body%0A%20%20%20%20%20%20bodyHtml%0A%20%20%20%20%20%20author%20%7B%0A%20%20%20%20%20%20%20%20name%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20ip%0A%20%20%20%20%20%20publishedAt%0A%20%20%20%20%20%20status%0A%20%20%20%20%20%20userAgent%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 CommentList { comments(first: 50) { nodes { id body bodyHtml author { name } ip publishedAt status userAgent } } }`, ); const json = await response.json(); return json.data; } ``` ##### GQL ``` query CommentList { comments(first: 50) { nodes { id body bodyHtml author { name } ip publishedAt status userAgent } } } ``` ##### cURL ``` curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query CommentList { comments(first: 50) { nodes { id body bodyHtml author { name } ip publishedAt status userAgent } } }" }' ``` ##### 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 CommentList { comments(first: 50) { nodes { id body bodyHtml author { name } ip publishedAt status userAgent } } }`, ); const json = await response.json(); return json.data; } ``` ##### Node.js ``` const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query CommentList { comments(first: 50) { nodes { id body bodyHtml author { name } ip publishedAt status userAgent } } }`, }); ``` ##### 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 CommentList { comments(first: 50) { nodes { id body bodyHtml author { name } ip publishedAt status userAgent } } } QUERY response = client.query(query: query) ``` ## Response JSON ```json { "comments": { "nodes": [ { "id": "gid://shopify/Comment/9450891", "body": "Check my casino at ... This will be marked as spam by akismet, because of the author name.", "bodyHtml": "

Check my casino at ... This will be marked as spam by akismet, because of the author name.

", "author": { "name": "viagra-test-123" }, "ip": "127.0.0.1", "publishedAt": null, "status": "SPAM", "userAgent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1" }, { "id": "gid://shopify/Comment/52127930", "body": "Hi author, I really _like_ what you're doing there.", "bodyHtml": "

Hi author, I really like what you're doing there.

", "author": { "name": "Soleone" }, "ip": "127.0.0.1", "publishedAt": null, "status": "PENDING", "userAgent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1" }, { "id": "gid://shopify/Comment/64683838", "body": "Check my casino at ... This will be marked as spam by akismet, because of the author name.", "bodyHtml": "

Check my casino at ... This will be marked as spam by akismet, because of the author name.

", "author": { "name": "viagra-test-123" }, "ip": "127.0.0.1", "publishedAt": null, "status": "PENDING", "userAgent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1" }, { "id": "gid://shopify/Comment/145356500", "body": "Great blog, love it!", "bodyHtml": "

Great blog, love it!

", "author": { "name": "Bob Bobsen" }, "ip": "127.0.0.1", "publishedAt": null, "status": "PUBLISHED", "userAgent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1" }, { "id": "gid://shopify/Comment/757536350", "body": "Check my casino at ... This will be marked as spam by akismet, because of the author name.", "bodyHtml": "

Check my casino at ... This will be marked as spam by akismet, because of the author name.

", "author": { "name": "viagra-test-123" }, "ip": "127.0.0.1", "publishedAt": null, "status": "UNAPPROVED", "userAgent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1" } ] } } ```