To see an example of how to include query parameters in a request, see theJSON API Overviewpage.
Parameters
Parameter name
Value
Description
Path parameters
bucket
string
The parent bucket of the folder.
sourcePath
string
The URL-encoded name of the source folder, expressed as a path. For example,src-folder/,
URL-encoded assrc-folder%2F.
destinationPath
string
The URL-encoded name of the destination folder, expressed as a path. For example,dest-folder/,
URL-encoded asdest-folder%2F.
Optional query parameters
ifMetagenerationMatch
long
If set, only rename the folder if the source folder's metageneration matches this value.
ifMetagenerationNotMatch
long
If set, only rename the folder if the source folder's metageneration doesn't match this value.
Request body
Do not supply a request body with this method.
Response
If successful, this method returns an instance of thelong-running operationin the response body:
{
"name": "string",
"metadata": {object},
"done":boolean,
// Result can include either an error or response:
"error": {object(Status)},
"response": {object(Folder)}
}
Property name
Value
Description
name
string
The server-assigned name of the operation.
metadata
object
An object of typegoogle.storage.control.v2.RenameFolderMetadata:
sourceFolderIdis the path of the folder you want to rename.
destinationFolderIdis the new name you want to give the folder.
createTimeis the time when the operation started.
endTimeis the time when the operation finished, regardless of whether it
succeeded or failed.
updateTimeis the time when the metadata was last updated.
typeis the operation type. For rename folder operations, this is alwaysrename-folder.
requestedCancellationidentifies whether the user has requested cancellation of the operation.
progressPercentindicates the operation's progress as a percentage, ranging
from 0 (not started) to 100 (completed). The value -1 means the progress is unknown.
done
boolean
Iffalse, indicates that the operation is still in progress, and neithererrornorresponseis set. Iftrue, it indicates that the operation is completed and eithererrororresponseis set.
error
object
If the operation fails, this field is returned in the response body and contains the error details. The rename operation fails
if any of the child folders exceed either the maximum folder name length limit
or maximum folder depth limit. For information about folder name length and folder depth limits, seeConsiderations. If a failure occurs, the folders are reverted to their original
state prior to the rename attempt. For information about status and error codes returned by this API, see thereference page.
response
object
If the operation succeeds, an object of typegoogle.storage.control.v2.Folderis returned.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Folder: rename\n\nRenames a folder within a bucket with hierarchical namespace enabled.\nFor details about how the rename operation works, see [Rename folders](/storage/docs/rename-hns-folders).\n\nRequired permissions\n--------------------\n\nThe authenticated user must have the following IAM permissions to use this method:\n\n- `storage.folders.rename`\n - This permission is needed to rename the source folder.\n- `storage.folders.create`\n - This permission is needed to create the destination folder.\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://storage.googleapis.com/storage/v1/b/bucket/folders/sourcePath/renameTo/folders/destinationPath\n```\n\nIn addition to [standard query parameters](/storage/docs/json_api/v1/parameters#query),\nthe following parameters apply to this method.\n\nTo see an example of how to include query parameters in a request, see the\n[JSON API Overview](/storage/docs/json_api#query_parameters) page.\n\n### Parameters\n\n### Request body\n\nDo not supply a request body with this method.\n\nResponse\n--------\n\nIf successful, this method returns an instance of the\n[long-running operation](https://github.com/googleapis/googleapis/blob/master/google/longrunning/operations.proto)\nin the response body: \n\n```\n{\n \"name\": \"string\",\n \"metadata\": {object},\n \"done\": boolean,\n // Result can include either an error or response:\n \"error\": {object (Status)},\n \"response\": {object (Folder)}\n}\n```\n\nTry it!\n-------\n\n\nUse the APIs Explorer below to call this method on live data and see the response."]]