Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: GitLab REST Labels API
description: GitLab REST API used to interact with a GitLab installation.
termsOfService: https://handbook.gitlab.com/handbook/legal/api-terms/
version: '19.6'
license:
name: CC BY-SA 4.0
url: https://gitlab.com/gitlab-org/gitlab/-/blob/master/LICENSE
x-gitlab-description: The license applies to the OpenAPI specification document itself. For terms governing use of the GitLab API, see the termsOfService field.
servers:
- url: https://{hostname}
description: GitLab REST API
variables:
hostname:
default: gitlab.com
description: Your GitLab instance hostname
security:
- http: []
- oauth2: []
- apiKey: []
tags:
- name: Labels
description: 'Use this API to manage labels for both projects and
groups. For the difference between the two, see
types of labels.'
x-displayName: Labels
externalDocs:
url: https://docs.gitlab.com/api/labels/
paths:
/api/v4/projects/{id}/labels:
get:
operationId: getApiV4ProjectsIdLabels
summary: List all project labels
description: Lists all labels for a specified project. By default, this request returns 20 results at a time because the API results are paginated.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProjectLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: with_counts
required: false
description: If `true`, includes issue and merge request counts.
schema:
type: boolean
default: false
in: query
- name: include_ancestor_groups
required: false
description: If `true`, includes ancestor groups.
schema:
type: boolean
default: true
in: query
- name: search
required: false
description: Keyword to filter labels by.
schema:
type:
- string
- 'null'
in: query
- name: archived
required: false
description: If `true`, returns only archived labels. If `false`, returns only non-archived labels. If omitted, returns all labels. Introduced in GitLab 18.10.
schema:
type:
- boolean
- 'null'
in: query
- name: page
required: false
description: Page number of results to retrieve.
schema:
type: integer
default: 1
in: query
example: 1
- name: per_page
required: false
description: Number of items to list per page.
schema:
type: integer
default: 20
in: query
example: 20
post:
operationId: postApiV4ProjectsIdLabels
summary: Create a project label
description: Creates a label for a specified project.
tags:
- Labels
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProjectLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/postApiV4ProjectsIdLabelsRequest'
put:
operationId: putApiV4ProjectsIdLabels
summary: Update an existing label. At least one optional parameter is required
description: Deprecated in GitLab 12.4. Use PUT /projects/:id/labels/:name instead.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProjectLabel'
'404':
description: Not Found
'400':
description: Bad Request
deprecated: true
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/putApiV4ProjectsIdLabelsRequest'
delete:
operationId: deleteApiV4ProjectsIdLabels
summary: Delete an existing label
description: Deprecated in GitLab 12.4. Use DELETE /projects/:id/labels/:name instead.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProjectLabel'
'404':
description: Not Found
'400':
description: Bad Request
deprecated: true
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: label_id
required: false
description: ID of the label to delete. Exactly one of `label_id`, `name` must be provided.
schema:
type:
- integer
- 'null'
in: query
- name: name
required: false
description: Name of the label to delete. Exactly one of `label_id`, `name` must be provided.
schema:
type:
- string
- 'null'
in: query
/api/v4/projects/{id}/labels/{name}:
get:
operationId: getApiV4ProjectsIdLabelsName
summary: Retrieve a project label
description: Retrieves a specified label for a project.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProjectLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: name
required: true
description: ID or name of the label.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: include_ancestor_groups
required: false
description: If `true`, includes ancestor groups.
schema:
type: boolean
default: true
in: query
put:
operationId: putApiV4ProjectsIdLabelsName
summary: Update a project label
description: Updates a specified label for a project with a different name or color. At least one parameter is required to update the label.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProjectLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: name
required: true
description: Name or ID of the label to update.
schema:
type: string
in: path
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/putApiV4ProjectsIdLabelsNameRequest'
delete:
operationId: deleteApiV4ProjectsIdLabelsName
summary: Delete a project label
description: Deletes a specified label from a project.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesProjectLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: name
required: true
description: Name or ID of the label to delete.
schema:
type: string
in: path
/api/v4/projects/{id}/labels/promote:
put:
operationId: putApiV4ProjectsIdLabelsPromote
summary: Promote a label to a group label
description: Added in GitLab 12.3 and deprecated in GitLab 12.4. Use PUT /projects/:id/labels/:name/promote instead.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesGroupLabel'
'404':
description: Not Found
'400':
description: Bad Request
deprecated: true
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/putApiV4ProjectsIdLabelsPromoteRequest'
/api/v4/projects/{id}/labels/{name}/promote:
put:
operationId: putApiV4ProjectsIdLabelsNamePromote
summary: Promote a project label to a group label
description: Promotes a specified project label to a group label. The label keeps its ID.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesGroupLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the project.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: name
required: true
description: Name or ID of the label to promote.
schema:
type: string
in: path
/api/v4/groups/{id}/labels:
get:
operationId: getApiV4GroupsIdLabels
summary: List all group labels
description: Lists all group labels for a specified group.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesGroupLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
type: string
in: path
- name: with_counts
required: false
description: If `true`, includes issue and merge request counts.
schema:
type: boolean
default: false
in: query
- name: include_ancestor_groups
required: false
description: If `true`, includes ancestor groups.
schema:
type: boolean
default: true
in: query
- name: include_descendant_groups
required: false
description: If `true`, includes descendant groups.
schema:
type: boolean
default: false
in: query
- name: only_group_labels
required: false
description: If `true`, returns only group labels. If `false`, also returns project labels.
schema:
type: boolean
default: true
in: query
- name: search
required: false
description: Keyword to filter labels by.
schema:
type:
- string
- 'null'
in: query
- name: archived
required: false
description: If `true`, returns only archived labels. If `false`, returns only non-archived labels. If omitted, returns all labels. Introduced in GitLab 18.10.
schema:
type:
- boolean
- 'null'
in: query
- name: page
required: false
description: Page number of results to retrieve.
schema:
type: integer
default: 1
in: query
example: 1
- name: per_page
required: false
description: Number of items to list per page.
schema:
type: integer
default: 20
in: query
example: 20
post:
operationId: postApiV4GroupsIdLabels
summary: Create a group label
description: Creates a group label.
tags:
- Labels
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesGroupLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
type: string
in: path
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/postApiV4GroupsIdLabelsRequest'
put:
operationId: putApiV4GroupsIdLabels
summary: Update a group label
description: Updates an existing group label. At least one parameter is required to update the group label.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesGroupLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
type: string
in: path
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/putApiV4GroupsIdLabelsRequest'
delete:
operationId: deleteApiV4GroupsIdLabels
summary: Delete a group label
description: Deletes a specified group label.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesGroupLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
type: string
in: path
- name: name
required: true
description: Name of the label to delete.
schema:
type:
- string
- 'null'
in: query
/api/v4/groups/{id}/labels/{name}:
get:
operationId: getApiV4GroupsIdLabelsName
summary: Retrieve a group label
description: Retrieves a specified group label.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesGroupLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
type: string
in: path
- name: name
required: true
description: ID or name of the label.
schema:
oneOf:
- type: string
- type: integer
in: path
- name: include_ancestor_groups
required: false
description: If `true`, includes ancestor groups.
schema:
type: boolean
default: true
in: query
- name: include_descendant_groups
required: false
description: If `true`, includes descendant groups.
schema:
type: boolean
default: false
in: query
- name: only_group_labels
required: false
description: If `true`, returns only group labels. If `false`, also returns project labels.
schema:
type: boolean
default: true
in: query
put:
operationId: putApiV4GroupsIdLabelsName
summary: Update a group label
description: Updates a specified group label. At least one parameter is required to update the group label.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesGroupLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
type: string
in: path
- name: name
required: true
description: Name or ID of the label to update.
schema:
type: string
in: path
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/putApiV4GroupsIdLabelsNameRequest'
delete:
operationId: deleteApiV4GroupsIdLabelsName
summary: Delete a group label
description: Deletes a specified group label.
tags:
- Labels
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/APIEntitiesGroupLabel'
'404':
description: Not Found
'400':
description: Bad Request
parameters:
- name: id
required: true
description: ID or URL-encoded path of the group.
schema:
type: string
in: path
- name: name
required: true
description: Name or ID of the label to delete.
schema:
type: string
in: path
components:
schemas:
APIEntitiesProjectLabel:
type: object
properties:
id:
type: integer
format: int64
example: 1
name:
type: string
example: bug
description:
type: string
example: Bug reported by user
text_color:
type: string
example: '#FFFFFF'
description_html:
type: string
example: <p>Bug reported by user</p>
color:
type: string
example: '#FF0000'
archived:
type: boolean
example: false
open_issues_count:
type: integer
example: 1
closed_issues_count:
type: integer
example: 0
open_merge_requests_count:
type: integer
example: 1
subscribed:
type: boolean
example: false
priority:
type: integer
example: 10
is_project_label:
type: boolean
putApiV4ProjectsIdLabelsRequest:
type: object
properties:
label_id:
type:
- integer
- 'null'
description: ID of the label to update. Exactly one of `label_id`, `name` must be provided.
name:
type:
- string
- 'null'
description: Name of the label to update. Exactly one of `label_id`, `name` must be provided.
new_name:
type:
- string
- 'null'
description: The new name of the label. At least one of `new_name`, `color`, `description`, `priority`, `archived` must be provided.
color:
type:
- string
- 'null'
description: New color of the label, given in 6-digit hex notation with a leading `#` sign (for example, `#FFAABB`), or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords). At least one of `new_name`, `color`, `description`, `priority`, `archived` must be provided.
description:
type:
- string
- 'null'
description: New description of label. At least one of `new_name`, `color`, `description`, `priority`, `archived` must be provided.
archived:
type:
- boolean
- 'null'
description: Whether the label is archived. At least one of `new_name`, `color`, `description`, `priority`, `archived` must be provided.
priority:
type:
- integer
- 'null'
description: The priority of the label. At least one of `new_name`, `color`, `description`, `priority`, `archived` must be provided.
putApiV4ProjectsIdLabelsNameRequest:
type: object
properties:
new_name:
type:
- string
- 'null'
description: The new name of the label. At least one of `new_name`, `color`, `description`, `priority`, `archived` must be provided.
color:
type:
- string
- 'null'
description: New color of the label, given in 6-digit hex notation with a leading `#` sign (for example, `#FFAABB`), or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords). At least one of `new_name`, `color`, `description`, `priority`, `archived` must be provided.
description:
type:
- string
- 'null'
description: New description of label. At least one of `new_name`, `color`, `description`, `priority`, `archived` must be provided.
archived:
type:
- boolean
- 'null'
description: Whether the label is archived. At least one of `new_name`, `color`, `description`, `priority`, `archived` must be provided.
priority:
type:
- integer
- 'null'
description: The priority of the label. At least one of `new_name`, `color`, `description`, `priority`, `archived` must be provided.
APIEntitiesGroupLabel:
type: object
properties:
id:
type: integer
format: int64
example: 1
name:
type: string
example: bug
description:
type: string
example: Bug reported by user
text_color:
type: string
example: '#FFFFFF'
description_html:
type: string
example: <p>Bug reported by user</p>
color:
type: string
example: '#FF0000'
archived:
type: boolean
example: false
open_issues_count:
type: integer
example: 1
closed_issues_count:
type: integer
example: 0
open_merge_requests_count:
type: integer
example: 1
subscribed:
type: boolean
example: false
putApiV4GroupsIdLabelsRequest:
type: object
properties:
label_id:
type:
- integer
- 'null'
description: ID of the label to update. Exactly one of `label_id`, `name` must be provided.
name:
type:
- string
- 'null'
description: Name of the label to update. Exactly one of `label_id`, `name` must be provided.
new_name:
type:
- string
- 'null'
description: The new name of the label. At least one of `new_name`, `color`, `description`, `archived` must be provided.
color:
type:
- string
- 'null'
description: New color of the label, given in 6-digit hex notation with a leading `#` sign (for example, `#FFAABB`), or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords). At least one of `new_name`, `color`, `description`, `archived` must be provided.
description:
type:
- string
- 'null'
description: New description of label. At least one of `new_name`, `color`, `description`, `archived` must be provided.
archived:
type:
- boolean
- 'null'
description: Whether the label is archived. At least one of `new_name`, `color`, `description`, `archived` must be provided.
postApiV4GroupsIdLabelsRequest:
type: object
properties:
name:
type:
- string
- 'null'
description: The name of the label to be created
color:
type:
- string
- 'null'
description: Color of the label in 6-digit hex notation with a leading `#` sign, for example `#FFAABB`, or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords).
description:
type:
- string
- 'null'
description: Description of the label.
archived:
type:
- boolean
- 'null'
description: Whether the label is archived
required:
- name
- color
putApiV4ProjectsIdLabelsPromoteRequest:
type: object
properties:
name:
type:
- string
- 'null'
description: Name of the label to promote.
required:
- name
putApiV4GroupsIdLabelsNameRequest:
type: object
properties:
new_name:
type:
- string
- 'null'
description: The new name of the label. At least one of `new_name`, `color`, `description`, `archived` must be provided.
color:
type:
- string
- 'null'
description: New color of the label, given in 6-digit hex notation with a leading `#` sign (for example, `#FFAABB`), or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords). At least one of `new_name`, `color`, `description`, `archived` must be provided.
description:
type:
- string
- 'null'
description: New description of label. At least one of `new_name`, `color`, `description`, `archived` must be provided.
archived:
type:
- boolean
- 'null'
description: Whether the label is archived. At least one of `new_name`, `color`, `description`, `archived` must be provided.
postApiV4ProjectsIdLabelsRequest:
type: object
properties:
name:
type:
- string
- 'null'
description: The name of the label to be created
color:
type:
- string
- 'null'
description: Color of the label in 6-digit hex notation with a leading `#` sign, for example `#FFAABB`, or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords).
description:
type:
- string
- 'null'
description: Description of the label.
archived:
type:
- boolean
- 'null'
description: Whether the label is archived
priority:
type:
- integer
- 'null'
description: The priority of the label
required:
- name
- color
securitySchemes:
http:
type: http
scheme: bearer
oauth2:
type: oauth2
flows:
authorizationCode:
authorizationUrl: https://gitlab.com/oauth/authorize
tokenUrl: https://gitlab.com/oauth/token
refreshUrl: https://gitlab.com/oauth/token
scopes:
api: Grants complete read/write access to the API, including all groups and projects, the container registry, the dependency proxy, and the package registry.
read_api: Grants read access to the API, including all groups and projects, the container registry, and the package registry.
read_user: Grants read-only access to your profile through the /user API endpoint, which includes username, public email, and full name. Also grants access to read-only API endpoints under /users.
create_runner: Grants create access to the runners.
manage_runner: Grants access to manage the runners.
k8s_proxy: Grants permission to perform Kubernetes API calls using the agent for Kubernetes.
self_rotate: Grants permission for token to rotate itself.
mcp: Grants read-write access to remote Model Context Protocol (MCP) server for tools execution.
mcp_orbit: Grants access to the Orbit Knowledge Graph MCP server for graph queries and schema retrieval.
apiKey:
type: apiKey
name: PRIVATE-TOKEN
in: header