View repository forks¶
GET /api/v5/repos/{owner}/{repo}/forks
This endpoint lists all forks of the specified repository. You query by the repository's namespace address path and repository path, can sort by fork time or star count, filter by creation time range, and paginate the results to learn about the repository's derivative versions.
Access token support¶
- AtomGit user access tokens (AtomGit user access tokens)
Anonymous access allowed?¶
This endpoint allows anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
owner |
path | string | Yes | Address path of the namespace the repository belongs to (the address path of an enterprise, organization, or individual) |
repo |
path | string | Yes | Repository path (path) |
sort |
query | string | No | Sort order: by fork time (newest / oldest) or star count (stargazers) |
page |
query | integer | No | Current page number |
per_page |
query | integer | No | Number of items per page, maximum 100, default 20 |
created_after |
query | string | No | Return only forks created after this time |
created_before |
query | string | No | Return only forks created before this time |
Response parameters¶
The response body is an array of fork repository objects. The structure of each element is as follows:
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | Fork repository ID |
full_name |
string | Yes | No | Full repository name, e.g. wangwt/RuoYi |
human_name |
string | Yes | No | Human-readable repository name, e.g. wangwt / RuoYi |
url |
string | Yes | No | Repository API address |
namespace |
object | Yes | No | Information about the namespace the repository belongs to |
description |
string | Yes | Yes | Repository description, may be empty |
status |
string | Yes | Yes | Repository status, may be empty |
created_at |
string | Yes | No | Repository creation time |
updated_at |
string | Yes | No | Repository update time |
owner |
object | Yes | No | Repository owner information |
pushed_at |
string | Yes | Yes | Last push time |
parent |
object | Yes | No | Source repository information (the repository this fork came from) |
private |
boolean | Yes | No | Whether the repository is private |
public |
boolean | Yes | No | Whether the repository is public |
namespace object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
namespace.id |
integer | Yes | No | Namespace ID |
namespace.type |
string | Yes | No | Namespace type, e.g. personal |
namespace.name |
string | Yes | No | Namespace name |
namespace.path |
string | Yes | No | Namespace address path |
namespace.html_url |
string | Yes | No | Namespace page address |
owner object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
owner.id |
integer | Yes | No | Owner user ID |
owner.login |
string | Yes | No | User login name |
owner.name |
string | Yes | No | User name |
parent object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
parent.id |
integer | Yes | No | Source repository ID |
parent.full_name |
string | Yes | No | Full source repository name |
parent.human_name |
string | Yes | No | Human-readable source repository name |
parent.url |
string | Yes | No | Source repository API address |
parent.namespace |
object | Yes | No | Information about the namespace the source repository belongs to |
parent.namespace object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
parent.namespace.id |
integer | Yes | No | Namespace ID |
parent.namespace.type |
string | Yes | No | Namespace type, e.g. personal |
parent.namespace.name |
string | Yes | No | Namespace name |
parent.namespace.path |
string | Yes | No | Namespace address path |
parent.namespace.html_url |
string | Yes | No | Namespace page address |
Error response¶
The following are examples of error responses this endpoint may return (the actual error field names are subject to what the backend returns).
400 Parameter error
401 Unauthenticated
404 Repository not found
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
304 |
Not modified |
401 |
Authentication required (Requires authentication) |
403 |
Forbidden |
Request example¶
This endpoint allows anonymous access, so the examples do not include an access token; you can also attach an AtomGit user access token when calling it.
Parameter description¶
Replace
<owner>with the address path of the namespace the repository belongs to (the address path of an enterprise, organization, or individual); replace<repo>with the repository path (path).
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/forks?sort=stargazers&per_page=20' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/forks?sort=stargazers&per_page=20", {
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
resp = requests.get(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/forks",
params={"sort": "stargazers", "per_page": 20},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 567682,
"full_name": "wangwt/RuoYi",
"human_name": "wangwt / RuoYi",
"url": "https://api.atomgit.com/api/v5/repos/wangwt/RuoYi",
"namespace": {
"id": 153748,
"type": "personal",
"name": "wangwt",
"path": "wangwt",
"html_url": "https://api.atomgit.com/wangwt"
},
"description": "",
"status": "",
"created_at": "2024-07-29T15:42:45.149+08:00",
"updated_at": "2024-07-29T15:42:45.149+08:00",
"owner": {
"id": 970,
"login": "wangwt",
"name": "wangwt"
},
"pushed_at": "2024-11-08T16:24:10.576+08:00",
"parent": {
"id": 517092,
"full_name": "xiaogang/RuoYi",
"human_name": "xiaogang / RuoYi",
"url": "https://api.atomgit.com/api/v5/repos/xiaogang/RuoYi",
"namespace": {
"id": 137117,
"type": "personal",
"name": "xiaogang",
"path": "xiaogang",
"html_url": "https://api.atomgit.com/xiaogang"
}
},
"private": false,
"public": true
}
]
Error codes¶
| Error code | Description |
|---|---|
400 |
Parameter error or the request cannot be parsed |
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
404 |
Request path does not exist or the repository 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