Organization pull request list¶
GET /api/v5/org/{org}/pull_requests
This endpoint queries the pull request list of a specified organization. It supports filtering by repository, state, target branch, author, labels, creation and update time ranges, and query scope, as well as pagination and fuzzy search by title and description, and returns a complete list including source and target branches, merge information, milestones, reviewers, and more.
Access token support¶
- AtomGit user access tokens
Anonymous access¶
This endpoint allows anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
org |
path | string | Yes | Organization path (path/login) |
repo |
query | string | No | Repository path (path) |
issue_number |
query | integer | No | Global id of the issue |
state |
query | string | No | Pull request state. Enum: all (all) / open (open) / closed (closed) / merged (merged) |
sort |
query | string | No | Sort field, defaults to creation time. Enum: created (creation time) / updated (update time) |
direction |
query | string | No | Sort direction. Enum: asc (ascending) / desc (descending) |
page |
query | integer | No | Current page number, defaults to 1; must be a positive integer |
per_page |
query | integer | No | Number of items per page, defaults to 20, maximum 100 |
base |
query | string | No | Target branch |
author |
query | string | No | Pull request author |
search |
query | string | No | Fuzzy search by title and description |
created_after |
query | string | No | Return merge requests created after the specified time. The time format is ISO 8601, for example 2024-11-20T13:00:21+08:00 |
created_before |
query | string | No | Return merge requests created before the specified time. The time format is ISO 8601, for example 2024-11-20T13:00:21+08:00 |
updated_after |
query | string | No | Return merge requests updated after the specified time. The time format is ISO 8601, for example 2024-11-20T13:00:21+08:00 |
updated_before |
query | string | No | Return merge requests updated before the specified time. The time format is ISO 8601, for example 2024-11-20T13:00:21+08:00 |
labels |
query | string | No | Filter by the specified label names; separate multiple names with commas |
scope |
query | string | No | Query scope. Enum: all (all) / created_by_me (created by me) / assigned_to_me (assigned to me) / need_my_approve (pending my approval) / need_my_review (pending my review) |
Response parameters¶
The response is an array of pull request objects. Each element has the following structure.
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | Pull request id |
title |
string | Yes | No | Pull request title |
url |
string | Yes | No | API access URL |
html_url |
string | Yes | No | Web page URL |
number |
integer | Yes | No | Pull request number |
state |
string | Yes | No | State. Enum: open / closed / merged |
assignees_number |
integer | Yes | No | Number of reviewers |
testers_number |
integer | Yes | No | Number of testers |
assignees |
object[] | Yes | Yes | Reviewer list |
testers |
object[] | Yes | Yes | Tester list |
mergeable |
boolean | Yes | Yes | Whether it can be merged |
can_merge_check |
boolean | Yes | Yes | Whether merge checks can be performed |
head |
object | Yes | Yes | Source branch information |
base |
object | Yes | Yes | Target branch information |
created_at |
string | Yes | Yes | Creation time |
updated_at |
string | Yes | Yes | Update time |
merged_at |
string | No | Yes | Merge time |
merged_by |
object | No | Yes | Merger information |
milestone |
object | No | Yes | Associated milestone |
labels |
object[] | Yes | Yes | Label list |
author |
object | No | Yes | Author information |
visibility_reason |
string | No | Yes | Visibility. public: publicly visible; other: visible only to project members |
assignees / testers object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
assignees.id |
string | Yes | No | User id |
assignees.login |
string | Yes | No | Login name |
assignees.name |
string | Yes | No | User name |
head object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
head.ref |
string | Yes | No | Source branch name |
head.sha |
string | Yes | No | Source branch commit SHA |
head.repo |
object | Yes | No | Source repository information |
head.repo object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
head.repo.path |
string | Yes | No | Repository path |
head.repo.name_space |
object | Yes | No | Information about the namespace the repository belongs to |
head.repo.assigner |
object | No | Yes | Repository owner |
head.repo.name_space object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
head.repo.name_space.path |
string | Yes | No | Namespace path |
head.repo.assigner object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
head.repo.assigner.id |
string | Yes | No | User id |
head.repo.assigner.login |
string | Yes | No | Login name |
head.repo.assigner.name |
string | Yes | No | User name |
base object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
base.ref |
string | Yes | Yes | Target branch name |
base.sha |
string | Yes | Yes | Target branch commit SHA |
base.repo |
object | Yes | No | Target repository information |
base.repo object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
base.repo.path |
string | Yes | No | Repository path |
base.repo.name_space |
object | Yes | No | Information about the namespace the repository belongs to |
base.repo.name_space object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
base.repo.name_space.path |
string | Yes | No | Namespace path |
merged_by object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
merged_by.id |
string | Yes | No | User id |
merged_by.login |
string | Yes | No | Login name |
merged_by.name |
string | Yes | No | User name |
merged_by.avatar_url |
string | Yes | No | Avatar URL |
merged_by.html_url |
string | Yes | No | Profile page URL |
merged_by.type |
string | Yes | No | User type |
merged_by.url |
string | Yes | No | User API URL |
merged_by.object_id |
string | Yes | No | Object id |
merged_by.email |
string | Yes | No |
milestone object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
milestone.id |
integer | Yes | No | Milestone id |
milestone.number |
integer | Yes | No | Milestone number |
milestone.title |
string | Yes | No | Title |
milestone.description |
string | Yes | No | Description |
milestone.state |
string | Yes | No | State |
milestone.url |
string | Yes | No | API URL |
milestone.html_url |
string | Yes | No | Page URL |
milestone.repository_id |
integer | Yes | No | Repository id |
milestone.closed_issues |
integer | Yes | No | Number of closed issues |
milestone.open_issues |
integer | Yes | No | Number of open issues |
milestone.created_at |
string | Yes | No | Creation time |
milestone.updated_at |
string | Yes | No | Update time |
milestone.due_on |
string | Yes | No | Due date |
labels object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
labels.id |
integer | Yes | No | Label id |
labels.name |
string | Yes | No | Label name |
labels.color |
string | Yes | No | Label color |
labels.repository_id |
integer | Yes | No | Repository id |
labels.url |
string | Yes | No | Label API URL |
labels.created_at |
string | Yes | No | Creation time |
labels.updated_at |
string | Yes | No | Update time |
labels.description |
string | Yes | No | Label description |
author object¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
author.id |
string | Yes | No | User id |
author.login |
string | Yes | No | Login name |
author.name |
string | Yes | No | User name |
Error responses¶
When the endpoint fails, it returns a unified error structure error_code / error_code_name / error_message / trace_id. The actual field names are as returned.
400 Parameter error
{
"error_code": 400,
"error_code_name": "PARAMETER_ERROR",
"error_message": "Parameter error",
"trace_id": "xxx"
}
401 Unauthenticated
{
"error_code": 401,
"error_code_name": "UNAUTHORIZED",
"error_message": "Unauthenticated or invalid credentials",
"trace_id": "xxx"
}
404 User not found
{
"error_code": 404,
"error_code_name": "USER_NOT_FOUND",
"error_message": "user not found",
"trace_id": "xxx"
}
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
304 |
Not modified |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Not found |
429 |
Too many requests |
Request example¶
Parameter description¶
Replace
<org>with the organization path (path/login). This endpoint allows anonymous access; you can also pass anaccess_token(AtomGit user access token) for authentication.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/org/<org>/pull_requests?state=open&page=1&per_page=20' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const org = "<org>";
const params = new URLSearchParams({ state: "open", page: "1", per_page: "20" });
const response = await fetch(`https://api.atomgit.com/api/v5/org/${org}/pull_requests?${params}`, {
headers: {
"Accept": "application/json",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
org = "<org>"
resp = requests.get(
f"https://api.atomgit.com/api/v5/org/{org}/pull_requests",
params={"state": "open", "page": 1, "per_page": 20},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 71020,
"title": "Fix: update the login flow",
"url": "https://api.atomgit.com/api/v5/repos/test/test/1",
"html_url": "https://api.atomgit.com/test/test/1",
"number": 1,
"state": "merged",
"assignees_number": 0,
"testers_number": 0,
"assignees": [],
"testers": [],
"mergeable": null,
"can_merge_check": true,
"head": {
"ref": "main",
"sha": "d874402d259744a00121c2cff0febc8554339aef",
"repo": {
"path": "test",
"name_space": {
"path": "repo-dev"
},
"assigner": {
"id": "uuid",
"login": "Lzm_0916",
"name": "Lzm_0916"
}
}
},
"base": {
"ref": null,
"sha": null,
"repo": {
"path": "test",
"name_space": {
"path": "repo-dev"
}
}
},
"created_at": "2024-04-15T18:33:01+08:00",
"updated_at": "2024-04-15T18:33:01+08:00",
"merged_at": "2024-04-15T18:33:01+08:00",
"merged_by": {
"id": "uuid",
"login": "Lzm_0916",
"name": "Lzm_0916",
"avatar_url": "https://api.atomgit.com/avatar.png",
"html_url": "https://api.atomgit.com/Lzm_0916"
},
"labels": [],
"visibility_reason": "public"
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access credentials) |
400 |
Parameter error, or the request cannot be parsed |
404 |
Request path does not exist |
405 |
Request method not supported |
429 |
Too many requests; rate limit triggered |
500 |
Internal system error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc