Skip to content

Reset and Rebuild Space

POST /api/v5/spaces/{owner}/{repo_name}/reset

Resets and rebuilds the AI space (Space) corresponding to the specified repository, re-pulling the code and rebuilding the runtime environment.

Access Token Support

  • 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 The space address the repository belongs to (the address path of the enterprise, organization, or individual)
repo_name path string Yes Repository path (path)
access_token query string Yes User authorization code

Response Parameters

This endpoint has no response body. A successful reset returns HTTP 200 with an empty response body.

Failure Responses

400 Parameter error

Returned when the project corresponding to owner / repo_name does not exist:

{
  "error": "invalid_parameters",
  "message": "Invalid parameters, project does not exist: <owner>/<repo_name>"
}

401 Unauthenticated

Returned when the access token is missing or invalid:

{
  "error": "unauthorized",
  "message": "缺少或无效的访问令牌"
}

HTTP Response Status Codes

Status Code Description
200 Success (OK)
400 Parameter error (Bad Request)
401 Requires authentication (Requires authentication)
403 Forbidden (Forbidden)

Request Example

Parameter Description

Replace <owner> with the space address the repository belongs to (the address path of the enterprise, organization, or individual). If it is a three-segment namespace, for example: gh_mirrors/co/QwenPaw, the owner value is gh_mirrors/co; when calling, you must encode the first / as %2F, so the owner value passed is: gh_mirrors%2Fco.

Replace <repo_name> with the repository path;

Replace <token> with your AtomGit user access token.

cURL

curl -X POST 'https://api.atomgit.com/api/v5/spaces/<owner>/<repo_name>/reset?access_token=<token>' \
  -H 'Accept: application/json'

JavaScript

// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch(
  "https://api.atomgit.com/api/v5/spaces/<owner>/<repo_name>/reset?access_token=<YOUR-TOKEN>",
  {
    method: "POST",
    headers: {
      "Accept": "application/json",
    },
  },
);

if (!response.ok) {
  throw new Error(`请求失败: ${response.status}`);
}

Python

import requests

resp = requests.post(
    "https://api.atomgit.com/api/v5/spaces/<owner>/<repo_name>/reset",
    params={"access_token": "<YOUR-TOKEN>"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

Response Example

Status code: 200

A successful reset has no response body and returns empty.

Error Codes

Error Code Description
401 Unauthenticated or invalid credentials (missing/invalid access credentials)
400 Parameter error or the request cannot be parsed (e.g., the specified project does not exist)
403 Forbidden (no permission to operate on this space)
404 The request path does not exist
405 The request method is not supported
429 Too many requests, rate limited
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc