> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salesive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create comment

> Create a new comment on a product.

## Request

```http theme={null}
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

| Header          | Type   | Description                                   |
| --------------- | ------ | --------------------------------------------- |
| `Authorization` | string | Provide the customer token as `Bearer <jwt>`. |
| `x-shop-id`     | string | Identify the shop.                            |
| `Content-Type`  | string | Always set to `application/json`.             |

## Body parameters

| Field       | Type   | Required | Description                       |
| ----------- | ------ | -------- | --------------------------------- |
| `productId` | string | Yes      | Product identifier to comment on. |
| `content`   | string | Yes      | Comment text content.             |
| `image`     | string | No       | Optional image URL to attach.     |

## Successful response

```json theme={null}
{
    "status": 200,
    "success": true,
    "message": "Comment created successfully",
    "data": {
        "_id": "6a27d777289b87893fcbde5a",
        "content": "This product looks interesting! Does it come in blue?",
        "image": null,
        "user": {
            "_id": "69360693a7a8f7dc8ae32d6d",
            "name": "Jane Smith",
            "avatar": "https://cdn.salesive.com/avatars/jane.jpg"
        },
        "product": "69fb494e51280f9f65d059ae",
        "shop": "68b8f52575da81b332af29f1",
        "parent": null,
        "likes": [],
        "dislikes": [],
        "likeCount": 0,
        "dislikeCount": 0,
        "replyCount": 0,
        "isDeleted": false,
        "createdAt": "2026-06-09T09:05:59.337Z",
        "updatedAt": "2026-06-09T09:05:59.337Z",
        "__v": 0
    }
}
```

## Error response

```json theme={null}
{
    "status": 400,
    "success": false,
    "message": "Product ID and content are required",
    "data": {}
}
```


## OpenAPI

````yaml POST /comments
openapi: 3.1.0
info:
  title: Salesive Store API
  description: >-
    REST interface for querying products, categories, and merchandising banners
    exposed by Salesive storefronts.
  version: 1.0.0
servers:
  - description: Production
    url: https://store.salesive.com/api/v1
security:
  - BearerAuth: []
    ShopIdHeader: []
paths:
  /comments:
    post:
      summary: Create comment
      description: Create a new comment or reply on a product.
      parameters:
        - $ref: '#/components/parameters/XShopIdHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - productId
                - content
              properties:
                productId:
                  type: string
                  description: Product identifier
                content:
                  type: string
                  description: Comment text
                parentId:
                  type: string
                  description: Parent comment ID for replies
                image:
                  type: string
                  format: uri
                  description: Optional image URL
      responses:
        '201':
          description: Comment created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 201
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Comment created
                  data:
                    type: object
                    properties:
                      _id:
                        type: string
                      productId:
                        type: string
                      content:
                        type: string
                      user:
                        type: object
                      createdAt:
                        type: string
                        format: date-time
components:
  parameters:
    XShopIdHeader:
      name: x-shop-id
      in: header
      description: >-
        Optional identifier that scopes responses to a specific storefront when
        the referer cannot be inferred.
      required: false
      schema:
        type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT issued by the Salesive Store API for authenticated shoppers.
    ShopIdHeader:
      type: apiKey
      in: header
      name: x-shop-id
      description: >-
        Optional storefront identifier sent as a header to scope responses to a
        specific shop. Try It requests remember this value once provided.

````