# Comments

<div class="section route">

<div class="primary">

## Schema

The schema defines all the fields that exist within a comment record. Any response from these endpoints can be expected to contain the fields below unless the \`\_filter\` query parameter is used or the schema field only appears in a specific context.

<table class="attributes">
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr id="schema-id">
<td><code>id</code></td>
<td>Unique identifier for the comment.
<p>JSON data type: integer</p>
<p>Read only</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-author">
<td><code>author</code></td>
<td>The ID of the user object, if author was a user.
<p>JSON data type: integer</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-author_email">
<td><code>author_email</code></td>
<td>Email address for the comment author.
<p>JSON data type: string,<br />
Format: email</p>
<p>Context: <code>edit</code></p></td>
</tr>
<tr id="schema-author_ip">
<td><code>author_ip</code></td>
<td>IP address for the comment author.
<p>JSON data type: string,<br />
Format: ip</p>
<p>Context: <code>edit</code></p></td>
</tr>
<tr id="schema-author_name">
<td><code>author_name</code></td>
<td>Display name for the comment author.
<p>JSON data type: string</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-author_url">
<td><code>author_url</code></td>
<td>URL for the comment author.
<p>JSON data type: string,<br />
Format: uri</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-author_user_agent">
<td><code>author_user_agent</code></td>
<td>User agent for the comment author.
<p>JSON data type: string</p>
<p>Context: <code>edit</code></p></td>
</tr>
<tr id="schema-content">
<td><code>content</code></td>
<td>The content for the comment.
<p>JSON data type: object</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-date">
<td><code>date</code></td>
<td>The date the comment was published, in the site’s timezone.
<p>JSON data type: string,<br />
Format: datetime (<a href="https://core.trac.wordpress.org/ticket/41032">details</a>)</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-date_gmt">
<td><code>date_gmt</code></td>
<td>The date the comment was published, as GMT.
<p>JSON data type: string,<br />
Format: datetime (<a href="https://core.trac.wordpress.org/ticket/41032">details</a>)</p>
<p>Context: <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-link">
<td><code>link</code></td>
<td>URL to the comment.
<p>JSON data type: string,<br />
Format: uri</p>
<p>Read only</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-parent">
<td><code>parent</code></td>
<td>The ID for the parent of the comment.
<p>JSON data type: integer</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-post">
<td><code>post</code></td>
<td>The ID of the associated post object.
<p>JSON data type: integer</p>
<p>Context: <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-status">
<td><code>status</code></td>
<td>State of the comment.
<p>JSON data type: string</p>
<p>Context: <code>view</code>, <code>edit</code></p></td>
</tr>
<tr id="schema-type">
<td><code>type</code></td>
<td>Type of the comment.
<p>JSON data type: string</p>
<p>Read only</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-author_avatar_urls">
<td><code>author_avatar_urls</code></td>
<td>Avatar URLs for the comment author.
<p>JSON data type: object</p>
<p>Read only</p>
<p>Context: <code>view</code>, <code>edit</code>, <code>embed</code></p></td>
</tr>
<tr id="schema-meta">
<td><code>meta</code></td>
<td>Meta fields.
<p>JSON data type: object</p>
<p>Context: <code>view</code>, <code>edit</code></p></td>
</tr>
</tbody>
</table>

</div>

</div>

<div>

<div class="section route">

<div class="primary">

## List Comments

Query this endpoint to retrieve a collection of comments. The response you receive can be controlled and filtered using the URL query parameters below.

### Definition

`GET /wp/v2/comments`

### Example Request

`$ curl https://example.com/wp-json/wp/v2/comments`

</div>

<div class="secondary">

### Arguments

<table class="arguments">
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td><code>context</code></td>
<td>Scope under which the request is made; determines fields present in response.
<p>Default: <code>view</code></p>
<p>One of: <code>view</code>, <code>embed</code>, <code>edit</code></p></td>
</tr>
<tr>
<td><code>page</code></td>
<td>Current page of the collection.
<p>Default: <code>1</code></p></td>
</tr>
<tr>
<td><code>per_page</code></td>
<td>Maximum number of items to be returned in result set.
<p>Default: <code>10</code></p></td>
</tr>
<tr>
<td><code>search</code></td>
<td>Limit results to those matching a string.</td>
</tr>
<tr>
<td><code>after</code></td>
<td>Limit response to comments published after a given ISO8601 compliant date.</td>
</tr>
<tr>
<td><code>author</code></td>
<td>Limit result set to comments assigned to specific user IDs. Requires authorization.</td>
</tr>
<tr>
<td><code>author_exclude</code></td>
<td>Ensure result set excludes comments assigned to specific user IDs. Requires authorization.</td>
</tr>
<tr>
<td><code>author_email</code></td>
<td>Limit result set to that from a specific author email. Requires authorization.</td>
</tr>
<tr>
<td><code>before</code></td>
<td>Limit response to comments published before a given ISO8601 compliant date.</td>
</tr>
<tr>
<td><code>exclude</code></td>
<td>Ensure result set excludes specific IDs.</td>
</tr>
<tr>
<td><code>include</code></td>
<td>Limit result set to specific IDs.</td>
</tr>
<tr>
<td><code>offset</code></td>
<td>Offset the result set by a specific number of items.</td>
</tr>
<tr>
<td><code>order</code></td>
<td>Order sort attribute ascending or descending.
<p>Default: <code>desc</code></p>
<p>One of: <code>asc</code>, <code>desc</code></p></td>
</tr>
<tr>
<td><code>orderby</code></td>
<td>Sort collection by comment attribute.
<p>Default: <code>date_gmt</code></p>
<p>One of: <code>date</code>, <code>date_gmt</code>, <code>id</code>, <code>include</code>, <code>post</code>, <code>parent</code>, <code>type</code></p></td>
</tr>
<tr>
<td><code>parent</code></td>
<td>Limit result set to comments of specific parent IDs.</td>
</tr>
<tr>
<td><code>parent_exclude</code></td>
<td>Ensure result set excludes specific parent IDs.</td>
</tr>
<tr>
<td><code>post</code></td>
<td>Limit result set to comments assigned to specific post IDs.</td>
</tr>
<tr>
<td><code>status</code></td>
<td>Limit result set to comments assigned a specific status. Requires authorization.
<p>Default: <code>approve</code></p></td>
</tr>
<tr>
<td><code>type</code></td>
<td>Limit result set to comments assigned a specific type. Requires authorization.
<p>Default: <code>comment</code></p></td>
</tr>
<tr>
<td><code>password</code></td>
<td>The password for the post if it is password protected.</td>
</tr>
</tbody>
</table>

</div>

</div>

<div class="section route">

<div class="primary">

## Create a Comment

### Arguments

|  |  |
|----|----|
| [`author`](#schema-author) | The ID of the user object, if author was a user. |
| [`author_email`](#schema-author_email) | Email address for the comment author. |
| [`author_ip`](#schema-author_ip) | IP address for the comment author. |
| [`author_name`](#schema-author_name) | Display name for the comment author. |
| [`author_url`](#schema-author_url) | URL for the comment author. |
| [`author_user_agent`](#schema-author_user_agent) | User agent for the comment author. |
| [`content`](#schema-content) | The content for the comment. |
| [`date`](#schema-date) | The date the comment was published, in the site’s timezone. |
| [`date_gmt`](#schema-date_gmt) | The date the comment was published, as GMT. |
| [`parent`](#schema-parent) | The ID for the parent of the comment. |
| [`post`](#schema-post) | The ID of the associated post object. |
| [`status`](#schema-status) | State of the comment. |
| [`meta`](#schema-meta) | Meta fields. |

</div>

<div class="secondary">

### Definition

`POST /wp/v2/comments`

</div>

</div>

<div class="section route">

<div class="primary">

## Retrieve a Comment

### Definition & Example Request

`GET /wp/v2/comments/<id>`

Query this endpoint to retrieve a specific comment record.

`$ curl https://example.com/wp-json/wp/v2/comments/<id>`

</div>

<div class="secondary">

### Arguments

<table class="arguments">
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr>
<td><code>id</code></td>
<td>Unique identifier for the comment.</td>
</tr>
<tr>
<td><code>context</code></td>
<td>Scope under which the request is made; determines fields present in response.
<p>Default: <code>view</code></p>
<p>One of: <code>view</code>, <code>embed</code>, <code>edit</code></p></td>
</tr>
<tr>
<td><code>password</code></td>
<td>The password for the parent post of the comment (if the post is password protected).</td>
</tr>
</tbody>
</table>

</div>

</div>

<div class="section route">

<div class="primary">

## Update a Comment

### Arguments

|  |  |
|----|----|
| [`id`](#schema-id) | Unique identifier for the comment. |
| [`author`](#schema-author) | The ID of the user object, if author was a user. |
| [`author_email`](#schema-author_email) | Email address for the comment author. |
| [`author_ip`](#schema-author_ip) | IP address for the comment author. |
| [`author_name`](#schema-author_name) | Display name for the comment author. |
| [`author_url`](#schema-author_url) | URL for the comment author. |
| [`author_user_agent`](#schema-author_user_agent) | User agent for the comment author. |
| [`content`](#schema-content) | The content for the comment. |
| [`date`](#schema-date) | The date the comment was published, in the site’s timezone. |
| [`date_gmt`](#schema-date_gmt) | The date the comment was published, as GMT. |
| [`parent`](#schema-parent) | The ID for the parent of the comment. |
| [`post`](#schema-post) | The ID of the associated post object. |
| [`status`](#schema-status) | State of the comment. |
| [`meta`](#schema-meta) | Meta fields. |

</div>

<div class="secondary">

### Definition

`POST /wp/v2/comments/<id>`

### Example Request

</div>

</div>

<div class="section route">

<div class="primary">

## Delete a Comment

### Arguments

|  |  |
|----|----|
| `id` | Unique identifier for the comment. |
| `force` | Whether to bypass Trash and force deletion. |
| `password` | The password for the parent post of the comment (if the post is password protected). |

</div>

<div class="secondary">

### Definition

`DELETE /wp/v2/comments/<id>`

### Example Request

`$ curl -X DELETE https://example.com/wp-json/wp/v2/comments/<id>`

</div>

</div>

</div>