POST/v2/volumes/actions

Trigger a block storage volume action by name

Triggers an attach or detach action on a block storage volume identified by name. Set type to attach or detach and provide the volume, Droplet, and region details for the action. Use page and per_page to paginate the results.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

2 parameters · 4 body fields
per_pageintegeroptional
Number of items to return per page. Must be between 1 and 200. Defaults to 20 when omitted.
Default:20
pageintegeroptional
Page number to return. Must be at least 1. Defaults to 1 when omitted.
Default:1

Details for attaching or detaching a block storage volume from a Droplet.

typestringrequired
The volume action to initiate.
Allowed:attachdetachresize
regionstringoptional
The slug identifier for the region where the resource will initially be available.
Allowed:ams1ams2ams3blr1fra1lon1nyc1nyc2nyc3sfo1sfo2sfo3
droplet_idintegerrequired
The unique identifier for the Droplet the volume will be attached or detached from.
tagsarray<string>optional
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.

6 status codes
202Returns an object with an `action` property containing the standard volume action attributes.
actionobjectoptional
401Returned when authentication fails because the credentials are invalid.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
404Returned when the requested resource is not found.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
429Returned when the API rate limit has been exceeded.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
500Returned when a server error occurs.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
defaultThere was an unexpected error.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

Error handling

A 401 is returned when authentication fails; a 404 is returned when the requested volume or target resource is not found; a 429 is returned when the API rate limit is exceeded; and a 500 is returned when a server error occurs. type must be attach or detach, and the action must include the required volume and Droplet details.