---
type: api
title: Set the tags for a Deployment
description: Sets the tags for a Deployment, replacing any existing tags.
url: https://www.elastic.co/docs/api/doc/cloud-enterprise/operation/operation-set-deployment-tags
resource: https://www.elastic.co/docs/api/doc/cloud-enterprise/operation/operation-set-deployment-tags
products:
  - Elastic Cloud Enterprise
---

# Set the tags for a Deployment

Authentication: required

## Paths

- `PUT` `/deployments/{deployment_id}/tags`

#### Path parameters

- `deployment_id` (string) — required
  Identifier for the Deployment

## Description

Sets the tags for a Deployment, replacing any existing tags.

## Request body

The tags to set on the deployment.

`application/json`

- `tags` (object[]) — optional
  Arbitrary user-defined metadata associated with this deployment
  - `key` (string) — required
    The metadata field name
  - `value` (string) — required
    The metadata value

## Responses

#### `200`

The deployment tags were successfully updated

`application/json`

- `tags` (object[])
  Arbitrary user-defined metadata associated with this deployment
  - `key` (string)
    The metadata field name
  - `value` (string)
    The metadata value
#### `400`

* The number of tags exceeds the maximum of 64 allowed per deployment. (code: `deployments.too_many_tags`)
* A tag key exceeds the maximum of 32 characters or a tag value exceeds the maximum of 128 characters. (code: `deployments.lengthy_key_or_value`)

`application/json`

- `errors` (object[])
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` (string[])
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

#### `404`

The Deployment specified by {deployment_id} cannot be found. (code: `deployments.deployment_not_found`)

`application/json`

- `errors` (object[])
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` (string[])
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

## Code examples

#### curl

```curl
curl -X PUT "${API_URL}/deployments/${DEPLOYMENT_ID}/tags" \
  -u "${USERNAME}:${PASSWORD}" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "tags": [
    {
      "key": "string",
      "value": "string"
    }
  ]
}
```

#### 400

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "code": "string",
      "message": "string",
      "fields": [
        "string"
      ]
    }
  ]
}
```

#### 404

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "code": "string",
      "message": "string",
      "fields": [
        "string"
      ]
    }
  ]
}
```

