Skip to main content

The REST Admin API is a legacy API as of October 1, 2024. Starting April 1, 2025, all new public apps must be built exclusively with the GraphQL Admin API. For details and migration steps, visit our migration guide.

Comment

Requires content access scope.
Requires access to protected customer data.

A comment is a reader's response to an article in a blog. Comments appear on the article page in reverse chronological order, typically after the article body. Just as a blog can have any number of articles, an article can have any number of comments.

Article comments are a target for spammers, so Shopify blogs use a spam detection system to identify comments that are likely to be spam. Shop owners can also can mark comments as spam or not spam. Comments that are marked as spam are removed from the Shopify admin and don't appear in the blog.

Was this section helpful?

Anchor to

The Comment resource

Anchor to

Properties


article_id

A unique numeric identifier for the article that the comment belongs to.


author

The name of the author of the comment.


blog_id

A unique numeric identifier for the blog containing the article that the comment belongs to.


body

The basic Textile markup of a comment.


body_html

The text of the comment, complete with HTML markup.


created_at
read-only

The date and time (ISO 8601 format) when the comment was created.


email

The email address of the author of the comment.


id
read-only

A unique numeric identifier for the comment.


ip

The IP address from which the comment was posted.


published_at

The date and time (ISO 8601 format) when the comment was published.


status
read-only

The status of the comment. Valid values:

Show status properties
  • pending: The comment has been created but is awaiting spam detection. Depending on the result of the spam detection and the shop owner's comment preferences, this property will be transitioned to either spam, unapproved, or approved.
  • unapproved (default): The comment is awaiting approval by the shop owner. It's not visible to the readers of the blog.
  • published: The comment has been approved (if the blog requires comments to be approved) and is visible to readers of the blog.
  • spam: The comment has been marked as spam and removed from the Shopify admin. It's not visible to readers of the blog.
  • removed: The comment has been removed by the shop owner. It's not visible to readers of the blog.

updated_at
read-only

The date and time (ISO 8601 format) when the comment was last modified. When the comment is created, this matches the value of created_at. If the blog requires comments to be approved, then this value is updated to the date and time when the comment is approved.


user_agent

The user agent string provided by the software used to create the comment (usually a browser).


Was this section helpful?
{}

The Comment resource

{
"article_id": 134645308,
"author": "Soleone",
"blog_id": 241253187,
"body": "This is a _great_ article.",
"body_html": "<p>This is a <em>great</em> article.</p>",
"created_at": "2012-08-24T14:01:46-04:00",
"email": "soleone@example.net",
"id": 653537639,
"ip": "127.0.0.1",
"published_at": "2012-08-24T14:02:00-04:00",
"status": "unapproved",
"updated_at": "2012-08-24T14:02:00-04:00",
"user_agent": "Mozilla/5.0"
}

Anchor to POST request, Creates a comment for an article
post
Creates a comment for an article
deprecated

Creates a comment for an article

Anchor to Parameters of Creates a comment for an articleParameters


api_version
string
required

Was this section helpful?

Anchor to post-comments-examplesExamples

Create a comment for an article of a blog using basic Textile markup

Request body
comment
Comment resource
Show comment properties
comment.body:"I like comments\nAnd I like posting them *RESTfully*."

The basic Textile markup of a comment.

comment.author:"Your name"

The name of the author of the comment.

comment.email:"your@email.com"

The email address of the author of the comment.

comment.ip:"107.20.160.121"

The IP address from which the comment was posted.

comment.blog_id:241253187

A unique numeric identifier for the blog containing the article that the comment belongs to.

comment.article_id:134645308

A unique numeric identifier for the article that the comment belongs to.

Creating a comment without a body, author, and email fails and returns an error

Request body
comment
Comment resource
Show comment properties
comment.article_id:134645308

A unique numeric identifier for the article that the comment belongs to.

Was this section helpful?
post

/admin/api/2025-07/comments.json

curl -d '{"comment":{"body":"I like comments\nAnd I like posting them *RESTfully*.","author":"Your name","email":"your@email.com","ip":"107.20.160.121","blog_id":241253187,"article_id":134645308}}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2025-07/comments.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"

{}

Response

JSON
HTTP/1.1 201 Created
{
"comment": {
"id": 757536351,
"body": "I like comments\nAnd I like posting them *RESTfully*.",
"body_html": "<p>I like comments<br>\nAnd I like posting them <strong>RESTfully</strong>.</p>",
"author": "Your name",
"email": "your@email.com",
"status": "pending",
"article_id": 134645308,
"blog_id": 241253187,
"created_at": "2025-07-01T14:44:35-04:00",
"updated_at": "2025-07-01T14:44:35-04:00",
"ip": "107.20.160.121",
"user_agent": null,
"published_at": null
}
}

Anchor to POST request, Approves a comment
post
Approves a comment

Approves a comment

Anchor to Parameters of Approves a commentParameters


api_version
string
required

comment_id
string
required

Was this section helpful?

Anchor to post-comments-comment-id-approve-examplesExamples

Approve a comment and publish it to the blog

Path parameters
comment_id=653537639
string
required
Was this section helpful?
post

/admin/api/2025-07/comments/653537639/approve.json

curl -d '{}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2025-07/comments/653537639/approve.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"

{}

Response

JSON
HTTP/1.1 200 OK
{
"published_at": "2025-07-01T14:44:37-04:00",
"status": "published",
"id": 653537639,
"body": "Hi author, I really _like_ what you're doing there.",
"body_html": "<p>Hi author, I really <em>like</em> what you're doing there.</p>",
"author": "Soleone",
"email": "soleone@example.net",
"article_id": 134645308,
"blog_id": 241253187,
"created_at": "2025-07-01T14:37:24-04:00",
"updated_at": "2025-07-01T14:44:37-04:00",
"ip": "127.0.0.1",
"user_agent": "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"
}

Anchor to POST request, Marks a comment as not spam
post
Marks a comment as not spam

Marks a comment as not spam

Anchor to Parameters of Marks a comment as not spamParameters


api_version
string
required

comment_id
string
required

Was this section helpful?

Anchor to post-comments-comment-id-not-spam-examplesExamples

Mark a comment as not spam, restoring it to an unapproved or published state

Path parameters
comment_id=653537639
string
required
Was this section helpful?
post

/admin/api/2025-07/comments/653537639/not_spam.json

curl -d '{}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2025-07/comments/653537639/not_spam.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"

{}

Response

JSON
HTTP/1.1 200 OK
{
"published_at": "2025-07-01T14:44:50-04:00",
"status": "published",
"id": 653537639,
"body": "Hi author, I really _like_ what you're doing there.",
"body_html": "<p>Hi author, I really <em>like</em> what you're doing there.</p>",
"author": "Soleone",
"email": "soleone@example.net",
"article_id": 134645308,
"blog_id": 241253187,
"created_at": "2025-07-01T14:37:24-04:00",
"updated_at": "2025-07-01T14:44:50-04:00",
"ip": "127.0.0.1",
"user_agent": "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"
}

Anchor to POST request, Removes a comment
post
Removes a comment

Removes a comment

Anchor to Parameters of Removes a commentParameters


api_version
string
required

comment_id
string
required

Was this section helpful?

Anchor to post-comments-comment-id-remove-examplesExamples

Remove a comment

Path parameters
comment_id=653537639
string
required
Was this section helpful?
post

/admin/api/2025-07/comments/653537639/remove.json

curl -d '{}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2025-07/comments/653537639/remove.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"

{}

Response

JSON
HTTP/1.1 200 OK
{
"published_at": null,
"status": "removed",
"id": 653537639,
"body": "Hi author, I really _like_ what you're doing there.",
"body_html": "<p>Hi author, I really <em>like</em> what you're doing there.</p>",
"author": "Soleone",
"email": "soleone@example.net",
"article_id": 134645308,
"blog_id": 241253187,
"created_at": "2025-07-01T14:37:24-04:00",
"updated_at": "2025-07-01T14:44:54-04:00",
"ip": "127.0.0.1",
"user_agent": "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"
}

Anchor to POST request, Restores a previously removed comment
post
Restores a previously removed comment
deprecated

Restores a previously removed comment

Anchor to Parameters of Restores a previously removed commentParameters


api_version
string
required

comment_id
string
required

Was this section helpful?

Anchor to post-comments-comment-id-restore-examplesExamples

Restore a removed comment

Path parameters
comment_id=653537639
string
required
Was this section helpful?
post

/admin/api/2025-07/comments/653537639/restore.json

curl -d '{}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2025-07/comments/653537639/restore.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"

{}

Response

JSON
HTTP/1.1 200 OK
{
"published_at": "2025-07-01T14:44:40-04:00",
"status": "published",
"id": 653537639,
"body": "Hi author, I really _like_ what you're doing there.",
"body_html": "<p>Hi author, I really <em>like</em> what you're doing there.</p>",
"author": "Soleone",
"email": "soleone@example.net",
"article_id": 134645308,
"blog_id": 241253187,
"created_at": "2025-07-01T14:37:24-04:00",
"updated_at": "2025-07-01T14:44:40-04:00",
"ip": "127.0.0.1",
"user_agent": "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"
}

Anchor to POST request, Marks a comment as spam
post
Marks a comment as spam

Marks a comment as spam

Anchor to Parameters of Marks a comment as spamParameters


api_version
string
required

comment_id
string
required

Was this section helpful?

Anchor to post-comments-comment-id-spam-examplesExamples

Mark a comment as spam

Path parameters
comment_id=653537639
string
required
Was this section helpful?
post

/admin/api/2025-07/comments/653537639/spam.json

curl -d '{}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2025-07/comments/653537639/spam.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"

{}

Response

JSON
HTTP/1.1 200 OK
{
"published_at": null,
"status": "spam",
"id": 653537639,
"body": "Hi author, I really _like_ what you're doing there.",
"body_html": "<p>Hi author, I really <em>like</em> what you're doing there.</p>",
"author": "Soleone",
"email": "soleone@example.net",
"article_id": 134645308,
"blog_id": 241253187,
"created_at": "2025-07-01T14:37:24-04:00",
"updated_at": "2025-07-01T14:44:48-04:00",
"ip": "127.0.0.1",
"user_agent": "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. Note: This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to Make paginated requests to the REST Admin API.


api_version
string
required

created_at_max

Show comments created before date (format: 2014-04-25T16:15:47-04:00).


created_at_min

Show comments created after date (format: 2014-04-25T16:15:47-04:00).


fields

Show only certain fields, specified by a comma-separated list of field names.


limit
≤ 250
default 50

The maximum number of results to retrieve.


published_at_max

Show comments published before date (format: 2014-04-25T16:15:47-04:00).


published_at_min

Show comments published after date (format: 2014-04-25T16:15:47-04:00).


published_status
default any

Filter results by their published status.

Show published_status properties
  • published: Show only published comments.

  • unpublished: Show only unpublished comments.

  • any: Show comments of any published status.


since_id

Restrict results to after the specified ID.


status

Filter results by their status.

Show status properties
  • pending: Show only pending comments.

  • published: Show only published comments.

  • unapproved: Show only unapproved comments.


updated_at_max

Show comments last updated before date (format: 2014-04-25T16:15:47-04:00).


updated_at_min

Show comments last updated after date (format: 2014-04-25T16:15:47-04:00).


Was this section helpful?

Retrieve all comments for this shop after the specified ID

Query parameters
since_id=118373535

Restrict results to after the specified ID.

Retrieve all the comments for a certain article of a blog

Query parameters
article_id=134645308

A unique numeric identifier for the article that the comment belongs to.

blog_id=241253187

A unique numeric identifier for the blog containing the article that the comment belongs to.

Retrieve all the comments for all the articles of a blog

Query parameters
blog_id=241253187

A unique numeric identifier for the blog containing the article that the comment belongs to.

Retrieve all the comments for this shop

Was this section helpful?
get

/admin/api/2025-07/comments.json?since_id=118373535

curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/comments.json?since_id=118373535" \
-H "X-Shopify-Access-Token: {access_token}"

{}

Response

JSON
HTTP/1.1 200 OK
{
"comments": [
{
"id": 653537639,
"body": "Hi author, I really _like_ what you're doing there.",
"body_html": "<p>Hi author, I really <em>like</em> what you're doing there.</p>",
"author": "Soleone",
"email": "soleone@example.net",
"status": "unapproved",
"article_id": 134645308,
"blog_id": 241253187,
"created_at": "2025-07-01T14:37:24-04:00",
"updated_at": "2025-07-01T14:37:24-04:00",
"ip": "127.0.0.1",
"user_agent": "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",
"published_at": null
}
]
}

Retrieves a single comment by its ID


api_version
string
required

comment_id
string
required

fields

Show only certain fields, specified by a comma-separated list of field names.


Was this section helpful?

Retrieve a single comment

Path parameters
comment_id=118373535
string
required
Was this section helpful?
get

/admin/api/2025-07/comments/118373535.json

curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/comments/118373535.json" \
-H "X-Shopify-Access-Token: {access_token}"

{}

Response

JSON
HTTP/1.1 200 OK
{
"comment": {
"id": 118373535,
"body": "Hi author, I really _like_ what you're doing there.",
"body_html": "<p>Hi author, I really <em>like</em> what you're doing there.</p>",
"author": "Soleone",
"email": "soleone@example.net",
"status": "published",
"article_id": 134645308,
"blog_id": 241253187,
"created_at": "2025-07-01T14:37:24-04:00",
"updated_at": "2025-07-01T14:37:24-04:00",
"ip": "127.0.0.1",
"user_agent": "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",
"published_at": null
}
}

Retrieves a count of comments


api_version
string
required

created_at_max

Count comments created before date (format: 2014-04-25T16:15:47-04:00).


created_at_min

Count comments created after date (format: 2014-04-25T16:15:47-04:00).


published_at_max

Count comments published before date (format: 2014-04-25T16:15:47-04:00).


published_at_min

Count comments published after date (format: 2014-04-25T16:15:47-04:00).


published_status
default any

Retrieve a count of comments with a given published status.

Show published_status properties
  • published: Count only published comments.

  • unpublished: Count only unpublished comments.

  • any: Count comments of any published status.


status

Retrieve a count of comments with a given status.

Show status properties
  • pending: Count pending comments.

  • published: Count published comments.

  • unapproved: Count unapproved comments.


updated_at_max

Count comments last updated before date (format: 2014-04-25T16:15:47-04:00).


updated_at_min

Count comments last updated after date (format: 2014-04-25T16:15:47-04:00).


Was this section helpful?

Count all comments for a certain article of a blog

Query parameters
article_id=134645308

A unique numeric identifier for the article that the comment belongs to.

blog_id=241253187

A unique numeric identifier for the blog containing the article that the comment belongs to.

Count all the comments for all the articles of a blog

Query parameters
blog_id=241253187

A unique numeric identifier for the blog containing the article that the comment belongs to.

Count all the comments for this shop

Was this section helpful?
get

/admin/api/2025-07/comments/count.json?article_id=134645308&blog_id=241253187

curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/comments/count.json?article_id=134645308&blog_id=241253187" \
-H "X-Shopify-Access-Token: {access_token}"

{}

Response

JSON
HTTP/1.1 200 OK
{
"count": 2
}

Anchor to PUT request, Updates a comment of an article
put
Updates a comment of an article
deprecated

Updates a comment of an article


api_version
string
required

comment_id
string
required

Was this section helpful?

Update the body of an existing comment

Path parameters
comment_id=118373535
string
required
Request body
comment
Comment resource
Show comment properties
comment.id:118373535
read-only

A unique numeric identifier for the comment.

comment.body:"You can even update through a web service."

The basic Textile markup of a comment.

comment.author:"Your new name"

The name of the author of the comment.

comment.email:"your@updated-email.com"

The email address of the author of the comment.

comment.published_at:"2025-07-01T18:44:46.448Z"

The date and time (ISO 8601 format) when the comment was published.

Was this section helpful?
put

/admin/api/2025-07/comments/118373535.json

curl -d '{"comment":{"id":118373535,"body":"You can even update through a web service.","author":"Your new name","email":"your@updated-email.com","published_at":"2025-07-01T18:44:46.448Z"}}' \
-X PUT "https://your-development-store.myshopify.com/admin/api/2025-07/comments/118373535.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"

{}

Response

JSON
HTTP/1.1 200 OK
{
"comment": {
"author": "Your new name",
"body": "You can even update through a web service.",
"email": "your@updated-email.com",
"published_at": "2025-07-01T14:44:46-04:00",
"id": 118373535,
"body_html": "<p>You can even update through a web service.</p>",
"status": "published",
"article_id": 134645308,
"blog_id": 241253187,
"created_at": "2025-07-01T14:37:24-04:00",
"updated_at": "2025-07-01T14:44:47-04:00",
"ip": "127.0.0.1",
"user_agent": "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"
}
}