---
title: "Create a comment"
method: POST
path: "/nodes/{node_id}/comments/"
tags: ["Nodes"]
---

# Create a comment

`POST /nodes/{node_id}/comments/`

Create a comment on a given node overview page or a reply to a comment on that node.

To create a comment on the node overview page, the target `type` would be "nodes" and the target `id` would be the node `id`.

To reply to a comment on this node, the target `type` would be "comments" and the target `id` would be the `id` of the comment to reply to.
#### Required
A relationship object with a `data` key, containing the target (`comments` or `nodes`) type and a target `id` is required.
In addition, the `content` attribute describing the relationship between the node and the comment is required.
#### Returns
Returns a JSON object with a data key containing the representation of the new comment, if the request is successful.

If the request is unsuccessful, an `errors` key containing information about the failure will be returned. Refer to the [list of error codes](#tag/Errors-and-Error-Codes) to understand why this request may have failed.

## Path parameters

- `node_id` string, required

## Request body

- object
  - `id` string, required — The identifier of the comment entity.
  - `type` string — The type identifier of the comment entity (`comments`).
  - `attributes` object — The properties of the comment entity.
    - `can_edit` boolean — Whether or not the current user has permission to edit this comment
    - `content` string — The content of the comment.
    - `date_created` string, date-time — The time at which the comment was created, as an iso8601 formatted timestamp.
    - `date_modified` string, date-time — The time at which the comment was last modified, as an iso8601 formatted timestamp.
    - `modified` boolean — Whether or not the comment has been edited.
    - `deleted` boolean — Whether or not the comment is deleted.
    - `is_abuse` boolean — Whether or not the comment is flagged or confirmed spam.
    - `is_ham` boolean — Whether or not an admin checked the legitimacy of this comment.
    - `has_report` boolean — Whether or not the comment the current user reported this as spam.
    - `has_children` boolean — Whether or not the comment has replies.
    - `page` string — The page type the comment is on, e.g. `node`, `registration`, `wiki`, `files`.
  - `relationships` object — URLs to other entities or entity collections that have a relationship to the comment entity.
    - `node` string, URL — A relationship to the node the comment is on.
    - `replies` string, URL — A relationship to the replies to the comment.
    - `target` string, URL — A relationship to the target of the comment.
    - `reports` string, URL — A relationship to the reports connected to the comment.
    - `user` string, URL — A relationship to the user who created the comment.
  - `links` object — URLs to alternative representations of the comment entity.
    - `self` string, URL — A link to the detail page for the comment.

## Response `201`

Success

---

[API](https://skmtc.net/osf/apis/osf-apiv2-documentation.md) · [All operations](https://skmtc.net/osf/apis/osf-apiv2-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/osf/osf-apiv2-documentation/versions/ca701048eb0d/schema)
