Lists all custom tags assigned to the specified monitored entities. Automatically applied tags and imported tags are not included.
The request produces an application/json payload.
| GET | SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/tags |
| Environment ActiveGateCluster ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/tags |
To execute this request, you need an access token with entities.read scope.
To learn how to obtain and use it, see Tokens and authentication.
| Parameter | Type | Description | In | Required |
|---|---|---|---|---|
| entitySelector | string | Specifies the entities where you want to read tags. You must set one of these criteria:
You can add one or more of the following criteria. Values are case-sensitive and the
For more information, see Entity selector in Dynatrace Documentation. To set several criteria, separate them with a comma ( The maximum string length is 2,000 characters. | query | Required |
| from | string | The start of the requested timeframe. You can use one of the following formats:
If not set, the relative timeframe of 24 hours is used ( | query | Optional |
| to | string | The end of the requested timeframe. You can use one of the following formats:
If not set, the current timestamp is used. | query | Optional |
| Code | Type | Description |
|---|---|---|
| 200 | Custom | Success |
| 4XX | Error | Client side error. |
| 5XX | Error | Server side error. |
CustomEntityTags objectA list of custom tags.
| Element | Type | Description |
|---|---|---|
| tags | M | A list of custom tags. |
| totalCount | integer | The total number of tags in the response. |
METag objectThe tag of a monitored entity.
| Element | Type | Description |
|---|---|---|
| context | string | The origin of the tag, such as AWS or Cloud Foundry. Custom tags use the |
| key | string | The key of the tag. |
| stringRepresentation | string | The string representation of the tag. |
| value | string | The value of the tag. |
ErrorEnvelope object| Element | Type | Description |
|---|---|---|
| error | Error | - |
Error object| Element | Type | Description |
|---|---|---|
| code | integer | The HTTP status code |
| constraintViolations | Constraint | A list of constraint violations |
| message | string | The error message |
ConstraintViolation objectA list of constraint violations
| Element | Type | Description |
|---|---|---|
| location | string | - |
| message | string | - |
| parameterLocation | string | -The element can hold these values
|
| path | string | - |
{"tags": [{"context": "CONTEXTLESS","key": "mainApp","stringRepresentation": "mainApp"},{"context": "CONTEXTLESS","key": "bookings","stringRepresentation": "bookings"}],"totalCount": 2}
{"error": {"code": 1,"constraintViolations": [{"location": "string","message": "string","parameterLocation": "HEADER","path": "string"}],"message": "string"}}
In this example, the request lists custom tags that are applied to services that belong to the management zones with the ID of 229130632296508575249. To achieve that, the entitySelector query parameter is set to type("SERVICE"),mzId("9130632296508575249").
The API token is passed in the Authorization header.
Because the full result is rather lengthy, it is truncated to three entries.
curl -L -X GET 'https://mySampleEnv.live.dynatrace.com/api/v2/tags?entitySelector=type(%22SERVICE%22),mzId(%229130632296508575249%22)' \-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'
https://mySampleEnv.live.dynatrace.com/api/v2/tags?entitySelector=type(%22SERVICE%22),mzId(%229130632296508575249%22)
{"totalCount": 31,"tags": [{"context": "CONTEXTLESS","key": "Billing","stringRepresentation": "Billing"},{"context": "CONTEXTLESS","key": "Booking","stringRepresentation": "Booking"},{"context": "CONTEXTLESS","key": "easytravel","value": "backend","stringRepresentation": "easytravel:backend"}]}
200