Query the List of Base Images Available to a Space¶
GET /api/v5/spaces/base-images
Used to query the list of available base images in an AI space. Supports pagination and can be filtered by the SDK type installed in the image.
Access Token Support¶
- AtomGit user access tokens
Anonymous Access Allowed¶
This endpoint allows anonymous access.
Request Parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
page |
query | integer | No | Page number, defaults to 1 |
per_page |
query | integer | No | Number of items per page, defaults to 20 |
sdk |
query | string | No | SDK installed in the image. Enum: gradio / static |
Response Parameters¶
| Field | Type | Always Returned | Nullable | Description |
|---|---|---|---|---|
page_num |
integer | Yes | No | Current page number |
page_size |
integer | Yes | No | Number of items per page |
total |
integer | Yes | No | Total number of records |
page_count |
integer | Yes | No | Total number of pages |
content |
array<object> | Yes | No | Base image list. |
content Array Elements
| Field | Type | Always Returned | Nullable | Description |
|---|---|---|---|---|
content[].id |
string | Yes | Yes | Unique image identifier ID |
content[].name |
string | Yes | Yes | Image name |
content[].description |
string | Yes | Yes | Image description information |
content[].architecture |
string | Yes | Yes | Image architecture type, such as arm64 or x86 |
content[].os |
string | Yes | Yes | Name of the operating system in the image |
Failure Responses¶
401 Unauthenticated
403 Forbidden
HTTP Response Status Codes¶
| Status Code | Description |
|---|---|
200 |
Success (OK) |
401 |
Requires authentication |
403 |
Forbidden |
Request Example¶
Parameter Description¶
- Replace
<token>with your AtomGit user access token (this endpoint allows anonymous access, so the header can also be omitted).
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/spaces/base-images?page=1&per_page=20&sdk=gradio' \
-H 'Authorization: Bearer <token>' \
-H 'Accept: application/json'
JavaScript¶
// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch("https://api.atomgit.com/api/v5/spaces/base-images?page=1&per_page=20&sdk=gradio", {
headers: {
"Accept": "application/json",
"Authorization": "Bearer <YOUR-TOKEN>",
},
});
if (!response.ok) {
throw new Error(`请求失败: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.get(
"https://api.atomgit.com/api/v5/spaces/base-images",
params={"page": 1, "per_page": 20, "sdk": "gradio"},
headers={
"Accept": "application/json",
"Authorization": "Bearer <YOUR-TOKEN>",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response Example¶
Status code: 200
{
"page_num": 1,
"page_size": 20,
"total": 1,
"page_count": 1,
"content": [
{
"id": "ad9a05a3ba3943a4a53708840a44beca",
"name": "Ubuntu 22.04 + Python 3.10",
"description": "预装 Python 3.10 的 Ubuntu 22.04 基础镜像",
"architecture": "x86",
"os": "Ubuntu"
}
]
}
Error Codes¶
| Error Code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
403 |
No permission to access this resource |
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