Update repository settings¶
PATCH /api/v5/repos/{owner}/{repo}
This endpoint updates the settings of the specified repository. You can change the repository name, description, homepage URL, repository path, public or private status, default branch, whether LFS is enabled, and project tags. The endpoint returns the updated repository details.
Supported access tokens¶
- 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 | Address path of the namespace that owns the repository (enterprise, organization, or personal path) |
repo |
path | string | Yes | Repository path |
access_token |
query | string | Yes | User authorization code |
Request Body:
The request body is submitted in application/json format and describes the repository settings to update.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"name": {
"description": "Repository name",
"type": "string"
},
"description": {
"description": "Repository description",
"type": "string"
},
"homepage": {
"description": "Project URL (homepage)",
"type": "string"
},
"path": {
"description": "Updated repository path",
"type": "string"
},
"private": {
"description": "Whether the repository is public or private (true/false)",
"type": "boolean"
},
"default_branch": {
"description": "Default branch",
"type": "string"
},
"lfs_enabled": {
"description": "Whether LFS is enabled",
"type": "boolean"
},
"tags": {
"description": "Project tags",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["name"]
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | ID |
full_name |
string | Yes | Yes | Full name |
human_name |
string | Yes | Yes | Human-readable name |
url |
string | Yes | Yes | URL |
path |
string | Yes | Yes | Repository path |
name |
string | Yes | Yes | Repository name |
description |
string | Yes | Yes | Repository description |
private |
boolean | Yes | Yes | Whether the repository is private |
public |
boolean | Yes | Yes | Whether the repository is public |
namespace |
object | Yes | No | Namespace information |
empty_repo |
boolean | Yes | Yes | Whether the repository is empty |
starred |
boolean | Yes | Yes | Whether the repository is starred |
visibility |
string | Yes | Yes | Visibility |
owner |
object | Yes | Yes | Owner information |
creator |
object | Yes | Yes | Creator information |
forked_from_project |
object | Yes | Yes | Information about the project this repository was forked from |
item_type |
string | Yes | Yes | Project type |
main_repository_language |
string[] | Yes | Yes | Primary repository language |
homepage |
string | Yes | Yes | Homepage |
tags |
string[] | No | Yes | Project tags |
namespace object
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
namespace.id |
integer | Yes | No | Namespace ID |
namespace.name |
string | Yes | Yes | Name |
namespace.path |
string | Yes | Yes | Path |
namespace.develop_mode |
string | Yes | Yes | Development mode |
namespace.region |
string | Yes | Yes | Region |
namespace.cell |
string | Yes | Yes | Cell |
namespace.kind |
string | Yes | Yes | Kind |
namespace.full_path |
string | Yes | Yes | Full path |
namespace.full_name |
string | Yes | Yes | Full name |
namespace.parent_id |
integer | Yes | Yes | Parent namespace ID |
namespace.visibility_level |
integer | Yes | Yes | Visibility level |
namespace.enable_file_control |
boolean | Yes | Yes | Whether file control is enabled |
namespace.owner_id |
integer | Yes | Yes | Owner ID |
owner, creator, and forked_from_project are nullable objects; their internal structure follows the actual response.
Error response¶
400 Invalid parameters
401 Unauthenticated
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Invalid parameters (Bad request) |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Request path does not exist (Not found) |
405 |
Request method not supported (Method not allowed) |
429 |
Too many requests (Rate limited) |
500 |
Internal system error |
Request example¶
Parameter notes¶
<owner>Replace with the address path of the namespace that owns the repository (enterprise, organization, or personal path);<repo>Replace with the repository path;<token>Replace with your AtomGit user access token.
cURL¶
curl -X PATCH 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>?access_token=<token>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"name": "test_create_project_2",
"description": "Description",
"private": false,
"default_branch": "master",
"lfs_enabled": false,
"tags": ["java", "web"]
}'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>?access_token=<token>", {
method: "PATCH",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "test_create_project_2",
description: "Description",
private: false,
default_branch: "master",
lfs_enabled: false,
tags: ["java", "web"],
}),
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.patch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>",
params={"access_token": "<token>"},
headers={
"Accept": "application/json",
"Content-Type": "application/json",
},
json={
"name": "test_create_project_2",
"description": "Description",
"private": False,
"default_branch": "master",
"lfs_enabled": False,
"tags": ["java", "web"],
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"id": 34171993,
"full_name": "daming_1/test_create_project_2",
"human_name": "daming/test_create_project_2",
"url": "https://api.atomgit.com/api/v5/repos/daming_1/test_create_project_2",
"path": "test_create_project_2",
"name": "test_create_project_2",
"description": "Description",
"private": false,
"public": true,
"namespace": {
"id": 74962,
"name": "group1111",
"path": "group11111",
"develop_mode": "normal",
"region": null,
"cell": "default",
"kind": "group",
"full_path": "group11111",
"full_name": "group1111",
"parent_id": null,
"visibility_level": 20,
"enable_file_control": false,
"owner_id": null
},
"empty_repo": null,
"starred": null,
"visibility": "public",
"owner": null,
"creator": null,
"forked_from_project": null,
"item_type": null,
"main_repository_language": null,
"homepage": "http://www.baidi.com"
}
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access token) |
400 |
Invalid parameters or unparseable request |
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