--- title: commentApprove - GraphQL Admin description: Approves a comment. api_version: 2024-10 api_name: admin type: mutation api_type: graphql source_url: html: 'https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/commentApprove' md: >- https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/commentApprove.txt --- # comment​Approve mutation Requires Any of `write_content`, `write_online_store_pages` access scopes. Approves a comment. ## Arguments * id [ID!](https://shopify.dev/docs/api/admin-graphql/2024-10/scalars/ID) required The ID of the comment to be approved. *** ## Comment​Approve​Payload returns * comment [Comment](https://shopify.dev/docs/api/admin-graphql/2024-10/objects/Comment) The comment that was approved. * user​Errors [\[Comment​Approve​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/2024-10/objects/CommentApproveUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Approves a comment #### Query ```graphql mutation ApproveComment($id: ID!) { commentApprove(id: $id) { comment { id status } userErrors { field message } } } ``` #### Variables ```json { "id": "gid://shopify/Comment/757536350" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation ApproveComment($id: ID!) { commentApprove(id: $id) { comment { id status } userErrors { field message } } }", "variables": { "id": "gid://shopify/Comment/757536350" } }' ``` #### Remix ```javascript const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation ApproveComment($id: ID!) { commentApprove(id: $id) { comment { id status } userErrors { field message } } }`, { variables: { "id": "gid://shopify/Comment/757536350" }, }, ); const data = await response.json(); ``` #### 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 mutation ApproveComment($id: ID!) { commentApprove(id: $id) { comment { id status } userErrors { field message } } } QUERY variables = { "id": "gid://shopify/Comment/757536350" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation ApproveComment($id: ID!) { commentApprove(id: $id) { comment { id status } userErrors { field message } } }`, "variables": { "id": "gid://shopify/Comment/757536350" }, }, }); ``` #### Response ```json { "commentApprove": { "comment": { "id": "gid://shopify/Comment/757536350", "status": "PUBLISHED" }, "userErrors": [] } } ``` * ### commentApprove reference [Open in GraphiQL](http://localhost:3457/graphiql?query=mutation%20ApproveComment\(%24id%3A%20ID!\)%20%7B%0A%20%20commentApprove\(id%3A%20%24id\)%20%7B%0A%20%20%20%20comment%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20status%0A%20%20%20%20%7D%0A%20%20%20%20userErrors%20%7B%0A%20%20%20%20%20%20field%0A%20%20%20%20%20%20message%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22id%22%3A%20%22gid%3A%2F%2Fshopify%2FComment%2F757536350%22%0A%7D) ```javascript const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation ApproveComment($id: ID!) { commentApprove(id: $id) { comment { id status } userErrors { field message } } }`, { variables: { "id": "gid://shopify/Comment/757536350" }, }, ); const data = await response.json(); ``` ## Input variables JSON ```json { "id": "gid://shopify/Comment/757536350" } ``` ## Response JSON ```json { "commentApprove": { "comment": { "id": "gid://shopify/Comment/757536350", "status": "PUBLISHED" }, "userErrors": [] } } ```