Search repositories¶
GET /api/v5/search/repositories
Call this endpoint to search repositories on the platform.
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 |
|---|---|---|---|---|
access_token |
query | string | Yes | User authorization code |
q |
query | string | Yes | Search keyword |
page |
query | integer | No | Current page number, maximum 100, default 1 |
per_page |
query | integer | No | Number of items per page, maximum 50, default 30 |
sort |
query | string | No | Sort field, enum: last_push_at (update time), stars_count (star count), forks_count (fork count), watches_count (watch count); defaults to best match |
order |
query | string | No | Sort order (such as asc / desc), default desc |
owner |
query | string | No | Namespace path of the owning repository (the path of an enterprise, organization, or personal namespace) |
fork |
query | boolean | No | Whether to search repositories that include forks, default false |
language |
query | string | No | Filter repositories by the specified language |
Response parameters¶
The response body is an array of repository objects; each element has the structure shown in the table below.
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | Repository ID |
full_name |
string | Yes | No | Full repository name (for example, gh_mirrors/al/allure2) |
human_name |
string | No | Yes | Human-readable name |
url |
string | Yes | No | Repository API URL |
namespace |
object | Yes | No | Namespace information |
path |
string | Yes | No | Repository path |
name |
string | Yes | No | Repository name |
description |
string | No | Yes | Repository description |
status |
string | Yes | No | Repository state |
ssh_url_to_repo |
string | Yes | No | SSH clone URL |
http_url_to_repo |
string | Yes | No | HTTP clone URL |
web_url |
string | Yes | No | Repository web URL |
created_at |
string | Yes | No | Creation time |
updated_at |
string | Yes | No | Update time |
homepage |
string | No | Yes | Homepage URL |
members |
string[] | No | Yes | Member list |
forks_count |
integer | Yes | No | Fork count |
stargazers_count |
integer | Yes | No | Star count |
relation |
string | No | Yes | Relation information |
permission |
object | Yes | No | Permissions of the current user on this repository |
internal |
boolean | Yes | No | Whether it is an internal repository |
open_issues_count |
integer | Yes | No | Number of open issues |
has_issue |
boolean | Yes | No | Whether issues exist |
watchers_count |
integer | Yes | No | Watch count |
enterprise |
object | No | Yes | Owning enterprise information; null for non-enterprise repositories |
default_branch |
string | Yes | No | Default branch |
fork |
boolean | Yes | No | Whether it is a forked repository |
pushed_at |
string | Yes | No | Most recent push time |
owner |
object | Yes | No | Repository owner information |
issue_template_source |
string | No | Yes | Issue template source |
private |
boolean | Yes | No | Whether it is private |
public |
boolean | Yes | No | Whether it is public |
has_wiki |
boolean | No | Yes | Whether a wiki exists |
language |
string | No | Yes | Primary repository language |
license |
string | No | Yes | Open source license |
watched |
boolean | No | Yes | Whether the current user is watching it |
recommend |
boolean | No | Yes | Whether the repository is recommended |
repo_type |
string | No | Yes | Repository type: code (code repository), model (model repository), dataset (dataset repository), space (space) |
namespace object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
namespace.id |
integer | Yes | No | Namespace ID |
namespace.type |
string | Yes | No | Namespace type (such as enterprise / user) |
namespace.name |
string | Yes | No | Namespace name |
namespace.path |
string | Yes | No | Namespace path |
namespace.html_url |
string | Yes | No | Namespace web URL |
namespace.full_name |
string | No | Yes | Full namespace name |
namespace.full_path |
string | No | Yes | Full namespace path |
permission object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
permission.pull |
boolean | No | Yes | Whether the user has pull permission |
permission.push |
boolean | Yes | No | Whether the user has push permission |
permission.admin |
boolean | No | Yes | Whether the user has admin permission |
enterprise object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
enterprise.id |
integer | Yes | No | Enterprise ID |
enterprise.path |
string | Yes | No | Enterprise path |
enterprise.name |
string | Yes | No | Enterprise name |
enterprise.url |
string | No | Yes | Enterprise URL |
enterprise.avatar_url |
string | No | Yes | Enterprise avatar URL |
enterprise.html_url |
string | Yes | No | Enterprise web URL |
enterprise.type |
string | Yes | No | Enterprise type |
owner object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
owner.id |
string | Yes | No | Owner ID |
owner.login |
string | Yes | No | Login name |
owner.name |
string | Yes | No | Owner name |
owner.avatar_url |
string | No | Yes | Avatar URL |
owner.html_url |
string | No | Yes | Personal or organization web URL |
owner.type |
string | Yes | No | Type (such as User) |
owner.url |
string | No | Yes | User API URL |
owner.objectId |
string | No | Yes | Object ID |
owner.email |
string | No | Yes |
Error responses¶
A success response alone is not enough: callers need to know what failures look like in order to write error-handling logic.
400 Invalid parameters
401 Unauthenticated
Note: The field names of error responses depend on the actual backend response.
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
304 |
Not modified |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Request path does not exist |
429 |
Too many requests; rate limit triggered |
500 |
Internal system error |
Request example¶
Parameter description¶
Replace
<q>with the search keyword (required); replace<token>with your AtomGit user access token; replace<owner>with the namespace path of the owning repository (the path of an enterprise, organization, or personal namespace).
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/search/repositories?q=<q>&access_token=<token>' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const params = new URLSearchParams({
q: "<q>",
access_token: "<token>",
});
const response = await fetch(`https://api.atomgit.com/api/v5/search/repositories?${params.toString()}`, {
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/search/repositories",
params={
"q": "<q>",
"access_token": "<token>",
},
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 1431191,
"full_name": "gh_mirrors/al/allure2",
"human_name": "GitHub Acceleration Program / al / allure2",
"url": "https://api.atomgit.com/api/v5/repos/gh_mirrors/al/allure2",
"namespace": {
"id": 2192652,
"type": "enterprise",
"name": "al",
"path": "al",
"html_url": "https://api.atomgit.com/al"
},
"path": "allure2",
"name": "allure2",
"description": "Allure Report is a flexible, lightweight multi-language test reporting tool. It provides clear graphical reports.",
"status": "started",
"ssh_url_to_repo": "git@atomgit.com:gh_mirrors/al/allure2.git",
"http_url_to_repo": "https://api.atomgit.com/gh_mirrors/al/allure2.git",
"web_url": "https://api.atomgit.com/gh_mirrors/al/allure2",
"created_at": "2023-12-18T00:42:15.557+08:00",
"updated_at": "2024-11-05T10:54:59.948+08:00",
"homepage": "https://api.atomgit.com/gh_mirrors/al/allure2",
"members": ["Gitcode-Assistant", "coco_gitcode", "gitshumei"],
"forks_count": 0,
"stargazers_count": 9,
"relation": "",
"permission": {
"push": false
},
"internal": false,
"open_issues_count": 0,
"has_issue": false,
"watchers_count": 4,
"enterprise": {
"id": 2192652,
"path": "al",
"html_url": "https://api.atomgit.com/al",
"type": "enterprise"
},
"default_branch": "main",
"fork": false,
"pushed_at": "2024-08-06T23:34:38.476+08:00",
"owner": {
"id": "69090",
"login": "coco_gitcode",
"name": "GitCode Featured Projects",
"type": "User"
},
"issue_template_source": "project",
"private": false,
"public": true
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access credential) |
400 |
Invalid parameters 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