If only your private token is available, you can only use the API:

PROJECTS

Use the following command to request projects:

curl "https://<host>/api/v4/projects?private_token=<your private token>"

This will return you the first 20 entries. To get more you can add the paramater per_page

curl "https://<host>/api/v4/projects?private_token=<your private token>&per_page=100"

with this parameter you can request between 20and 100 entries (see REST API Pagination documentation).

If you now want all projects, you have to loop through the pages. To get to another page add the parameter page.

curl "https://<host>/api/v4/projects?private_token=<your private token>&per_page=100&page=<page_number>"

Now you may want to know how many pages there are. For that, add the curl parameter --head. This will not return the payload, but the header.

The result should look like this:

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 13 Jul 2017 17:43:24 GMT
Content-Type: application/json
Content-Length: 29428
Cache-Control: no-cache
Link: <request link>
Vary: Origin
X-Frame-Options: SAMEORIGIN
X-Next-Page: 2
X-Page: 1
X-Per-Page: 20
X-Prev-Page:
X-Request-Id: 80ecc167-4f3f-4c99-b09d-261e240e7fe9
X-Runtime: 4.117558
X-Total: 312257
X-Total-Pages: 15613
Strict-Transport-Security: max-age=31536000

The two interesting parts here are X-Totaland X-Total-Pages. The first is the count of available entries and the second the count of total pages.

I suggest to use python or some other kind of script to handle the requests and concat the results at the end.

If you want to refine the search, consult this wiki page: https://docs.gitlab.com/api/projects.html#projects-api

GROUPS

For groups simply replace projects with groups in the curls. https://docs.gitlab.com/api/groups.html#list-groups


UPDATE:

Here is the official list of Gitlab API clients/wrappers: https://docs.gitlab.com/api/rest/third_party_clients/

I highly recommend using one of these.

Answer from secustor on Stack Overflow
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › projects
Projects API | GitLab Docs
Use keyset-based pagination to list more than 50,000 projects. For more information, see Pagination. ... curl --header "PRIVATE-TOKEN: <your_access_token>" \ --header "Accept: application/json" \ --url "https://gitlab.example.com/api/v4/users/:user_id/projects
Top answer
1 of 9
98

If only your private token is available, you can only use the API:

PROJECTS

Use the following command to request projects:

curl "https://<host>/api/v4/projects?private_token=<your private token>"

This will return you the first 20 entries. To get more you can add the paramater per_page

curl "https://<host>/api/v4/projects?private_token=<your private token>&per_page=100"

with this parameter you can request between 20and 100 entries (see REST API Pagination documentation).

If you now want all projects, you have to loop through the pages. To get to another page add the parameter page.

curl "https://<host>/api/v4/projects?private_token=<your private token>&per_page=100&page=<page_number>"

Now you may want to know how many pages there are. For that, add the curl parameter --head. This will not return the payload, but the header.

The result should look like this:

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 13 Jul 2017 17:43:24 GMT
Content-Type: application/json
Content-Length: 29428
Cache-Control: no-cache
Link: <request link>
Vary: Origin
X-Frame-Options: SAMEORIGIN
X-Next-Page: 2
X-Page: 1
X-Per-Page: 20
X-Prev-Page:
X-Request-Id: 80ecc167-4f3f-4c99-b09d-261e240e7fe9
X-Runtime: 4.117558
X-Total: 312257
X-Total-Pages: 15613
Strict-Transport-Security: max-age=31536000

The two interesting parts here are X-Totaland X-Total-Pages. The first is the count of available entries and the second the count of total pages.

I suggest to use python or some other kind of script to handle the requests and concat the results at the end.

If you want to refine the search, consult this wiki page: https://docs.gitlab.com/api/projects.html#projects-api

GROUPS

For groups simply replace projects with groups in the curls. https://docs.gitlab.com/api/groups.html#list-groups


UPDATE:

Here is the official list of Gitlab API clients/wrappers: https://docs.gitlab.com/api/rest/third_party_clients/

I highly recommend using one of these.

2 of 9
10

In bash for Gitlab API V4:

#!/bin/bash
GL_DOMAIN=""
GL_TOKEN=""
echo "" > gitlab_projects_urls.txt
for ((i=1; ; i+=1)); do
    contents=$(curl "$GL_DOMAIN/api/v4/projects?private_token=$GL_TOKEN&per_page=100&page=$i")
    if jq -e '. | length == 0' >/dev/null; then 
       break
    fi <<< "$contents"
    echo "$contents" | jq -r '.[].ssh_url_to_repo' >> gitlab_projects_urls.txt
done
Discussions

List of projects in which your are a member using Gitlab Api
Hi, I would like to find REST API to retrieve list of projects where I am a member. But couldn’t find REST API for that. Please help me out. More on forum.gitlab.com
🌐 forum.gitlab.com
2
0
January 14, 2021
GitLab api: how am i able the get the list of projects using gitlab api? - Stack Overflow
i was trying to get the list of projects in my gitlab using Git api. for that i was following Git lab api instruction. they said i can access the list of project by this link: https://gitlab.com... More on stackoverflow.com
🌐 stackoverflow.com
List all the projects in Gitlab
Hi, I am an admin and I am trying to list all the projects using the private token in the curl command. However, it doesn’t provide me all the projects. If I look up on the UI, I can see all the projects though. Is there any reason why the curl doesn’t return all the projects/pages that ... More on forum.gitlab.com
🌐 forum.gitlab.com
4
0
July 18, 2017
How to get the project details using Gitlab API
Currently i have the below url for my gitlab and i would like to fetch all the projects details of MRs which are open. I know if we provide the project id in the url i could fetch. But it involves lot of manual task to go through all 45 projects and provide the id and retrive the details using ... More on forum.gitlab.com
🌐 forum.gitlab.com
1
0
February 15, 2024
🌐
Python GitLab
python-gitlab.readthedocs.io › en › stable › gl_objects › projects.html
Projects - python-gitlab v8.5.0 - Read the Docs
GitLab API: https://docs.gitlab.com/api/projects · List projects: projects = gl.projects.list(get_all=True) The API provides several filtering parameters for the listing methods: archived: if True only archived projects will be returned · visibility: returns only projects with the specified ...
🌐
GitLab
forum.gitlab.com › how to use gitlab
List of projects in which your are a member using Gitlab Api - How to Use GitLab - GitLab Forum
January 14, 2021 - Hi, I would like to find REST API to retrieve list of projects where I am a member. But couldn’t find REST API for that. Please help me out.
🌐
Stack Overflow
stackoverflow.com › questions › 52944992 › gitlab-api-how-am-i-able-the-get-the-list-of-projects-using-gitlab-api
GitLab api: how am i able the get the list of projects using gitlab api? - Stack Overflow
i was trying to get the list of projects in my gitlab using Git api. for that i was following Git lab api instruction. they said i can access the list of project by this link: https://gitlab.com...
🌐
GitLab
forum.gitlab.com › how to use gitlab
List all the projects in Gitlab - How to Use GitLab - GitLab Forum
July 18, 2017 - Hi, I am an admin and I am trying to list all the projects using the private token in the curl command. However, it doesn’t provide me all the projects. If I look up on the UI, I can see all the projects though. Is there any reason why the curl doesn’t return all the projects/pages that are there in Gitlab? curl "https://git.comp.biz/api/v3/projects?private_token=???
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources
REST API resources | GitLab Docs
GitLab REST API resources organized by context (project, group, standalone, and templates) with endpoint paths.
Find elsewhere
🌐
University of Toronto
microfluidics.utoronto.ca › help › help
Projects · Api · Help · GitLab
The _links.cluster_agents attribute in the response was introduced in GitLab 15.0. Get a list of all visible projects across GitLab for the authenticated user.
🌐
Apidog
gitlab.apidog.io › api-3525037
Get a list of projects in this group. - Gitlab
Try itRun in ApidogRun in Apidog · Get a list of projects in this group. Path Params · Generate Code · Query Params · Generate Code · 🟢200Get a list of projects in this group. application/jsonGenerate Code · Bodyapplication/json · Generate Code · Request Request Example · Shell · JavaScript · Java · Swift · cURLcURL-WindowsHttpiewgetPowerShell · curl --location 'https://gitlab.com/api/v3/groups//projects' Response Response Example ·
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › groups
Groups API | GitLab Docs
The projects and shared_projects attributes in the response are deprecated and scheduled for removal in API v5. To get the details of all projects within a group, use either the list a group’s projects or the list a group’s shared projects endpoint. curl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/groups/4"
🌐
GitLab
gitlab.com › gitlab.org › #16149
API to list projects for a user and/or within a namespace (#16149) · Issues · GitLab.org / GitLab · GitLab
October 10, 2016 - ### Description Right now there is no straightforward way to list, via the API, all projects within a [namespace](https://docs.gitlab.com/ce/api/namespaces.html).
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › topics
Topics API | GitLab Docs
{ "id": 1, "name": "gitlab", "title": ... "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon" } Uses the Projects API to list all projects assigned to a specific topic....
🌐
Python GitLab
python-gitlab.readthedocs.io › en › v2.10.1 › gl_objects › projects.html
Projects — python-gitlab 2.10.1 documentation - Read the Docs
GitLab API: https://docs.gitlab.com/ce/api/projects.html · List projects: projects = gl.projects.list() The API provides several filtering parameters for the listing methods: archived: if True only archived projects will be returned · visibility: returns only projects with the specified ...
🌐
Medium
medium.com › devops-with-valentine › how-to-use-the-gitlab-rest-api-ba4e4ca1fcae
How to use the GitLab REST API. The GitLab API allows you to perform… | by Valentin Despa | DevOps with Valentine | Medium
September 24, 2021 - I am using gitlab.com, so the GitLab API base URL will be this: ... I will call the projects endpoint to get a list of all public projects.
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api
REST API | GitLab Docs
The root endpoint is the GitLab host name. The path must start with /api/v4 (v4 represents the API version). In the following example, the API request retrieves the list of all projects on GitLab host gitlab.example.com:
🌐
GitLab
forum.gitlab.com › how to use gitlab
How to get the project details using Gitlab API - How to Use GitLab - GitLab Forum
February 15, 2024 - Currently i have the below url for my gitlab and i would like to fetch all the projects details of MRs which are open. I know if we provide the project id in the url i could fetch. But it involves lot of manual task to go through all 45 projects and provide the id and retrive the details using ...
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › package registry
Packages API | GitLab Docs
Lists all pipelines for a specified package. The results are sorted by id in descending order. The results are paginated and return up to 20 records per page. ... curl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/:id/packages/:package_id/pipelines"
🌐
GitHub
github.com › apache › incubator-devlake › issues › 2376
[Feature][gitlab] API to list all `projects` for gitlab · Issue #2376 · apache/devlake
June 29, 2022 - Add API GET /api/proxy/gitlab/projects?keyword=&page=2&size=10, searching and pagination are critical since the total number of projects is likely to be huge.
Author: apache
🌐
GitLab
forum.gitlab.com › how to use gitlab
How to get the all project IDs (about 250 projects) within a given Group in GitLab by using API curl - How to Use GitLab - GitLab Forum
June 17, 2021 - I use following part of the bash script to retrieve all IDs of the projects within a given GitLab group using API calls. There are about 250 projects in the group. But when use this script it only retrieves 100 projects ids. How do I retrieve all of the project ids? page=1 #------Retrieve the IDs of the non archived projects in the group while [[ “$page” != “0” ]] do urlCheck=curl -s "$GIT_API/groups?private_token=$GIT_TOKEN&per_page=100&page=$page" | jq -r ".[] | .name" if [[ -n $urlCheck...