Use this API to manage labels for both projects and groups. For the difference between the two, see types of labels.
List all group labels
GET /api/v4/groups/{id}/labels
Lists all group labels for a specified group.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
with_Query | Boolean | Include issue and merge request counts Default: false |
include_Query | Boolean | Include ancestor groups Default: true |
include_Query | Boolean | Include descendant groups. Default: false |
only_Query | Boolean | Toggle to include only group labels or also project labels. Default: true |
searchQuery | String | Keyword to filter labels by. |
archivedQuery | Boolean | Filter by archived status. |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Create a group label
POST /api/v4/groups/{id}/labels
Creates a group label.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
archived | Boolean | Whether the label is archived |
colorRequired | String | The color of the label given in 6- |
description | String | The description of label to be created |
nameRequired | String | The name of the label to be created |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Update a group label
PUT /api/v4/groups/{id}/labels
Updates an existing group label. At least one parameter is required to update the group label.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
archived | Boolean | Whether the label is archived |
color | String | The new color of the label given in 6- |
description | String | The new description of label |
label_ | Integer | The ID of the label to be updated |
name | String | The name of the label to be updated |
new_ | String | The new name of the label |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Delete a group label
DELETE /api/v4/groups/{id}/labels
Deletes a specified group label.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
nameQuery, | String | The name of the label to be deleted |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Retrieve a group label
GET /api/v4/groups/{id}/labels/{name}
Retrieves a specified group label.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
namePath, | String or integer | The ID or name of a label |
include_Query | Boolean | Include ancestor groups Default: true |
include_Query | Boolean | Include descendant groups. Default: false |
only_Query | Boolean | Toggle to include only group labels or also project labels. Default: true |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Update a group label
PUT /api/v4/groups/{id}/labels/{name}
Updates a specified group label. At least one parameter is required to update the group label.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
namePath, | String | The name or id of the label to be updated |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
archived | Boolean | Whether the label is archived |
color | String | The new color of the label given in 6- |
description | String | The new description of label |
new_ | String | The new name of the label |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Delete a group label
DELETE /api/v4/groups/{id}/labels/{name}
Deletes a specified group label.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
namePath, | String | The name or id of the label to be deleted |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
List all project labels
GET /api/v4/projects/{id}/labels
Lists all labels for a specified project. By default, this request returns 20 results at a time because the API results are paginated.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
with_Query | Boolean | Include issue and merge request counts Default: false |
include_Query | Boolean | Include ancestor groups Default: true |
searchQuery | String | Keyword to filter labels by. |
archivedQuery | Boolean | Filter by archived status. |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Create a project label
POST /api/v4/projects/{id}/labels
Creates a label for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
archived | Boolean | Whether the label is archived |
colorRequired | String | The color of the label given in 6- |
description | String | The description of label to be created |
nameRequired | String | The name of the label to be created |
priority | Integer | The priority of the label |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Update an existing label (deprecated)
PUT /api/v4/projects/{id}/labels
At least one optional parameter is required.
Deprecated in GitLab 12.4. Use PUT /projects/:id/labels/:name instead.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
archived | Boolean | Whether the label is archived |
color | String | The new color of the label given in 6- |
description | String | The new description of label |
label_ | Integer | The ID of the label to be updated |
name | String | The name of the label to be updated |
new_ | String | The new name of the label |
priority | Integer | The priority of the label |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Delete an existing label (deprecated)
DELETE /api/v4/projects/{id}/labels
Deprecated in GitLab 12.4. Use DELETE /projects/:id/labels/:name instead.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
label_Query | Integer | The ID of the label to be deleted |
nameQuery | String | The name of the label to be deleted |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Promote a label to a group label (deprecated)
PUT /api/v4/projects/{id}/labels/promote
Added in GitLab 12.3 and deprecated in GitLab 12.4. Use PUT /projects/:id/labels/:name/promote instead.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
nameRequired | String | The name of the label to be promoted |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Retrieve a project label
GET /api/v4/projects/{id}/labels/{name}
Retrieves a specified label for a project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String or integer | The ID or name of a label |
include_Query | Boolean | Include ancestor groups Default: true |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Update a project label
PUT /api/v4/projects/{id}/labels/{name}
Updates a specified label for a project with a different name or color. At least one parameter is required to update the label.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name or id of the label to be updated |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
archived | Boolean | Whether the label is archived |
color | String | The new color of the label given in 6- |
description | String | The new description of label |
new_ | String | The new name of the label |
priority | Integer | The priority of the label |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Delete a project label
DELETE /api/v4/projects/{id}/labels/{name}
Deletes a specified label from a project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name or id of the label to be deleted |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Promote a project label to a group label
PUT /api/v4/projects/{id}/labels/{name}/promote
Promotes a specified project label to a group label. The label keeps its ID.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name or id of the label to be promoted |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesGroupLabel
| Property | Type | Description |
|---|---|---|
archived | Boolean | Example:false |
closed_ | Integer | Example:0 |
color | String | Example:#FF0000 |
description | String | Example:Bug reported by user |
description_ | String | Example:<p>Bug reported by user</ |
id | Integer (int64) | Example:1 |
name | String | Example:bug |
open_ | Integer | Example:1 |
open_ | Integer | Example:1 |
subscribed | Boolean | Example:false |
text_ | String | Example:#FFFFFF |
APIEntitiesProjectLabel
| Property | Type | Description |
|---|---|---|
archived | Boolean | Example:false |
closed_ | Integer | Example:0 |
color | String | Example:#FF0000 |
description | String | Example:Bug reported by user |
description_ | String | Example:<p>Bug reported by user</ |
id | Integer (int64) | Example:1 |
is_ | Boolean | — |
name | String | Example:bug |
open_ | Integer | Example:1 |
open_ | Integer | Example:1 |
priority | Integer | Example:10 |
subscribed | Boolean | Example:false |
text_ | String | Example:#FFFFFF |