The REST Admin API is a legacy API as of October 1, 2024. All apps and integrations should be built with the GraphQL Admin API. For details and migration steps, visit our migration guide.

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?

Properties

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

author
Learn more about accessing protected customer data
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
Learn more about accessing protected customer data
The email address of the author of the comment.

id
read-only
A unique numeric identifier for the comment.

ip
Learn more about accessing protected customer data
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:


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"
}

Creates a comment for an article

api_version
string
required

Was this section helpful?
Request body
comment
Learn more about accessing protected customer data
Comment resource
Was this section helpful?
post
/admin/api/2024-07/comments.json
Copy
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/2024-07/comments.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"
{}Response
JSON
HTTP/1.1 201 Created
{
  "comment": {
    "id": 757536355,
    "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": "2024-09-30T13:21:43-04:00",
    "updated_at": "2024-09-30T13:21:43-04:00",
    "ip": "107.20.160.121",
    "user_agent": null,
    "published_at": null
  }
}

Approves a comment

api_version
string
required

comment_id
string
required

Was this section helpful?
Path parameters
commentid=653537639
string
required
Was this section helpful?
post
/admin/api/2024-07/comments/653537639/approve.json
Copy
curl -d '{}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2024-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": "2024-09-30T13:21:52-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": "2024-09-30T12:18:04-04:00",
  "updated_at": "2024-09-30T13:21:52-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"
}

Marks a comment as not spam

api_version
string
required

comment_id
string
required

Was this section helpful?
Path parameters
commentid=653537639
string
required
Was this section helpful?
post
/admin/api/2024-07/comments/653537639/not_spam.json
Copy
curl -d '{}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2024-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": "2024-09-30T13:21:59-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": "2024-09-30T12:18:04-04:00",
  "updated_at": "2024-09-30T13:21:59-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"
}

Removes a comment

api_version
string
required

comment_id
string
required

Was this section helpful?
Path parameters
commentid=653537639
string
required
Was this section helpful?
post
/admin/api/2024-07/comments/653537639/remove.json
Copy
curl -d '{}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2024-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": "2024-09-30T12:18:04-04:00",
  "updated_at": "2024-09-30T13:21:43-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 section titled 'POST request, Restores a previously removed comment'

post
Restores a previously removed comment
deprecated

Restores a previously removed comment

api_version
string
required

comment_id
string
required

Was this section helpful?
Path parameters
commentid=653537639
string
required
Was this section helpful?
post
/admin/api/2024-07/comments/653537639/restore.json
Copy
curl -d '{}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2024-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": "2024-09-30T13:21:46-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": "2024-09-30T12:18:04-04:00",
  "updated_at": "2024-09-30T13:21:46-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"
}

Marks a comment as spam

api_version
string
required

comment_id
string
required

Was this section helpful?
Path parameters
commentid=653537639
string
required
Was this section helpful?
post
/admin/api/2024-07/comments/653537639/spam.json
Copy
curl -d '{}' \
-X POST "https://your-development-store.myshopify.com/admin/api/2024-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": "2024-09-30T12:18:04-04:00",
  "updated_at": "2024-09-30T13:21:56-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.

since_id
Restrict results to after the specified ID.

status
Filter results by their status.

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?
Query parameters
sinceid=118373535
Restrict results to after the specified ID.
Was this section helpful?
get
/admin/api/2024-07/comments.json?sinceid=118373535
Copy
curl -X GET "https://your-development-store.myshopify.com/admin/api/2024-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": "2024-09-30T12:18:04-04:00",
      "updated_at": "2024-09-30T12:18:04-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?
Path parameters
commentid=118373535
string
required
Was this section helpful?
get
/admin/api/2024-07/comments/118373535.json
Copy
curl -X GET "https://your-development-store.myshopify.com/admin/api/2024-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": "2024-09-30T12:18:04-04:00",
    "updated_at": "2024-09-30T12:18:04-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.

status
Retrieve a count of comments with a given status.

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?
Query parameters
Was this section helpful?
get
/admin/api/2024-07/comments/count.json?articleid=134645308&blogid=241253187
Copy
curl -X GET "https://your-development-store.myshopify.com/admin/api/2024-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
}

Updates a comment of an article

api_version
string
required

comment_id
string
required

Was this section helpful?
Path parameters
commentid=118373535
string
required
Request body
comment
Learn more about accessing protected customer data
Comment resource
Was this section helpful?
put
/admin/api/2024-07/comments/118373535.json
Copy
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":"2024-09-30T17:21:44.003Z"}}' \
-X PUT "https://your-development-store.myshopify.com/admin/api/2024-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": "2024-09-30T13:21:44-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": "2024-09-30T12:18:04-04:00",
    "updated_at": "2024-09-30T13:21:44-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"
  }
}