Project Aliases API
- Tier: Premium, Ultimate
- Offering: GitLab Self-Managed, GitLab Dedicated
All methods require administrator authorization.
List all project aliases
Get a list of all project aliases:
GET /project_aliases
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/project_aliases"
Example response:
[
{
"id": 1,
"project_id": 1,
"name": "gitlab-foss"
},
{
"id": 2,
"project_id": 2,
"name": "gitlab"
}
]
Get project alias’ details
Get details of a project alias:
GET /project_aliases/:name
Attribute | Type | Required | Description |
---|---|---|---|
name | string | Yes | The name of the alias. |
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/project_aliases/gitlab"
Example response:
{
"id": 1,
"project_id": 1,
"name": "gitlab"
}
Create a project alias
Add a new alias for a project. When successful, responds with 201 Created
.
When there are validation errors, for example, when the alias already exists, responds with 400 Bad Request
:
POST /project_aliases
Attribute | Type | Required | Description |
---|---|---|---|
name | string | Yes | The name of the alias. Must be unique. |
project_id | integer or string | Yes | The ID or path of the project. |
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/project_aliases" \
--form "project_id=1" \
--form "name=gitlab"
or
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/project_aliases" \
--form "project_id=gitlab-org/gitlab" \
--form "name=gitlab"
Example response:
{
"id": 1,
"project_id": 1,
"name": "gitlab"
}
Delete a project alias
Removes a project aliases. Responds with a 204 when project alias exists, 404 when it doesn’t:
DELETE /project_aliases/:name
Attribute | Type | Required | Description |
---|---|---|---|
name | string | Yes | The name of the alias. |
curl --request DELETE \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/project_aliases/gitlab"
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support