Add a comment to an article
const url = 'https://api.example.com/cms/content/example/comment';const options = { method: 'POST', headers: { 'API-Key': '<API-Key>', Authorization: 'Bearer <token>', Token: '<Token>', 'Content-Type': 'application/json' }, body: '{"postername":"example","posteremail":"example","source":"example","reply_to":"example","comment":"example","comment_anonymously":true,"metadata":{},"set_as_approved":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.example.com/cms/content/example/comment \ --header 'API-Key: <API-Key>' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Token: <Token>' \ --data '{ "postername": "example", "posteremail": "example", "source": "example", "reply_to": "example", "comment": "example", "comment_anonymously": true, "metadata": {}, "set_as_approved": 1 }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Content ID
Request Bodyrequired
Section titled “Request Bodyrequired”Comment payload (supports multipart/form-data for file uploads)
JSON payload for comment (without file upload) or rating
object
Name of the poster (optional if logged in)
Email of the poster (optional if logged in)
Source of the comment
ID of the comment being replied to (optional)
Comment text
Post comment anonymously (only if logged in)
Comment metadata (optional)
object
Set comment as approved (1) or pending (0) (only using an Admin API key or UserToken header)
Deprecated way of rating content via comment endpoint. Use /content/{id}/rate instead.
object
Name of the poster (optional if logged in)
Email of the poster (optional if logged in)
Source of the comment
ID of the comment being replied to (optional)
Rating (1-5)
Example generated
{ "postername": "example", "posteremail": "example", "source": "example", "reply_to": "example", "comment": "example", "comment_anonymously": true, "metadata": {}, "set_as_approved": 1}Multipart form data for comment with optional file upload
object
Comment text
Name of the poster (optional if logged in)
Email of the poster (optional if logged in)
Post comment anonymously (only if logged in)
Source of the comment
Set comment as approved (1) or pending (0)
File attachment (image, video, or audio)
ID of the comment being replied to (optional)
Responses
Section titled “Responses”Comment added
object
ID of the newly created comment
Example generated
{ "comment_id": 1}