Transfer repository¶
POST /api/v5/repos/{owner}/{repo}/transfer
The user calls this endpoint to transfer a repository.
Access token support¶
- AtomGit user access tokens (AtomGit user access tokens)
Anonymous access allowed?¶
This endpoint does not allow 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 organization or individual) |
repo |
path | string | Yes | Repository path (path) |
access_token |
query | string | Yes | User authorization code |
Request Body:
Repository transfer request body in JSON format. new_owner is the path of the target organization to transfer to.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"new_owner": {
"description": "Target organization to transfer to (organization path/path)",
"type": "string"
}
},
"required": ["new_owner"]
}
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
new_owner |
string | Yes | Yes | Path of the target organization after transfer |
new_name |
string | Yes | Yes | Repository path (path) after transfer |
Error response¶
400 Parameter error
{
"error": "invalid_request",
"message": "The repository is not ready yet and cannot be transferred for now. Please try again later."
}
401 Unauthenticated
403 Forbidden
The actual error field names are subject to what the backend returns.
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
400 |
Parameter error (Bad request) |
401 |
Authentication required (Requires authentication) |
403 |
Forbidden |
404 |
Request path does not exist (Not found) |
Request example¶
Parameter description¶
Replace
<owner>with the address path of the namespace the repository belongs to (the address path of an organization or individual); replace<repo>with the repository path (path); replace<token>with your AtomGit user access token.
cURL¶
curl -X POST 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/transfer?access_token=<token>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"new_owner": "<new_owner>"
}'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/transfer?access_token=<token>",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
},
body: JSON.stringify({
new_owner: "<new_owner>",
}),
}
);
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.post(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/transfer",
params={"access_token": "<token>"},
json={"new_owner": "<new_owner>"},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
Error codes¶
| Error code | Description |
|---|---|
400 |
Parameter error or the request cannot be parsed (e.g. the repository is not ready yet and cannot be transferred for now) |
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
403 |
You do not have permission to perform this operation |
404 |
Request path does not exist |
500 |
Internal system error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc