dots.v2.tags.post()

Generated on 13 Nov 2026 from DoTs version v1.24.0

Usage

client.v2.tags.post(body: Tags, requestConfiguration?: RequestConfiguration<object>): Promise<undefined | TagsPostResponse>

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

lastTaggedUri 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

Droplets that are tagged with the specified tag.
Requires droplet:read scope.

Additional nested properties are not shown.

imgages object optional

Images that are tagged with the specified tag.
Requires image:read scope.

Additional nested properties are not shown.

volumes object optional

Volumes that are tagged with the specified tag.
Requires block_storage:read scope.

Additional nested properties are not shown.

volumeSnapshots object optional

Volume Snapshots that are tagged with the specified tag.
Requires block_storage_snapshot:read scope.

Additional nested properties are not shown.

databases object optional

Databases that are tagged with the specified tag.
Requires database:read scope.

Additional nested properties are not shown.

Request Sample

Show Request Sample
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";
import {
    createDigitalOceanClient,
    DigitalOceanApiKeyAuthenticationProvider,
} from "@digitalocean/dots";

const authProvider = new DigitalOceanApiKeyAuthenticationProvider(process.env.DIGITALOCEAN_TOKEN!);
const adapter = new FetchRequestAdapter(authProvider);
const client = createDigitalOceanClient(adapter);

const response = await client.v2.tags.post({
    name: "extra-awesome",
});

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.