Project Aliases API
- Tier: Premium, Ultimate
- Offering: GitLab Self-Managed, GitLab Dedicated
Add, change, or remove project aliases with this API. After you create an alias for a project, users can clone the repository with the alias, which can be helpful when migrating repositories.
All methods require administrator authorization.
List all project aliases
Get a list of all project aliases:
GET /project_aliases
If successful, returns 200 OK
and the following
response attributes:
Attribute | Type | Description |
---|---|---|
id | integer | ID of the project alias. |
name | string | Name of the alias. |
project_id | integer | ID of the associated project. |
Example request:
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
Supported attributes:
Attribute | Type | Required | Description |
---|---|---|---|
name | string | Yes | The name of the alias. |
If successful, returns 200 OK
and the following
response attributes:
Attribute | Type | Description |
---|---|---|
id | integer | ID of the project alias. |
name | string | Name of the alias. |
project_id | integer | ID of the associated project. |
Example request:
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:
POST /project_aliases
Supported attributes:
Attribute | Type | Required | Description |
---|---|---|---|
name | string | Yes | Name of the alias. Must be unique. |
project_id | integer or string | Yes | ID or path of the project. |
If successful, returns 201 Created
and the following
response attributes:
Attribute | Type | Description |
---|---|---|
id | integer | ID of the project alias. |
name | string | Name of the alias. |
project_id | integer | ID of the associated project. |
Example request:
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"
You can also use the project path:
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
Remove a project alias:
DELETE /project_aliases/:name
Supported attributes:
Attribute | Type | Required | Description |
---|---|---|---|
name | string | Yes | Name of the alias. |
If successful, returns 204 No Content
.
Example request:
curl --request DELETE \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/project_aliases/gitlab"