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": "This product looks interesting! Does it come in blue?",
  "image": "https://example.com/image.png"
}

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 to comment on.
contentstringYesComment text content.
imagestringNoOptional image URL to attach.

Successful response

{
    "status": 200,
    "success": true,
    "message": "Comment created successfully",
    "data": {
        "_id": "696cec2f1f6748186587748e",
        "content": "This product looks interesting! Does it come in blue?",
        "image": null,
        "user": {
            "_id": "69360693a7a8f7dc8ae32d6d",
            "name": "Dev Bash",
            "avatar": "https://cdn-icons-png.flaticon.com/512/149/149071.png"
        },
        "product": "68e5bb463a1fc56a8ac150bf",
        "shop": "68b8f52575da81b332af29f1",
        "parent": null,
        "likes": [],
        "dislikes": [],
        "likeCount": 0,
        "dislikeCount": 0,
        "replyCount": 0,
        "isDeleted": false,
        "createdAt": "2026-01-18T14:20:31.971Z",
        "updatedAt": "2026-01-18T14:20:31.971Z"
    }
}

Error response

{
    "status": 400,
    "success": false,
    "message": "Product ID and content are required",
    "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