Skip to content

Add Tags to Secret

Endpoint: PUT /api/secrets/{key}/tags

Adds tags to a secret. You can add a single tag or multiple tags in one request. If a tag with the same key already exists, this operation will update its value.

Path parameters

Parameter Description Type Required/ Optional
key The secret key name to which the tags are to be added. string Required.

Request Body

The request body should be an array of tag objects.

Parameter Description Type Required/ Optional
key The tag key. string Required.
value The tag value. string Required.

Example for adding multiple tags in a single request:

[
  {
    "key": "dev",
    "value": "automation"
  },
  {
    "key": "backend",
    "value": "PR"
  }
]

Returns 404 if an invalid secret key is provided.

Response

Returns 200 OK, indicating that tags have been added to the secret.

Examples

Add a single tag to a secret

Request

curl -X 'PUT' \
  'https://<YOUR-SERVER-URL>/api/secrets/my_secret/tags' \
  -H 'accept: */*' \
  -H 'X-Authorization: <TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "key": "env",
    "value": "prod"
  }
]'

Response

Returns 200 OK, indicating that the tag has been added to the secret.

Add multiple tags to a secret

Request

curl -X 'PUT' \
  'https://<YOUR-SERVER-URL>/api/secrets/my_token/tags' \
  -H 'accept: */*' \
  -H 'X-Authorization: <TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '[
    {
    "key": "dev",
    "value": "automation"
  },
  {
    "key": "backend",
    "value": "PR"
  }
]'

Response

Returns 200 OK, indicating that tags have been added to the secret.