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

# Add a new comment

> Add a new comment to a discussion.



## OpenAPI

````yaml /openapi/integration.json post /comments
openapi: 3.0.3
info:
  title: Nudj Integration API
  version: 1.0.0
servers:
  - url: https://{subdomain}.nudj.cx/api/v2/integration
    description: Organization API Server
    variables:
      subdomain:
        description: Your organization's subdomain (required)
        default: your-org
security:
  - ApiToken: []
paths:
  /comments:
    post:
      tags:
        - Comment
      summary: Add a new comment
      description: Add a new comment to a discussion.
      operationId: addComment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                communityId:
                  type: string
                  pattern: ^[0-9a-fA-F]{24}$
                  description: The id of the community the comment belongs to
                discussionId:
                  type: string
                  pattern: ^[0-9a-fA-F]{24}$
                  description: The id of the discussion the comment belongs to
                content:
                  type: string
                  minLength: 1
                  description: The content of the comment
                imageUrl:
                  type: string
                  nullable: true
                  description: The url of the image attached to the comment
              required:
                - communityId
                - discussionId
              description: The input required to create a comment
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Comment'
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
components:
  schemas:
    Comment:
      type: object
      properties:
        id:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the comment
        organisationId:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the organisation the comment belongs to
        communityId:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the community the comment belongs to
        discussionId:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the discussion the comment belongs to
        parentId:
          type: string
          nullable: true
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the parent comment
        content:
          type: string
          minLength: 1
          description: The content of the comment
        imageUrl:
          type: string
          nullable: true
          description: The url of the image attached to the comment
        createdAt:
          type: string
          description: The date the comment was created
        createdBy:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the user who created the comment
        updatedAt:
          type: string
          description: The date the comment was last updated
        updatedBy:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the user who last updated the comment
        username:
          type: string
          description: The username of the user who created the comment
        displayName:
          type: string
          description: The display name of the user who created the comment
        profilePictureUrl:
          type: string
          nullable: true
          description: The url of the profile picture of the user who created the comment
      required:
        - id
        - organisationId
        - communityId
        - discussionId
        - content
        - createdAt
        - createdBy
        - updatedAt
        - updatedBy
        - username
        - displayName
      title: Comment
      description: A comment
    error.BAD_REQUEST:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Invalid input data
        code:
          type: string
          description: The error code
          example: BAD_REQUEST
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
              path:
                type: array
                items:
                  oneOf:
                    - type: string
                    - type: integer
                description: The path to the field that caused the error
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Error
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
    error.INTERNAL_SERVER_ERROR:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Internal server error
        code:
          type: string
          description: The error code
          example: INTERNAL_SERVER_ERROR
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
              path:
                type: array
                items:
                  oneOf:
                    - type: string
                    - type: integer
                description: The path to the field that caused the error
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Error
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: Internal server error
        issues: []
  securitySchemes:
    ApiToken:
      type: apiKey
      in: header
      name: x-api-token

````