v8

latestOpenAPI 3.0.0Apache 2.0raw.githubusercontent.com2025-10-165266542.4 MB
DigitalOcean-public.v2-new_Tags

Create a New Tag

To create a tag you can send a POST request to /v2/tags with a name attribute.

post/v2/tags

Request body

namestring

The name of the tag. Tags may contain letters, numbers, colons, dashes, and underscores. There is a limit of 255 characters per tag.

Note: Tag names are case stable, which means the capitalization you use when you first create a tag is canonical.

When working with tags in the API, you must use the tag's canonical capitalization. For example, if you create a tag named "PROD", the URL to add that tag to a resource would be https://api.digitalocean.com/v2/tags/PROD/resources (not /v2/tags/prod/resources).

Tagged resources in the control panel will always display the canonical capitalization. For example, if you create a tag named "PROD", you can tag resources in the control panel by entering "prod". The tag will still display with its canonical capitalization, "PROD".

Example request

{
  "name": "extra-awesome",
  "resources": {
    "count": 5,
    "last_tagged_uri": "https://api.digitalocean.com/v2/images/7555620",
    "droplets": {
      "count": 1,
      "last_tagged_uri": "https://api.digitalocean.com/v2/droplets/3164444"
    },
    "images": {
      "count": 1,
      "last_tagged_uri": "https://api.digitalocean.com/v2/images/7555620"
    },
    "volumes": {
      "count": 1,
      "last_tagged_uri": "https://api.digitalocean.com/v2/volumes/3d80cb72-342b-4aaa-b92e-4e4abb24a933"
    },
    "volume_snapshots": {
      "count": 1,
      "last_tagged_uri": "https://api.digitalocean.com/v2/snapshots/1f6f46e8-6b60-11e9-be4e-0a58ac144519"
    },
    "databases": {
      "count": 1,
      "last_tagged_uri": "https://api.digitalocean.com/v2/databases/b92438f6-ba03-416c-b642-e9236db91976"
    }
  }
}

Response

The response will be a JSON object with a key called tag. The value of this will be a tag object containing the standard tag attributes

Example response

{
  "tag": {
    "name": "extra-awesome",
    "resources": {
      "count": 0,
      "droplets": {
        "count": 0
      },
      "images": {
        "count": 0
      },
      "volumes": {
        "count": 0
      },
      "volume_snapshots": {
        "count": 0
      },
      "databases": {
        "count": 0
      }
    }
  }
}