Skip to content

Transfer a repository

POST /api/v5/org/{org}/projects/{repo}/transfer

Transfers the specified repository to a target organization, changing the organization it belongs to; after a successful transfer the repository is managed by the target organization.

Supported access tokens

  • AtomGit user access tokens

Anonymous access allowed

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
org path string Yes Organization the repository belongs to
repo path string Yes Repository path
access_token query string Yes User authorization code

Request Body:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "transfer_to": {
      "description": "Target organization to transfer to",
      "type": "string"
    },
    "password": {
      "description": "User password",
      "type": "string"
    }
  },
  "required": ["transfer_to", "password"]
}

Response parameters

Field Type Always returned Nullable Description
code integer Yes No Response status code; 0 means success
msg string Yes No Response message, such as success

Error response

A 200/success response alone is not enough: callers need to know what a failure looks like in order to write error handling.

This endpoint requires authentication and does not accept anonymous access; it returns 401 when authentication fails, and 400 when a request parameter is missing or invalid. Error field names follow what the backend actually returns.

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Parameter transfer_to cannot be empty"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

HTTP status codes

Status code Description
200 Success (OK)
400 Invalid parameters or the request cannot be parsed
401 Authentication required (Requires authentication)
403 Access forbidden (Forbidden)
404 Resource does not exist (Not found)
405 Request method not supported
429 Too many requests; rate limit triggered
500 Internal system error

Request example

Parameter notes

Replace <org> with the organization the repository belongs to; replace <repo> with the path of the repository to transfer; replace <transfer_to> with the target organization; replace <password> with your user password; replace <token> with your AtomGit user access token.

cURL

curl -X POST 'https://api.atomgit.com/api/v5/org/<org>/projects/<repo>/transfer?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -d '{"transfer_to": "<transfer_to>", "password": "<password>"}'

JavaScript

// Native fetch (Node.js 18+ / browsers)
const response = await fetch(
  "https://api.atomgit.com/api/v5/org/<org>/projects/<repo>/transfer?access_token=<token>",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Accept": "application/json",
    },
    body: JSON.stringify({
      transfer_to: "<transfer_to>",
      password: "<password>",
    }),
  }
);

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/org/<org>/projects/<repo>/transfer",
    params={"access_token": "<token>"},
    headers={
        "Content-Type": "application/json",
        "Accept": "application/json",
    },
    json={
        "transfer_to": "<transfer_to>",
        "password": "<password>",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "code": 0,
  "msg": "success"
}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access credentials)
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