Skip to content

List all repositories of the authorized user

GET /api/v5/user/repos

Call this endpoint to list all repositories of the authorized user.

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
visibility query string No Visibility: public (public), private (private), or all (all); default all
affiliation query string No Relationship: owner (repositories owned by the authorized user), collaborator (repositories the authorized user is a member of), organization_member (repositories in an organization the authorized user belongs to and is allowed to access), enterprise_member (repositories in an enterprise the authorized user belongs to and is allowed to access), admin (every repository the authorized user has permission on, including all repositories in the organizations and enterprises the user manages); values can be combined and separated by commas, such as owner, organization_member or owner, collaborator, organization_member
type query string No Filter the user's repositories: created by the user (owner), personal (personal), where the user is a member (member), public (public), private (private); cannot be used together with the affiliation parameter, otherwise a 422 error is returned; when used together with the visibility parameter, visibility takes precedence
sort query string No Sort order: creation time (created), update time (updated), last push time (pushed), repository owner and name (full_name); default full_name
direction query string No Sort direction: if sort is full_name, ascending (asc); otherwise descending (desc)
q query string No Search keyword
page query integer No Current page number
per_page query integer No Number of items per page; maximum 100, default 20
repo_type query string No Filter by repository type: code (code repository), model (model repository), dataset (dataset repository), space (space), all (all repository types); default code

Response parameters

Field Type Always returned Nullable Description
id integer Yes No Repository ID
full_name string Yes No Owner and name of the repository (e.g. owner/name)
human_name string Yes No Repository human-readable name
url string Yes No Repository API URL
namespace object Yes No Namespace information
path string Yes No Repository path
name string Yes No Repository name
description string Yes Yes Repository description
status string Yes No Repository status: 0: start (repository not archived), 2: closed (repository archived)
ssh_url_to_repo string Yes No SSH clone URL
http_url_to_repo string Yes No HTTP clone URL
web_url string Yes No Repository web URL
homepage string Yes No Repository homepage
members string[] Yes Yes Repository member list
assignee object[] Yes Yes Assignee list
forks_count integer Yes No Number of forks
stargazers_count integer Yes No Number of stars
project_labels object[] Yes Yes Project label list
relation string Yes Yes Relationship with the authorized user
permission object Yes No Repository permissions of the current user
internal integer Yes No Whether the repository is internal; values 0/1
open_issues_count integer Yes No Number of open issues
has_issue integer Yes No Whether issues are enabled; values 0/1
watched integer Yes No Whether the repository is watched; values 0/1
watchers_count integer Yes No Number of followers
assignees_number integer Yes No Number of assignees
enterprise object Yes No Enterprise information
default_branch string Yes No Default branch
fork integer Yes No Whether the repository is a fork; values 0/1
owner object Yes No Repository owner information
assigner object Yes No Assigner information
private integer Yes No Whether the repository is private; values 0/1
public integer Yes No Whether the repository is public; values 0/1
repo_type string Yes No Repository type: code/model/dataset/space

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 web URL

assignee object array

Field Type Always returned Nullable Description
assignee.id string Yes No User ID
assignee.login string Yes No Login name
assignee.name string Yes No User name
assignee.avatar_url string Yes No Avatar URL
assignee.html_url string Yes No User profile URL
assignee.type string Yes No User type

permission object

Field Type Always returned Nullable Description
permission.pull integer Yes No Pull permission; values 0/1
permission.push integer Yes No Push permission; values 0/1
permission.admin integer Yes No Admin permission; values 0/1

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 web URL
enterprise.type string Yes No Enterprise type

owner object

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

assigner object

Field Type Always returned Nullable Description
assigner.id string Yes No Assigner ID
assigner.login string Yes No Login name
assigner.name string Yes No Name
assigner.type string Yes No Type

Error response

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

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Parameter validation failed"
}

401 Unauthenticated

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

422 Parameter conflict

{
  "error": "invalid_request",
  "message": "The affiliation and type parameters cannot be used together"
}

(The actual error field names returned by the backend take precedence.)

HTTP status codes

Status code Description
200 Success (OK)
400 Invalid parameters
401 Requires authentication
422 Parameter conflict (affiliation and type cannot be used together)

Request example

Parameter notes

Every <...> placeholder in the examples must be replaced with an actual value:

<token> Replace with your AtomGit user access token.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/user/repos?access_token=<token>' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const token = "<YOUR-TOKEN>";
const response = await fetch(
  `https://api.atomgit.com/api/v5/user/repos?access_token=${token}`,
  {
    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/repos",
    params={"access_token": "<YOUR-TOKEN>"},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

[
  {
    "id": 4028329,
    "full_name": "tiandi/test_yf_repo",
    "human_name": "Hongmen / test_yf_repo",
    "url": "https://api.atomgit.com/api/v5/repos/tiandi/test_yf_repo",
    "namespace": {
      "id": 1420034,
      "type": "enterprise",
      "name": "Hongmen",
      "path": "tiandi",
      "html_url": "https://api.atomgit.com/tiandi"
    },
    "path": "test_yf_repo",
    "name": "test_yf_repo",
    "description": "",
    "status": "0",
    "ssh_url_to_repo": "git@atomgit.com:tiandi/test_yf_repo.git",
    "http_url_to_repo": "https://api.atomgit.com/tiandi/test_yf_repo.git",
    "web_url": "https://api.atomgit.com/tiandi/test_yf_repo",
    "homepage": "https://api.atomgit.com/tiandi/test_yf_repo",
    "members": ["aron1"],
    "assignee": [
      {
        "id": "332008",
        "login": "aron1",
        "name": "yanfan",
        "avatar_url": "https://api.atomgit.com/avatar.png",
        "html_url": "https://api.atomgit.com/aron1",
        "type": "User"
      }
    ],
    "forks_count": 0,
    "stargazers_count": 0,
    "project_labels": [],
    "relation": "master",
    "permission": {
      "pull": 1,
      "push": 1,
      "admin": 1
    },
    "internal": 0,
    "open_issues_count": 0,
    "has_issue": 0,
    "watched": 0,
    "watchers_count": 0,
    "assignees_number": 1,
    "enterprise": {
      "id": 1420034,
      "path": "tiandi",
      "html_url": "https://api.atomgit.com/tiandi",
      "type": "enterprise"
    },
    "default_branch": "main",
    "fork": 0,
    "owner": {
      "id": "444601",
      "login": "yanfan",
      "name": "yanfan",
      "type": "User"
    },
    "assigner": {
      "id": "444601",
      "login": "yanfan",
      "name": "yanfan",
      "type": "User"
    },
    "private": 1,
    "public": 0,
    "repo_type": "code"
  }
]

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