Skip to content

Archive a repository

PUT /api/v5/org/{org}/repo/{repo}/status

Updates the archive status of the specified repository. By setting the repository state to archived or unarchived, it archives and restores the repository.

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 (path)
access_token query string Yes User authorization code

Request Body:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "status": {
      "description": "Repository status; 0: started (the repository is not archived), 2: closed (the repository is archived)",
      "type": "integer",
      "enum": [0, 2]
    },
    "password": {
      "description": "User password",
      "type": "string"
    }
  },
  "required": ["status"]
}

Response parameters

Field Type Always returned Nullable Description
code integer Yes No Status code; 0 means success
msg string Yes No Response message; success on success

Error response

400 Invalid parameters

{
  "code": 400,
  "msg": "Invalid parameters or the request cannot be parsed"
}

401 Unauthenticated

{
  "code": 401,
  "msg": "Missing or invalid access token"
}

Error field names and values follow what the backend actually returns.

HTTP status codes

Status code Description
200 Success (OK)
400 Invalid parameters (Bad Request)
401 Authentication required (Requires authentication)
404 Not Found

Request example

Parameter notes

Replace <org> with the path of the organization the repository belongs to; replace <repo> with the repository path (path); replace <token> with your AtomGit user access token.

cURL

curl -X PUT 'https://api.atomgit.com/api/v5/org/<org>/repo/<repo>/status?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"status": 2}'

JavaScript

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

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.put(
    "https://api.atomgit.com/api/v5/org/<org>/repo/<repo>/status",
    params={"access_token": "<token>"},
    headers={
        "Content-Type": "application/json",
        "Accept": "application/json",
    },
    json={"status": 2},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

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

Error codes

Error code Description
400 Invalid parameters or the request cannot be parsed
401 Unauthenticated or invalid credentials (missing or invalid access credentials)
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