---
title: "Initiate A Block Storage Action By Volume Name"
method: POST
path: "/v2/volumes/actions"
tags: ["DigitalOcean-public.v2-new_Block Storage Actions"]
---

# Initiate A Block Storage Action By Volume Name

`POST /v2/volumes/actions`

To initiate an action on a block storage volume by Name, send a POST request to
`~/v2/volumes/actions`. The body should contain the appropriate
attributes for the respective action.

## Attach a Block Storage Volume to a Droplet

| Attribute   | Details                                                             |
| ----------- | ------------------------------------------------------------------- |
| type        | This must be `attach`                                               |
| volume_name | The name of the block storage volume                                |
| droplet_id  | Set to the Droplet's ID                                             |
| region      | Set to the slug representing the region where the volume is located |

Each volume may only be attached to a single Droplet. However, up to fifteen
volumes may be attached to a Droplet at a time. Pre-formatted volumes will be
automatically mounted to Ubuntu, Debian, Fedora, Fedora Atomic, and CentOS
Droplets created on or after April 26, 2018 when attached. On older Droplets,
[additional configuration](https://docs.digitalocean.com/products/volumes/how-to/mount/)
is required.

## Remove a Block Storage Volume from a Droplet

| Attribute   | Details                                                             |
| ----------- | ------------------------------------------------------------------- |
| type        | This must be `detach`                                               |
| volume_name | The name of the block storage volume                                |
| droplet_id  | Set to the Droplet's ID                                             |
| region      | Set to the slug representing the region where the volume is located |

## Query parameters

- `per_page` integer
- `page` integer

## Request body

- union
  - VolumeActionPostAttach
    - `type` 'attach' | 'detach' | 'resize', required — The volume action to initiate.
    - `region` 'ams1' | 'ams2' | 'ams3' | 'blr1' | 'fra1' | 'lon1' | 'nyc1' | 'nyc2' | 'nyc3' | 'sfo1' | 'sfo2' | 'sfo3' | 'sgp1' | 'tor1' | 'syd1' — The slug identifier for the region where the resource will initially be available.
    - `droplet_id` integer, required — The unique identifier for the Droplet the volume will be attached or detached from.
    - `tags` string[], nullable — A flat array of tag names as strings to be applied to the resource. Tag names may be for either existing or new tags. <br><br>Requires `tag:create` scope.
  - VolumeActionPostDetach
    - `type` 'attach' | 'detach' | 'resize', required — The volume action to initiate.
    - `region` 'ams1' | 'ams2' | 'ams3' | 'blr1' | 'fra1' | 'lon1' | 'nyc1' | 'nyc2' | 'nyc3' | 'sfo1' | 'sfo2' | 'sfo3' | 'sgp1' | 'tor1' | 'syd1' — The slug identifier for the region where the resource will initially be available.
    - `droplet_id` integer, required — The unique identifier for the Droplet the volume will be attached or detached from.

## Response `202`

The response will be an object with a key called `action`. The value of this will be an object that contains the standard volume action attributes

- object
  - `action` VolumeAction
    - `type` string — This is the type of action that the object represents. For example, this could be "transfer" to represent the state of an image transfer action.
    - `resource_id` integer, nullable — A unique identifier for the resource that the action is associated with.
    - `id` integer — A unique numeric ID that can be used to identify and reference an action.
    - `status` 'in-progress' | 'completed' | 'errored' — The current status of the action. This can be "in-progress", "completed", or "errored".
    - `started_at` string, date-time — A time value given in ISO8601 combined date and time format that represents when the action was initiated.
    - `completed_at` string, date-time, nullable — A time value given in ISO8601 combined date and time format that represents when the action was completed.
    - `resource_type` string — The type of resource that the action is associated with.
    - `region` Region
      - `name` string, required — The display name of the region. This will be a full name that is used in the control panel and other interfaces.
      - `slug` string, required — A human-readable string that is used as a unique identifier for each region.
      - `features` string[], required — This attribute is set to an array which contains features available in this region
      - `available` boolean, required — This is a boolean value that represents whether new Droplets can be created in this region.
      - `sizes` string[], required — This attribute is set to an array which contains the identifying slugs for the sizes available in this region. sizes:read is required to view.
    - `region_slug` string, nullable — A human-readable string that is used as a unique identifier for each region.

## Other responses

- `401` — Authentication failed due to invalid credentials.
- `404` — The resource was not found.
- `429` — The API rate limit has been exceeded.
- `500` — There was a server error.
- `default` — There was an unexpected error.

---

[API](https://skmtc.net/digitalocean/apis/digitalocean-api.md) · [All operations](https://skmtc.net/digitalocean/apis/digitalocean-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/digitalocean/digitalocean-api/versions/cb3bf9b21459/schema)
