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
Retrieves the specified project. This endpoint can be accessed without authentication if the project is publicly accessible. ... curl --header "PRIVATE-TOKEN: <your_access_token>" \ --header "Accept: application/json" \ --url "https://gitlab.example.com/api/v4/projects/<project_id>"
🌐
Python GitLab
python-gitlab.readthedocs.io › en › stable › gl_objects › projects.html
Projects - python-gitlab v8.5.0 - Read the Docs
You can export projects from gitlab, and re-import them to create new projects or overwrite existing ones. v4 API: gitlab.v4.objects.ProjectExport · gitlab.v4.objects.ProjectExportManager · gitlab.v4.objects.Project.exports · gitlab.v4.objects.ProjectImport ·
Discussions

gitlab - List all the projects and all the groups - Stack Overflow
What is the easiest method to list all the projects and groups in GitLab using my private token? ... Save this answer. ... Show activity on this post. If only your private token is available, you can only use the API: ... This will return you the first 20 entries. To get more you can add the paramater per_page · curl "https:///api/v4... More on stackoverflow.com
🌐 stackoverflow.com
How to get a list of all your Gitlab personal projects via API?
My favourite would probably be https://gitlab.com/api/v4/projects?search=$your_username&search_namespaces=true However, that returns a 500 error for me :/ Alternatively you could do https://gitlab.com/api/v4/projects?owned=true , then iterate through the results and only keep those were the namespace.id matches your personal namespace. More on reddit.com
🌐 r/gitlab
3
3
June 17, 2022
API (v4) Creating New Project Within Group
How do I create a new project within a group using the API? I can successfully create a project for my user: curl --request POST --header 'Private-Token: MY_TOKEN' --header "Content-Type: application/json" --data '{"na… More on forum.gitlab.com
🌐 forum.gitlab.com
1
0
January 21, 2020
"Error 404 Project Not Found" when I try to get raw data from gitlab through REST api.
You will get a 404 when requesting a resource you are not allowed to access. Most likely, you are not sending the token for the request correctly, resulting in the request being unauthorised. More on reddit.com
🌐 r/gitlab
8
2
July 7, 2022
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api
REST API | GitLab Docs
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
docs.gitlab.com › gitlab docs › extend › rest api › resources
REST API resources | GitLab Docs
The GitLab REST API gives you programmatic control over GitLab resources. Build integrations with your existing tools, automate repetitive tasks, and extract data for custom reports. Access and manipulate projects, groups, issues, and merge requests without using the web interface.
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
🌐
University of Toronto
microfluidics.utoronto.ca › help › help
Projects · Api · Help · GitLab
GET /projects · Supported attributes: This endpoint supports keyset pagination for selected order_by options. When simple=true or the user is unauthenticated this returns something like: Example request: curl --request GET "https://gitlab.example.com/api/v4/projects" Example response: [ { "id": 4, "description": null, "name": "Diaspora Client", "name_with_namespace": "Diaspora / Diaspora Client", "path": "diaspora-client", "path_with_namespace": "diaspora/diaspora-client", "created_at": "2013-09-30T13:46:02Z", "default_branch": "main", "tag_list": [ "example", "disapora client" ], "topics": [
🌐
MetaCPAN
metacpan.org › pod › GitLab::API::v4
GitLab::API::v4 - A complete GitLab API v4 client. - metacpan.org
Sends a GET request to projects/:project_id/events and returns the decoded response content. ... Sends a GET request to features and returns the decoded response content. ... Sends a POST request to features/:name and returns the decoded response ...
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › package registry
Packages API | GitLab Docs
When accessed without authentication, only packages of public projects are returned. By default, packages with default, deprecated, and error status are returned. Use the status parameter to view other packages. ... curl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/:id/packages"
Find elsewhere
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › repositories
Repositories API | GitLab Docs
Works exactly like POST /projects/:id/repository/changelog, except the changelog data is not committed to any changelog file. ... Optional. You can add a .txt suffix that returns the changelog as plain text Markdown instead of JSON: ... curl --header "PRIVATE-TOKEN: token" \ --url "https://gitlab.com/api/v4/projects/42/repository/changelog?version=1.0.0"
🌐
Rewind
rewind.com › home › blog › backup blogs
Using the GitLab API | Rewind
September 3, 2024 - curl "https://gitlab.example.com/api/v4/projects?private_token=&lt;your_access_token>"
🌐
GitHub
github.com › bluefeet › GitLab-API-v4
GitHub - bluefeet/GitLab-API-v4: A complete GitLab API v4 client. · GitHub
Returns a new instance of GitLab::API::v4 with the "sudo_user" argument set. ... Sends a GET request to projects/:project_id/issues/:issue_iid/award_emoji and returns the decoded response content.
Author: bluefeet
🌐
Zuplo
zuplo.com › blog › 2025 › 03 › 24 › gitlab-api
GitLab API Guide: Unlock Powerful Integrations for Developers - DEV Community
June 11, 2026 - From here, you can create new projects, modify existing ones, or even nuke projects when they're no longer needed. GitLab's CI/CD capabilities are where the platform really shines, and the API gives you the keys to the kingdom: curl --header "PRIVATE-TOKEN: YOUR_PERSONAL_ACCESS_TOKEN" \ "https://gitlab.com/api/v4/projects/PROJECT_ID/pipelines"
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › jobs
Jobs API | GitLab Docs
Lists all jobs for a specified project. By default, this request returns 20 results at a time because the API results are paginated · This endpoint supports both offset-based and keyset-based pagination, but keyset-based pagination is strongly recommended when requesting consecutive pages ...
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › repository files
Repository files API | GitLab Docs
GET /projects/:id/repository/files/:file_path · Supported attributes: If successful, returns 200 OK and the following response attributes: curl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/13083/repository/files/app/models/key.rb?ref=main" If you don’t know the branch name or want to use the default branch, you can use HEAD as the ref value.
🌐
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 - https://gitlab.example.com.com/api/v4/ I will call the projects endpoint to get a list of all public projects. Press enter or click to view image in full size · A status 200 OK will indicate that the request has been successful. If you want to get details about a project, all you need is to append the project id to the URL.
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › projects › members
Projects members API | GitLab Docs
Retrieves a specified direct member of a project. Use retrieve a member of a project to retrieve inherited members. ... curl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/:id/members/:user_id"
🌐
GitProtect.io
gitprotect.io › strona główna › how to use gitlab api – best practices for your development team
How to Use GitLab API - Best Practices for Your Development Team - Blog | GitProtect.io
December 11, 2024 - curl --request PUT --header "PRIVATE-TOKEN: <access_token>" "https://gitlab.com/company/project/api/v4/projects/:id/access_requests/:user_id/approve?access_level=30"
🌐
GeeksforGeeks
geeksforgeeks.org › git › how-to-access-the-gitlab-api
How To Access The GitLab API? - GeeksforGeeks
July 23, 2025 - curl --header "PRIVATE-TOKEN: <your_personal_access_token>" https://gitlab.com/api/v4/projects · This command retrieves all projects you have access to on GitLab. Replace <your_personal_access_token> with the token you generated.
🌐
GitLab
forum.gitlab.com › how to use gitlab
API (v4) Creating New Project Within Group - How to Use GitLab - GitLab Forum
January 21, 2020 - How do I create a new project within a group using the API? I can successfully create a project for my user: curl --request POST --header 'Private-Token: MY_TOKEN' --header "Content-Type: application/json" --data '{"name":"my-cool-project"}' https://gitlab.com/api/v4/projects I can read projects for my group using: curl --request GET --header 'Private-Token: MY_TOKEN' https://gitlab.com/api/v4/groups/my-cool-group/projects However, I can’t use a POST method to create a project within my gro...