Skip to main content
POST
/
comments
Create comment
curl --request POST \
  --url https://store.salesive.com/api/v1/comments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-shop-id: <api-key>' \
  --data '
{
  "productId": "<string>",
  "content": "<string>",
  "parentId": "<string>",
  "image": "<string>"
}
'
{
  "status": 201,
  "success": true,
  "message": "Comment created",
  "data": {
    "_id": "<string>",
    "productId": "<string>",
    "content": "<string>",
    "user": {},
    "createdAt": "2023-11-07T05:31:56Z"
  }
}

Request

POST /comments
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
Content-Type: application/json

{
  "productId": "68e5bb463a1fc56a8ac150bf",
  "content": "Yes, I saw a blue version in the description!",
  "parentId": "678bd3a2e37452d19efcb4e4"
}

Headers

HeaderTypeDescription
AuthorizationstringProvide the customer token as Bearer <jwt>.
x-shop-idstringIdentify the shop.
Content-TypestringAlways set to application/json.

Body parameters

FieldTypeRequiredDescription
productIdstringYesProduct identifier.
contentstringYesReply text content.
parentIdstringYesParent comment ID to reply to.

Successful response

{
    "status": 201,
    "success": true,
    "message": "Reply created successfully",
    "data": {
        "_id": "678bd4b2e37452d19efcb4e5",
        "product": "68e5bb463a1fc56a8ac150bf",
        "parent": "678bd3a2e37452d19efcb4e4",
        "user": {
            "_id": "68f976e92bb0b821425fdda6",
            "name": "Jane Doe"
        },
        "content": "Yes, I saw a blue version in the description!",
        "likes": 0,
        "dislikes": 0,
        "createdAt": "2025-01-18T12:05:00.000Z"
    }
}

Error response

{
    "status": 404,
    "success": false,
    "message": "Parent comment not found",
    "data": {}
}

Authorizations

Authorization
string
header
required

JWT issued by the Salesive Store API for authenticated shoppers.

x-shop-id
string
header
required

Optional storefront identifier sent as a header to scope responses to a specific shop. Try It requests remember this value once provided.

Headers

x-shop-id
string

Optional identifier that scopes responses to a specific storefront when the referer cannot be inferred.

Body

application/json
productId
string
required

Product identifier

content
string
required

Comment text

parentId
string

Parent comment ID for replies

image
string<uri>

Optional image URL

Response

201 - application/json

Comment created successfully

status
integer
Example:

201

success
boolean
Example:

true

message
string
Example:

"Comment created"

data
object