Labels REST API
Note
The documentation for this API is also available as an OpenAPI description.
List label keys
GET /cloud/v6/labels
List all label keys (accessible by all authenticated users).
Request parameters
| Name | Description | In | Required | Type |
|---|---|---|---|---|
X-Stack-Id | Numeric ID of the Grafana stack representing the request scope.
| header | true | integer |
200
response
OK.
Content types:
application/json
OK example
[
{
"value": [
{
"description": "Environment being tested",
"id": 1,
"key": "environment"
},
{
"description": "Team responsible for the project",
"id": 2,
"key": "team"
}
]
}
]401
response
Invalid token or authentication scheme.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
403
response
The user does not have permission to perform this action.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
500
response
Unexpected error.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
Create label keys
POST /cloud/v6/labels
Creates one or more label keys for the organization.
This operation is additive: it adds the new labels to the existing ones without replacing them.
Request parameters
| Name | Description | In | Required | Type |
|---|---|---|---|---|
X-Stack-Id | Numeric ID of the Grafana stack representing the request scope.
| header | true | integer |
Request body
Content types:
application/json
Request to create one or more label keys
LabelKeyCreateRequest properties:
| Name | Description | Required | Type |
|---|---|---|---|
value | Array of label keys to create (1-100). | true | Array[LabelKeyCreateItem] |
Single label key to create
LabelKeyCreateItem properties:
| Name | Description | Required | Type |
|---|---|---|---|
description | Optional description of the label key. | false | string
|
null |
key | Label key name. Case-sensitive. Unique per organization. | true | string |
Create example
{
"value": [
{
"description": "Environment being tested",
"key": "environment"
},
{
"description": "Team responsible for the project",
"key": "team"
},
{
"key": "cost_center"
}
]
}201
response
OK.
Content types:
application/json
Response for listing label keys
LabelKeyListResponse properties:
| Name | Description | Required | Type |
|---|---|---|---|
value | List of label keys. | true | Array[LabelKeyResponse] |
Label key response model
LabelKeyResponse properties:
| Name | Description | Required | Type |
|---|---|---|---|
description | Label key description. | false | string
|
null |
id | Label key ID. | true | integer |
key | Label key name. | true | string |
Created example
{
"value": [
{
"description": "Environment being tested",
"id": 1,
"key": "environment"
},
{
"description": "Team responsible for the project",
"id": 2,
"key": "team"
},
{
"description": null,
"id": 3,
"key": "cost_center"
}
]
}400
response
Duplicate keys in request.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
401
response
Invalid token or authentication scheme.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
403
response
The user does not have permission to perform this action.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
409
response
Maximum number of label keys (100) exceeded.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
500
response
Unexpected error.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
Delete a label key
DELETE /cloud/v6/labels/{id}
Delete a label key (Admin only).
When a label key is deleted, all project labels using this key are cascade deleted.
Request parameters
| Name | Description | In | Required | Type |
|---|---|---|---|---|
X-Stack-Id | Numeric ID of the Grafana stack representing the request scope.
| header | true | integer |
id | ID of the label key. | path | true | integer |
204
response
OK.
401
response
Invalid token or authentication scheme.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
403
response
The user does not have permission to perform this action.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
404
response
Label key not found.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
500
response
Unexpected error.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
Update a label key
PATCH /cloud/v6/labels/{id}
Update a label key (rename or update description) (Admin only).
Request parameters
| Name | Description | In | Required | Type |
|---|---|---|---|---|
X-Stack-Id | Numeric ID of the Grafana stack representing the request scope.
| header | true | integer |
id | ID of the label key. | path | true | integer |
Request body
Content types:
application/json
Request to update a label key
LabelKeyPatchRequest properties:
| Name | Description | Required | Type |
|---|---|---|---|
description | New label key description. | false | string
|
null |
key | New label key name. | false | string
|
null |
RenameKey example
{
"key": "env"
}UpdateBoth example
{
"description": "Environment (dev, prod)",
"key": "env"
}UpdateDescription example
{
"description": "Environment (dev, prod)"
}200
response
OK.
Content types:
application/json
Label key response model
LabelKeyResponse properties:
| Name | Description | Required | Type |
|---|---|---|---|
description | Label key description. | false | string
|
null |
id | Label key ID. | true | integer |
key | Label key name. | true | string |
OK example
{
"description": "Environment (dev, prod)",
"id": 1,
"key": "env"
}400
response
Request validation error.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
401
response
Invalid token or authentication scheme.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
403
response
The user does not have permission to perform this action.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
404
response
Label key not found.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
409
response
Label key with new name already exists.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
500
response
Unexpected error.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
List project labels
GET /cloud/v6/projects/{project_id}/labels
List all labels on a project.
Request parameters
| Name | Description | In | Required | Type |
|---|---|---|---|---|
X-Stack-Id | Numeric ID of the Grafana stack representing the request scope.
| header | true | integer |
project_id | ID of the project. | path | true | integer |
200
response
OK.
Content types:
application/json
OK example
[
{
"value": [
{
"key": "environment",
"value": "production"
},
{
"key": "team",
"value": "backend"
}
]
}
]401
response
Invalid token or authentication scheme.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
403
response
The user does not have permission to perform this action.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
404
response
Resource not found.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
500
response
Unexpected error.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
Replace project labels
PUT /cloud/v6/projects/{project_id}/labels
Replace labels on a project (Admin or Editor).
This is a full replacement operation.
Request parameters
| Name | Description | In | Required | Type |
|---|---|---|---|---|
X-Stack-Id | Numeric ID of the Grafana stack representing the request scope.
| header | true | integer |
project_id | ID of the project. | path | true | integer |
Request body
Content types:
application/json
Request to replace project labels.
This is a full replacement of all labels on the project.
ProjectLabelPutRequest properties:
| Name | Description | Required | Type |
|---|---|---|---|
value | Array of labels to assign (0-30). | true | Array[ProjectLabelPutItem] |
Single project label for PUT request
ProjectLabelPutItem properties:
| Name | Description | Required | Type |
|---|---|---|---|
key | Label key name. Mutually exclusive with ‘key_id’. | false | string
|
null |
key_id | Label key ID. Mutually exclusive with ‘key’. | false | integer
|
null |
value | Label value. | true | string |
ReplaceLabelsUsingKey example
{
"value": [
{
"key": "provider",
"value": "aws"
}
]
}ReplaceLabelsUsingKeyId example
{
"value": [
{
"key_id": 1,
"value": "aws"
}
]
}200
response
OK.
Content types:
application/json
Response for PUT project labels
ProjectLabelPutResponse properties:
| Name | Description | Required | Type |
|---|---|---|---|
value | List of project labels. | true | Array[ProjectLabelPutResponseItem] |
Single project label in PUT response
ProjectLabelPutResponseItem properties:
| Name | Description | Required | Type |
|---|---|---|---|
key | Label key name. | true | string |
key_id | Label key ID. | true | integer |
value | Label value. | true | string |
OK example
{
"value": [
{
"key": "provider",
"key_id": 1,
"value": "aws"
}
]
}400
response
Invalid label key ID or name, or duplicate keys in request.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
401
response
Invalid token or authentication scheme.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
403
response
The user does not have permission to perform this action.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
404
response
Project not found.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
409
response
Max labels per project (30) or max unique pairs per organization (500) exceeded.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
500
response
Unexpected error.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
Remove a label from project
DELETE /cloud/v6/projects/{project_id}/labels/{key}
Remove a label from a project (Admin or Editor).
Request parameters
| Name | Description | In | Required | Type |
|---|---|---|---|---|
X-Stack-Id | Numeric ID of the Grafana stack representing the request scope.
| header | true | integer |
key | Label key name. | path | true | string |
project_id | ID of the project. | path | true | integer |
204
response
OK.
401
response
Invalid token or authentication scheme.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
403
response
The user does not have permission to perform this action.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
404
response
Label key not found on project.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |
500
response
Unexpected error.
Content types:
application/json
ErrorResponseApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
error | true | ErrorApiModel |
Details of the error.
ErrorApiModel properties:
| Name | Description | Required | Type |
|---|---|---|---|
code | Service-defined error code. | true | string |
details | Array of objects with more specific error information when applicable. | false | array
|
null |
message | Human-readable string describing the error. | true | string |
target | A string indicating the target of the error. For example, the name of the property in error. | false | string
|
null |



