The correct base url for the hosted GitLab is https://gitlab.com/api/v4/ so your request to
GET /projects would be

curl --header "PRIVATE-TOKEN: XXXXXX" "https://gitlab.com/api/v4/projects"

That would return all projects that are visible to you, including other user's public projects.

If you wish to view just your projects, then you should use the GET /users/:user_id/projects endpoint, where :user_id is your user ID that can be found on your GitLab profile page or in the response to your request to GET /user if you're authenticated.

# Get :user_id from this request
curl --header "PRIVATE-TOKEN: XXXXXX" "https://gitlab.com/api/v4/user"

# See your projects by replacing :user_id with id value from previous request
curl --header "PRIVATE-TOKEN: XXXXXX" "https://gitlab.com/api/v4/users/:user_id/projects"

Also, the project ID is not the same as the project name. You can retrieve the project ID from the response of your request to GET /users/:user_id/projects, or from the project's settings page.

Answer from BrokenBinary 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/projects"
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api
REST API | GitLab Docs
curl --request GET \ --url "https://gitlab.example.com/api/v4/projects" Access to some endpoints require authentication. For more information, see Authentication.
🌐
University of Toronto
microfluidics.utoronto.ca › help › help
Projects · Api · Help · GitLab
[ { "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": ...
🌐
GeeksforGeeks
geeksforgeeks.org › git › how-to-access-the-gitlab-api
How To Access The GitLab API? - GeeksforGeeks
July 23, 2025 - ... import requests # Replace with your GitLab URL and token gitlab_url = "https://gitlab.com/api/v4/projects" headers = { "PRIVATE-TOKEN": "<your_personal_access_token>" } response = requests.get(gitlab_url, headers=headers) if response.status_code ...
🌐
Rewind
rewind.com › home › blog › backup blogs
Using the GitLab API | Rewind
September 3, 2024 - Passing personal access tokens as a URL parameter: curl "https://gitlab.example.com/api/v4/projects?private_token=&lt;your_access_token>"
🌐
Python GitLab
python-gitlab.readthedocs.io › en › stable › api-usage.html
Using the REST API - python-gitlab v8.5.0
You are encouraged to follow upstream API documentation for each resource to find these - each resource documented here links to the corresponding upstream resource documentation at the top of the page. The attributes of objects are defined upon object creation, and depend on the GitLab API itself. To list the available information associated with an object use the attributes attribute: project = gl.projects.get(1) print(project.attributes)
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › repositories
Repositories API | GitLab Docs
curl --header "PRIVATE-TOKEN: token" \ --url "https://gitlab.com/api/v4/projects/42/repository/changelog?version=1.0.0" Example response, with line breaks added for readability:
Find elsewhere
🌐
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 - For people just getting started with APIs, the REST API is much easier to understand and use. So this is what I will be demoing in this tutorial. The GitLab API specification defines various endpoints based on the action we want to perform. Let’s do a simple request using Postman. 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.
🌐
DZone
dzone.com › testing, deployment, and maintenance › deployment › using the gitlab rest api to create a git projects
Using the GitLab REST API to Create a Git Projects
October 4, 2019 - ####################################################### # Gitlab REST API Examples ####################################################### # API Documentation https://docs.gitlab.com/ee/api/api_resources.html export GITLAB_SERVER=http://localhost export GITLAB_TOKEN=sR4NN_HsMxhHWgju17pn export GITLAB_ROOTGROUP=my-programme export GITLAB_SUBGROUP=fintech export GITLAB_PROJECT=hello-world-project-01 export GITLAB_FEATURE=feature/my-feature-01 # #creating root group # rootGroupId=$(curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "$GITLAB_SERVER/api/v4/groups?search=$GITLAB_ROOTGROUP" | jq '.[0]["id"
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › projects › import and export
Project import and export API | GitLab Docs
Retrieves the status of the most recent import for a specified project. ... curl --request GET \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/1/import"
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › projects › releases
Project release API | GitLab Docs
Creates an evidence for an existing release. ... curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/evidence" ... Updates a release. Developer level access to the project is required to update a release.
🌐
Python GitLab
python-gitlab.readthedocs.io › en › stable › api-objects.html
API examples - python-gitlab v8.4.0
Project Remote Mirrors · Registry Repositories · Registry Repository Tags · Resource Groups · Search API · Secure Files · Service Accounts · Settings · Snippets · Statistics · External Status Checks · System hooks · Templates · Todos · Topics · Users and current user · CI/CD Variables · Sidekiq metrics · Wiki pages · Clusters (DEPRECATED) API reference (gitlab ...
🌐
GitLab
docs.gitlab.com › gitlab docs › contribute › contribute to documentation › style guide › rest api
Documenting REST API resources | GitLab Docs
The GitLab API sometimes accepts arrays of strings or integers. For example, to exclude specific users when requesting a list of users for a project, you would do something like this: curl --request PUT \ --header "PRIVATE-TOKEN: <your_access_token>" --data "skip_users[]=<user_id>" \ --data "skip_users[]=<user_id>" \ --url "https://gitlab.example.com/api/v4/projects/<project_id>/users"
🌐
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.
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › package registry
Packages API | GitLab Docs
Use this API to interact with GitLab Packages. ... Lists all packages for a specified project. All package types are included in results. 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"
🌐
GitLab
docs.gitlab.com › gitlab docs › extend › rest api › resources › pipelines
Pipelines API | GitLab Docs
Retrieves the latest pipeline for the most recent commit on a specific ref in a project. If no pipeline exists for the commit, a 403 status code is returned. ... Use the page and per_page pagination parameters to control the pagination of results. curl --request GET \ --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/1/pipelines/latest"
🌐
MetaCPAN
metacpan.org › pod › GitLab::API::v4
GitLab::API::v4 - A complete GitLab API v4 client. - metacpan.org
This can be specified as a numeric ... vague. The URL to your v4 API endpoint. Typically this will be something like https://git.example.com/api/v4....