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

# Create Comment

> Post a new comment on a specific post using the API with optional threading and privacy.

<ParamField body="POST" type="method" />

<ParamField body="/comments" type="path" />

### Body Parameters

<ParamField body="postId" type="string" required>
  Unique identifier of the post to attach the comment to.
</ParamField>

<ParamField body="commentDescription" type="string" required>
  Description or content of the comment.
</ParamField>

<ParamField body="name" type="string | undefined" required>
  Name of the commenter (optional). If anonymous commenting is enabled then name
  is not required.
</ParamField>

<ParamField body="email" type="string | undefined" required>
  Email of the commenter (optional). If anonymous commenting is enabled then
  email is not required.
</ParamField>

<ParamField body="parentCommentId" type="string | undefined">
  ID of the parent comment (optional).
</ParamField>

<RequestExample>
  ```javascript curl theme={null}
  // Replace API_KEY with your api key
  curl --location --request POST 'https://api.supahub.com/api/v1/comments' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --header 'Authorization: Bearer API_KEY' \
  --data-urlencode 'postId=clxg2isca00qze5fxhkhnq525' \
  --data-urlencode 'commentDescription=Comment Description'
  ```

  ```javascript fetch theme={null}
  const myHeaders = new Headers();
  myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
  myHeaders.append("Authorization", "Bearer API_KEY"); // Replace API_KEY with your api key

  const urlencoded = new URLSearchParams();
  urlencoded.append("postId", "clxg2isca00qze5fxhkhnq525");
  urlencoded.append("commentDescription", "Comment Description");

  const requestOptions = {
    method: "POST",
    headers: myHeaders,
    body: urlencoded,
    redirect: "follow",
  };

  fetch("https://api.supahub.com/api/v1/comments", requestOptions)
    .then((response) => response.text())
    .then((result) => console.log(result))
    .catch((error) => console.error(error));
  ```

  ```javascript axios theme={null}
  const axios = require('axios');
  const qs = require('qs');
  let data = qs.stringify({
    'postId': 'clxg2isca00qze5fxhkhnq525',
    'commentDescription': 'Comment Description'
  });

  let config = {
    method: 'post',
    maxBodyLength: Infinity,
    url: 'https://api.supahub.com/api/v1/comments',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': 'Bearer API_KEY' // Replace API_KEY with your api key
    }
    data : data
  };

  async function makeRequest() {
    try {
      const response = await axios.request(config);
      console.log(JSON.stringify(response.data));
    }
    catch (error) {
      console.log(error);
    }
  }

  makeRequest();
  ```

  ```python python theme={null}
  import requests

  url = "https://api.supahub.com/api/v1/comments"

  payload = 'postId=clxg2isca00qze5fxhkhnq525&commentDescription=Comment%20Description'

  headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Authorization': 'Bearer API_KEY' # Replace API_KEY with your key.
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)
  ```
</RequestExample>
