Create repository discussion¶
POST /api/v5/repos/{owner}/{repo}/discuss
This endpoint creates a new discussion in the specified repository. The request must provide the discussion title, discussion content, and category. On success, it returns complete data such as the discussion number, title, content, creation time, author information, category information, and comment total.
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 |
|---|---|---|---|---|
owner |
path | string | Yes | Namespace path of the repository (the path of an enterprise, organization, or personal address) |
repo |
path | string | Yes | Repository path (path) |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body uses JSON and contains the discussion title, discussion content, and discussion category; all three are required.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"title": {
"description": "Discussion title",
"type": "string"
},
"md_content": {
"description": "Discussion content",
"type": "string"
},
"category_name": {
"description": "Discussion category",
"type": "string"
}
},
"required": ["title", "md_content", "category_name"]
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
string | Yes | — | Discussion ID |
number |
integer | Yes | — | Discussion number |
title |
string | Yes | — | Discussion title |
md_content |
string | Yes | — | Discussion content |
created_at |
string | Yes | — | Creation time |
updated_at |
string | Yes | — | Update time |
author |
object | Yes | — | Author information |
is_lock |
integer | Yes | — | Whether locked |
is_pin |
integer | Yes | — | Whether pinned |
is_category_pin |
integer | Yes | — | Whether pinned within the category |
is_closed |
integer | Yes | — | Whether closed |
is_answered |
integer | Yes | — | Whether an answer is accepted |
comment_total |
integer | Yes | — | Comment total |
category |
object | Yes | — | Category information |
author object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
author.avatar_url |
string | Yes | — | Avatar URL |
author.id |
string | Yes | — | User ID |
author.object_id |
string | Yes | — | Object ID |
author.login |
string | Yes | — | Login name |
author.name |
string | Yes | — | Name |
category object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
category.id |
string | Yes | — | Category ID |
category.name |
string | Yes | — | Category name |
category.icon |
string | Yes | — | Category icon |
category.description |
string | Yes | — | Category description |
category.type |
integer | Yes | — | Category type |
Error response¶
400 Parameter error
401 Unauthenticated
403 Access forbidden
Note: Error response field names follow what the backend actually returns.
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Parameter error (Bad Request) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Resource not found (Not Found) |
Request example¶
Parameter description¶
Replace
<owner>with the namespace path of the repository (the path of an enterprise, organization, or personal address); replace<repo>with the repository path (path); replace<token>with your AtomGit user access token.
cURL¶
curl -X POST 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss?access_token=<token>' \
-H 'Content-Type: application/json' \
-d '{
"title": "How do I integrate the OpenAPI?",
"md_content": "I ran into some problems during integration...",
"category_name": "Development discussion"
}'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/discuss?access_token=<YOUR-TOKEN>",
{
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
title: "How do I integrate the OpenAPI?",
md_content: "I ran into some problems during integration...",
category_name: "Development discussion",
}),
},
);
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/repos/<owner>/<repo>/discuss",
params={"access_token": "<YOUR-TOKEN>"},
json={
"title": "How do I integrate the OpenAPI?",
"md_content": "I ran into some problems during integration...",
"category_name": "Development discussion",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"id": "123456",
"number": 1,
"title": "How do I integrate the OpenAPI?",
"md_content": "I ran into some problems during integration...",
"created_at": "2026-10-14T09:30:00+08:00",
"updated_at": "2026-10-14T09:30:00+08:00",
"author": {
"avatar_url": "https://api.atomgit.com/avatars/octocat.png",
"id": "12345",
"object_id": "67890",
"login": "octocat",
"name": "Octo Cat"
},
"is_lock": 0,
"is_pin": 0,
"is_category_pin": 0,
"is_closed": 0,
"is_answered": 0,
"comment_total": 0,
"category": {
"id": "c_001",
"name": "Development discussion",
"icon": "https://api.atomgit.com/category/icon.png",
"description": "Technical exchange and discussion",
"type": 0
}
}
Error codes¶
| Error code | Description |
|---|---|
400 |
Parameter error or unparsable request |
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
403 |
Access forbidden |
404 |
Resource does not exist |
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