Skip to content

Create organization discussion comment

POST /api/v5/orgs/{org}/discuss/{number}/comment

This endpoint creates a comment under a discussion in the specified organization. It requires the organization path, discussion number, and comment content in Markdown format. On success, it returns comment details with complete data such as author information, like count, and reply count.

Access token support

  • AtomGit user access token (AtomGit user access tokens)

Anonymous access

This endpoint does not allow anonymous access

Request parameters

Parameter Location Type Required Description
org path string Yes Organization path (path)
number path integer Yes Discussion number
access_token query string Yes User authorization code

Request Body:

The request body is a JSON object containing the comment content to publish.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "md_content": {
      "description": "Comment content (Markdown)",
      "type": "string"
    }
  },
  "required": ["md_content"]
}

Response parameters

Field Type Always returned Nullable Description
id string Yes — Comment ID
created_at string Yes — Creation time
updated_at string Yes — Update time
author object Yes — Comment author information
discuss_id string Yes — Owning discussion ID
content string Yes — Comment content (plain text)
md_content string Yes — Comment content (Markdown)
parent_id string Yes — Parent comment ID
type integer Yes — Comment type
is_hide integer Yes — Whether hidden
reply_total integer Yes — Reply total
like_total integer Yes — Like total
is_like boolean Yes — Whether the current user has liked
is_deleted integer Yes — Whether deleted
is_remark integer Yes — Whether it is a note

author object

Field Type Always returned Nullable Description
author.avatar_url string Yes — Avatar URL
author.id string Yes — Author ID
author.object_id string Yes — Author object ID
author.login string Yes — Login name
author.name string Yes — Name

Error response

400 Parameter error

{
  "error": "invalid_request",
  "message": "Parameter md_content cannot be empty",
  "field": "md_content"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

The error field names are subject to what the backend actually returns.

HTTP response status codes

Status code Description
200 Success (OK)
304 Not modified
401 Authentication required (Requires authentication)
403 Access forbidden (Forbidden)

Request example

Parameter description

Replace <org> with the organization path (the path of an enterprise, organization, or individual); replace <number> with the discussion number; replace <token> with your AtomGit user access token; replace <Comment content> with the comment content to publish (Markdown format).

cURL

curl -X POST 'https://api.atomgit.com/api/v5/orgs/<org>/discuss/<number>/comment?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -d '{"md_content": "<Comment content>"}'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  "https://api.atomgit.com/api/v5/orgs/<org>/discuss/<number>/comment?access_token=<token>",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Accept": "application/json",
    },
    body: JSON.stringify({ md_content: "<Comment content>" }),
  }
);

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.post(
    "https://api.atomgit.com/api/v5/orgs/<org>/discuss/<number>/comment",
    params={"access_token": "<token>"},
    json={"md_content": "<Comment content>"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "id": "c_10001",
  "created_at": "2026-10-14T12:48:04+08:00",
  "updated_at": "2026-10-14T12:48:04+08:00",
  "author": {
    "avatar_url": "https://api.atomgit.com/avatar/octocat.png",
    "id": "10001",
    "object_id": "20001",
    "login": "octocat",
    "name": "Octocat"
  },
  "discuss_id": "d_60001",
  "content": "This is the plain text content of the comment",
  "md_content": "## This is the Markdown content of the comment",
  "parent_id": "",
  "type": 0,
  "is_hide": 0,
  "reply_total": 0,
  "like_total": 1,
  "is_like": true,
  "is_deleted": 0,
  "is_remark": 0
}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
400 Parameter error or unparsable request
404 Request path does not exist
405 Method not supported
429 Too many requests; rate limit triggered
500 Internal server error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc