Skip to content

List repositories watched by the authorized user

GET /api/v5/user/subscriptions

Call this endpoint to list the repositories the authorized user is watching.

Supported access tokens

  • AtomGit user access token (AtomGit user access tokens)

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
access_token query string Yes User authorization code
sort query string No Sort order, values created (by repository creation time) or last_push (by last push time); default is creation time
direction query string No Sort direction, values asc / desc; default descending
page query integer No Current page number
per_page query integer No Number of items per page; maximum 100, default 20

Response parameters

The response body is an array of repository objects; the structure of each array element is described below:

repository object

Field Type Always returned Nullable Description
id integer Yes No Repository ID
full_name string Yes No Repository full path
human_name string Yes No Repository full name
url string Yes No Repository details URL
namespace object Yes No Namespace the repository belongs to
path string Yes No Repository path
name string Yes No Repository name
parentfull_name string Yes Yes Parent repository name
description string Yes Yes Repository description
status string Yes Yes Repository status: 0: start (repository not archived), 2: closed (repository archived)
ssh_url_to_repo string Yes No Repository SSH Git URL
http_url_to_repo string Yes No Repository HTTP Git URL
web_url string Yes No Repository web URL
created_at string Yes No Creation time
updated_at string Yes No Update time
homepage string Yes Yes Repository homepage
members string[] Yes Yes Repository member list
parent object Yes Yes Parent repository information
forks_count integer Yes No Number of forks
stargazers_count integer Yes No Number of stars
relation string Yes Yes Role of the current user in the repository
permission object Yes No Permissions of the current user on the repository
internal integer Yes No Whether it is internally open source
open_issues_count integer Yes No Number of open issues
has_issue integer Yes No Whether the repository has issues
has_issues integer Yes No Whether the issue feature is enabled
watchers_count integer Yes No Number of watchers
enterprise object Yes Yes Enterprise information
default_branch string Yes No Default branch
fork integer Yes No Whether the repository is a fork
pushed_at string Yes Yes Time of the last code push
owner object Yes No Repository creator information
issue_template_source string Yes Yes Issue template source, values project(use the repository Issue Template as the template) or enterprise(use enterprise work items as the template)
project_creator string Yes Yes Repository creator
private integer Yes No Whether the repository is private
public integer Yes No Whether the repository is public

repository.namespace object

Field Type Always returned Nullable Description
namespace.id integer Yes No Namespace ID
namespace.type string Yes No Namespace type
namespace.name string Yes No Namespace name
namespace.path string Yes No Namespace path
namespace.html_url string Yes No Namespace URL

repository.parent object

Field Type Always returned Nullable Description
parent.full_name string Yes No Parent repository full path
parent.human_name string Yes No Parent repository full name

repository.permission object

Field Type Always returned Nullable Description
permission.pull integer Yes No Whether the user has pull permission
permission.push integer Yes No Whether the user has push permission
permission.admin integer Yes No Whether the user has admin permission

repository.enterprise object

Field Type Always returned Nullable Description
enterprise.id integer Yes No Enterprise ID
enterprise.path string Yes No Enterprise path
enterprise.html_url string Yes No Enterprise URL
enterprise.type string Yes No Enterprise type

repository.owner object

Field Type Always returned Nullable Description
owner.id string Yes No Creator ID
owner.login string Yes No Creator login name
owner.name string Yes No Creator name
owner.type string Yes No Creator type

Error response

When authentication fails (401) or parameters are invalid (400), the backend returns an error message. The actual error field names returned by the backend take precedence.

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Invalid parameters"
}

401 Unauthenticated

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

HTTP status codes

Status code Description
200 Success (OK)
401 Requires authentication
403 Forbidden

Request example

Parameter notes

The example authenticates with the access_token query parameter; replace <token> with your AtomGit user access token.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/user/subscriptions?access_token=<token>&sort=created&direction=desc&page=1&per_page=20' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/user/subscriptions?access_token=<YOUR-TOKEN>&sort=created&direction=desc&page=1&per_page=20", {
  headers: {
    "Accept": "application/json",
  },
});

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

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

Python

import requests

resp = requests.get(
    "https://api.atomgit.com/api/v5/user/subscriptions",
    params={
        "access_token": "<YOUR-TOKEN>",
        "sort": "created",
        "direction": "desc",
        "page": 1,
        "per_page": 20,
    },
    headers={
        "Accept": "application/json",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "id": 777621,
    "full_name": "xiaogang/private-new2",
    "human_name": "xiaogang / private-new2",
    "url": "https://api.atomgit.com/api/v5/repos/xiaogang/private-new2",
    "namespace": {
      "id": 137117,
      "type": "user",
      "name": "xiaogang",
      "path": "xiaogang",
      "html_url": "https://api.atomgit.com/xiaogang"
    },
    "path": "private-new2",
    "name": "private-new2",
    "parentfull_name": "xiaogang_test/private-new",
    "description": "Trump",
    "status": "started",
    "ssh_url_to_repo": "ssh://git@atomgit.com:2222/xiaogang/private-new2.git",
    "http_url_to_repo": "https://api.atomgit.com/xiaogang/private-new2.git",
    "web_url": "https://api.atomgit.com/xiaogang/private-new2",
    "created_at": "2024-12-11T17:41:14.536+08:00",
    "updated_at": "2024-12-11T17:41:14.536+08:00",
    "homepage": "https://api.atomgit.com/xiaogang/private-new2",
    "members": ["xiaogang"],
    "parent": {
      "full_name": "xiaogang_test/private-new",
      "human_name": "xiaogang_test / private-new"
    },
    "forks_count": 0,
    "stargazers_count": 1,
    "relation": "master",
    "permission": {
      "pull": true,
      "push": true,
      "admin": true
    },
    "internal": false,
    "open_issues_count": 0,
    "has_issue": false,
    "has_issues": false,
    "watchers_count": 0,
    "enterprise": {
      "id": 137117,
      "path": "xiaogang",
      "html_url": "https://api.atomgit.com/xiaogang",
      "type": "user"
    },
    "default_branch": "main",
    "fork": true,
    "pushed_at": "2024-12-20T19:14:34.979+08:00",
    "owner": {
      "id": "496",
      "login": "xiaogang",
      "name": "Xiao Gang",
      "type": "User"
    },
    "issue_template_source": "project",
    "project_creator": "xiaogang",
    "private": false,
    "public": true
  }
]

Error codes

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