pydo.tags.create()

Generated on 8 May 2026 from pydo version v0.34.0

Usage

client.tags.create(
    body={
        "name": "extra-awesome",
    },
)
Returns JSONRaises HttpResponseError

Description

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

Parameters

name string optional

Example: extra-awesome

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".

Max length: 255

resources object optional read-only

Example: {'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'}}

An embedded object containing key value pairs of resource type and resource statistics.
It also includes a count of the total number of resources tagged with the current tag as well as a last_tagged_uri attribute set to the last resource tagged with the current tag.

This will only include resources that you are authorized to see. For example, to see tagged Droplets, include the droplet:read scope.

Show child properties
count integer optional

Example: 5

The number of tagged objects for this type of resource.

Min: 0

last_tagged_uri string optional

Example: https://api.digitalocean.com/v2/images/7555620

The URI for the last tagged object for this type of resource.

droplets object optional
Show child properties
count integer optional

Example: 5

The number of tagged objects for this type of resource.

Min: 0

last_tagged_uri string optional

Example: https://api.digitalocean.com/v2/images/7555620

The URI for the last tagged object for this type of resource.

imgages object optional
Show child properties
count integer optional

Example: 5

The number of tagged objects for this type of resource.

Min: 0

last_tagged_uri string optional

Example: https://api.digitalocean.com/v2/images/7555620

The URI for the last tagged object for this type of resource.

volumes object optional
Show child properties
count integer optional

Example: 5

The number of tagged objects for this type of resource.

Min: 0

last_tagged_uri string optional

Example: https://api.digitalocean.com/v2/images/7555620

The URI for the last tagged object for this type of resource.

volume_snapshots object optional
Show child properties
count integer optional

Example: 5

The number of tagged objects for this type of resource.

Min: 0

last_tagged_uri string optional

Example: https://api.digitalocean.com/v2/images/7555620

The URI for the last tagged object for this type of resource.

databases object optional
Show child properties
count integer optional

Example: 5

The number of tagged objects for this type of resource.

Min: 0

last_tagged_uri string optional

Example: https://api.digitalocean.com/v2/images/7555620

The URI for the last tagged object for this type of resource.

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {"name": "extra-awesome"}

resp = client.tags.create(body=req)

Response Example

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

More Information

See /v2/tags in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.