Skip to content

Stop a Running Space

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

Stop the specified running Space and release the computing resources it occupies.

Access Token Support

  • AtomGit user access tokens

Anonymous Access Allowed

This API does not allow anonymous access

Request Parameters

Parameter In Type Required Description
owner path string Yes The address path of the space the repository belongs to (the address path of an enterprise, organization, or individual)
repo_name path string Yes Repository path
access_token query string Yes User authorization code

The server first joins owner/repo_name into the project path; if the project does not exist, it returns a parameter error.

Response Parameters

On success, this API returns no response body (the method signature is void); a unified error structure is returned only on failure, with the following fields.

Field Type Always Returned Nullable Description
error_code integer Yes No Error code (a numeric error code corresponding to the HTTP status code)
error_code_name string No Yes Error name, such as BAD_REQUEST, UNAUTHORIZED
error_message string Yes No Error description text

Failure Responses

400 Invalid parameters

{
  "error_code": 400,
  "error_code_name": "BAD_REQUEST",
  "error_message": "Invalid parameters, project does not exist: <owner>/<repo_name>"
}

401 Unauthenticated

{
  "error_code": 401,
  "error_code_name": "UNAUTHORIZED",
  "error_message": "Unauthorized"
}

HTTP Response Status Codes

Status Code Description
200 Success (OK), no response body
400 Invalid parameters (such as the project does not exist, or the upstream rejects the request)
401 Authentication required (missing or invalid access token)
403 Forbidden (no permission to perform this operation)
429 Too many requests, rate limit triggered
500 Internal system error

Request Examples

Parameter Description

Replace <owner> with the address path of the space the repository belongs to (the address path of an enterprise, organization, or individual). If it is a three-segment namespace, for example: gh_mirrors/co/QwenPaw, the owner value is gh_mirrors/co, and you must encode the first / as %2F when calling, 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>/stop?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>/stop?access_token=<YOUR-TOKEN>",
  {
    method: "POST",
    headers: {
      "Accept": "application/json",
    },
  }
);

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

// 成功时无响应体
console.log(response.status);

Python

import requests

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

# 成功时无响应体
print(resp.status_code)

Response Examples

Status code: 200

No response body on success.

Error Codes

Error Code Description
400 Invalid parameters, such as the project does not exist or upstream parameter validation fails
401 Unauthenticated or invalid credentials (missing/invalid access token)
403 No permission to operate this Space
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