Sample - Box Platform API
POST/comments

Create comment

Adds a comment by the user to a specific file, or as a reply to an other comment.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 3 body fields
fieldsarray<string>optional
A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.
messagestringrequired
The text of the comment. To mention a user, use the `tagged_message` parameter instead.
tagged_messagestringoptional
The text of the comment, including `@[user_id:name]` somewhere in the message to mention another user, which will send them an email notification, letting them know they have been mentioned. The `user_id` is the target user's ID, where the `name` can be any custom phrase. In the Box UI this name will link to the user's profile. If you are not mentioning another user, use `message` instead.
itemobjectrequired
The item to attach the comment to.

2 status codes
201Returns the newly created comment object. Not all available fields are returned by default. Use the [fields](#parameter-fields) query parameter to explicitly request any specific fields.
idstringoptional
The unique identifier for this comment.
typestringoptional
The value will always be `comment`.
Allowed:comment
is_reply_commentbooleanoptional
Whether or not this comment is a reply to another comment.
messagestringoptional
The text of the comment, as provided by the user.
created_byobjectoptional
created_atstringoptional
The time this comment was created.
modified_atstringoptional
The time this comment was last modified.
itemobjectoptional
tagged_messagestringoptional
The string representing the comment text with @mentions included. @mention format is @[id:username] where `id` is user's Box ID and `username` is their display name.
defaultAn unexpected client error.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.

Error handling

Any other status is an error: An unexpected client error.