Stay organized with collectionsSave and categorize content based on your preferences.
Moves an object within a bucket.
This operation moves a source object to a destination object in the same bucket by renaming the object. The
move itself is an atomic transaction, ensuring all steps either
complete successfully or no changes are made.
The move operation performs the following actions:
The destination object is created with the same data and metadata as the
source object except for the following changes:
A new objectname
A newgeneration number
A newmetageneration number, set to1
Newcreateandupdatetimestamps
The destination object is moved to Standard storage if the bucket has
Autoclass enabled
If a destination folder doesn't exist, the move operation creates the folder along with
the destination object. The move operation also automatically creates any necessary parent folders.
Consider the following points when using themovemethod:
The source and destination must have different object names.
The source object must exist. You can only move existing objects.
If an object already exists at the destination, the move operation replaces the existing object. The replaced object will become noncurrent or soft-deleted depending on whether Object Versioning or soft delete is enabled. You can disable the replacement behavior using preconditions on the request.
Required permissions
The authenticated user must have the following IAM permissions to use this method:
Permissions required on the source object:
storage.objects.deleteandstorage.objects.get
or
storage.objects.move(required only to move an object without
allowing read or delete access)
Permissions required on the destination object:
storage.objects.create
storage.objects.delete(required only for replacing an object)
storage.folders.create(required only
for automatically creating any missing parent folders)
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
Name of the bucket containing the object you want to move.
sourceObject
string
Name of the source object. For information about how to URL encode object names to be path
safe, seeEncoding URI path parts.
destinationObject
string
Name of the new object. Required when the object metadata is not otherwise provided.
Overrides the object metadata'snamevalue, if any. For information about how
to URL encode object names to be path safe, seeEncoding URI path parts.
Optional query parameters
ifGenerationMatch
long
Makes the operation conditional on there being a live destination object with a generation
number that matches the given value. SettingifGenerationMatchto0makes the
operation succeed only if there is no live destination object.
ifGenerationNotMatch
long
Makes the operation conditional on there being a live destination object with a generation
number that does not match the given value. If no live destination object exists, the
precondition fails. SettingifGenerationNotMatchto0makes the operation
succeed if there is a live version of the object. TheifGenerationMatchandifGenerationNotMatchparameters are mutually exclusive.
Specifying both parameters in a single request results in an error.
ifMetagenerationMatch
long
Makes the operation conditional on there being a live destination object with a
metageneration number that matches the given value.
ifMetagenerationNotMatch
long
Makes the operation conditional on there being a live destination object with a
metageneration number that does not match the given value. TheifMetagenerationMatchandifMetagenerationNotMatchparameters are mutually exclusive.
Specifying both parameters in a single request result in an error.
ifSourceGenerationMatch
long
Makes the operation conditional on whether the source object's generation matches the
given value.
ifSourceGenerationNotMatch
long
Makes the operation conditional on whether the source object's generation does not match
the given value. TheifSourceGenerationMatchandifSourceGenerationNotMatchparameters are mutually exclusive.
Specifying both parameters in a single request result in an error.
ifSourceMetagenerationMatch
long
Makes the operation conditional on whether the source object's current metageneration
matches the given value.
ifSourceMetagenerationNotMatch
long
Makes the operation conditional on whether the source object's current metageneration
does not match the given value. TheifSourceMetagenerationMatchandifSourceMetagenerationNotMatchparameters are mutually exclusive.
Specifying both parameters in a single request result in an error.
projection
string
Set of properties to return. Defaults tonoAcl, unless the object resource specifies theaclproperty, when it defaults tofull.
Acceptable values are:
full: Include all properties.
noAcl: Omit the owner, acl property.
Request body
Do not supply a request body with this method.
Response
If successful, this method returns the destination object'sresourcein the response
body.
Likewise, if a live object already exists at the destination and it is subject to either aobject retention policyorbucket retention policy, the request fails with a403 Forbiddenerror with the reasonretentionPolicyNotMet.
For information about status and error codes returned by this API, see thereference page.
Try it!
Use the APIs Explorer below to call this method on live data and see the response.
[[["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,["# Objects: move\n\nMoves an object within a bucket.\n\nThis operation moves a source object to a destination object in the same bucket by renaming the object. The\nmove itself is an atomic transaction, ensuring all steps either\ncomplete successfully or no changes are made.\n\nThe move operation performs the following actions:\n\n1. The source object is deleted as follows:\n - No early deletion fee is incurred.\n - [Soft delete](/storage/docs/soft-delete) retention period is not applied.\n - [Audit logs](/storage/docs/audit-logging) and [notification messages](/storage/docs/pubsub-notifications) are generated for the object.\n2. The destination object is created with the same data and metadata as the source object except for the following changes:\n - A new object `name`\n - A new `generation number`\n - A new `metageneration number`, set to `1`\n - New `create` and `update` timestamps\n - The destination object is moved to Standard storage if the bucket has Autoclass enabled\n3. If a destination folder doesn't exist, the move operation creates the folder along with the destination object. The move operation also automatically creates any necessary parent folders.\n\nConsider the following points when using the `move` method:\n\n- The source and destination must have different object names.\n- The source object must exist. You can only move existing objects.\n- If an object already exists at the destination, the move operation replaces the existing object. The replaced object will become noncurrent or soft-deleted depending on whether Object Versioning or soft delete is enabled. You can disable the replacement behavior using preconditions on the request.\n\nRequired permissions\n--------------------\n\nThe authenticated user must have the following IAM permissions to use this method:\n\n- Permissions required on the source object:\n - `storage.objects.delete` and `storage.objects.get`\n *or*\n - `storage.objects.move` (required only to move an object without allowing read or delete access)\n- Permissions required on the destination object:\n - `storage.objects.create`\n - `storage.objects.delete` (required only for replacing an object)\n - `storage.folders.create` (required only for automatically creating any missing parent folders)\n - `storage.objects.getIamPolicy` (only required if `projection` is `full` and the relevant bucket has [uniform bucket-level access disabled](/storage/docs/uniform-bucket-level-access))\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://storage.googleapis.com/storage/v1/b/bucket/o/sourceObject/moveTo/o/destinationObject\n```\n\nIn addition to [standard query parameters](/storage/docs/json_api/v1/parameters#query),\nthe following query 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 the destination object's\n[resource](/storage/docs/json_api/v1/objects#resource) in the response\nbody.\n\nThe following errors could occur:\n\n- If the source object is subject to either a [object retention policy](/storage/docs/object-retention-policy) or [bucket retention policy](/storage/docs/bucket-retention-policy), the request fails with a `403 Forbidden error` with the reason `retentionPolicyNotMet`.\n- Likewise, if a live object already exists at the destination and it is subject to either a [object retention policy](/storage/docs/object-retention-policy) or [bucket retention policy](/storage/docs/bucket-retention-policy), the request fails with a `403 Forbidden` error with the reason `retentionPolicyNotMet`.\n\nFor information about status and error codes returned by this API, see the\n[reference page](/storage/docs/json_api/v1/status-codes).\n\nTry it!\n-------\n\nUse the APIs Explorer below to call this method on live data and see the response."]]