Google Cloud Storage signed URLs: create safer upload and download links
A Google Cloud Storage signed URL is a temporary bearer link that permits a specified HTTP operation on one object for a limited time. Anyone who has the URL can perform its signed operation without signing in to a Google account, so signed URLs are useful for delegating short-lived uploads or downloads. Because the URL itself acts like a credential, keep its lifetime short and limit the object, HTTP method, and required headers.
Google Cloud Storage signed URLs: create safer upload and download links
A Google Cloud Storage signed URL is a temporary bearer link that permits a specified HTTP operation on one object for a limited time. Anyone who has the URL can perform its signed operation without signing in to a Google account, so signed URLs are useful for delegating short-lived uploads or downloads. Because the URL itself acts like a credential, keep its lifetime short and limit the object, HTTP method, and required headers.
This guide covers Cloud Storage V4 signed URLs: how they work, what permissions are required, how to create and use them with the CLI, and how to diagnose failures. Google Cloud documentation was checked on 22 November 2026. Features and CLI options can change; verify current documentation before use.
How a signed URL carries permission
A signed URL does not change a bucket or object’s public-access setting. Instead, the query string contains a signature and authentication details that let a specific request run with the signing principal’s authority for a limited period. Anyone who receives the URL can use it during that period. If it is forwarded or appears in logs or browser history, other people can use it too.
Signed URLs can access Cloud Storage resources only through XML API endpoints. A V4 signed URL can expire no later than 604,800 seconds, or seven days. In practice, allow only the time needed for the operation. A URL can also stop working before its expiry if the signing key is rotated or disabled.
V4 signing binds the HTTP method, object path, query parameters, and signed headers into a canonical request. If a request changes a signed parameter or header, signature verification fails. For example, a download URL cannot be used as an upload request, and a client may be rejected if it sends a different Content-Type from the one signed into the URL.
Separate the signer’s permissions from the URL holder’s access
The service account used to sign the URL needs permission to perform the operation the URL allows. A download needs permission to read the object; an upload needs permission to create it. Overwriting an existing object can also require delete permission. Google documents Storage Object Viewer for download-only URLs, Storage Object Creator for uploads that do not overwrite an existing object, and Storage Object User when both reading and writing or overwriting are needed.
The URL generator also needs permission to sign as that service account. In an impersonation workflow that does not use a key file, this requires iam.serviceAccounts.signBlob; the documented predefined role example is Service Account Token Creator. The service account’s object permissions and the URL generator’s signing permission are separate grants. Limit both to the necessary scope.
Create a download URL with the CLI
The V4 flow with Google Cloud CLI and a signing service account is easier to maintain than assembling the canonical request by hand. This example assumes the operator is already authenticated and impersonates the service account to create a download link:
gcloud storage sign-url gs://BUCKET_NAME/OBJECT_NAME \
--impersonate-service-account=SIGNER_SERVICE_ACCOUNT_EMAIL \
--duration=10mReplace BUCKET_NAME, OBJECT_NAME, and SIGNER_SERVICE_ACCOUNT_EMAIL with values from your environment. Review the generated expiration, HTTP verb (GET), and object path. The person running the command needs the impersonation and signing permissions; the signing service account needs permission to read the target object.
The client uses the URL as returned, for example:
curl 'SIGNED_URL'On success, the object data is returned in the response body. If the file is sensitive, do not paste the URL into chat, public tickets, or analytics logs. Send it over HTTPS and verify it no longer works after expiry.
Create an upload URL
An upload URL uses HTTP PUT to send a file to a specific object path. This example signs the Content-Type header too:
gcloud storage sign-url gs://BUCKET_NAME/OBJECT_NAME \
--impersonate-service-account=SIGNER_SERVICE_ACCOUNT_EMAIL \
--http-verb=PUT \
--duration=15m \
--headers=content-type=image/pngThe client must use the same HTTP method and signed header:
curl -X PUT \
-H 'Content-Type: image/png' \
--upload-file ./photo.png \
'SIGNED_URL'The URL applies only to the specified object path and method. Separately check whether the upload can overwrite an existing object and how bucket versioning or retention settings affect the result. If you need stronger upload constraints, such as limits on file size and content type, a signed policy document may be a better fit. It is a separate feature from a signed URL.
Choose an expiry and understand revocation
A signed URL is not necessarily a one-use link. Until it expires, matching requests can be repeated if they use the signed method, resource, headers, and query parameters. For upload links, consider whether the recipient can overwrite the same object repeatedly. Keep the lifetime short, use a distinct object name for each request, and add an application-side validation step after upload if needed.
Do not assume there is a per-URL revocation list after a link has been issued. The documented ways it can stop working include reaching its expiry or rotating the signing key. Key rotation can affect other URLs signed with that key, so do not use it as a routine per-link cancellation method. If a URL may have leaked, review its lifetime, granted operation, logs, and key-management process.
Troubleshoot failures in this order
**Expiry or clock error:** Check `X-Goog-Date`, `X-Goog-Expires`, and the client and server clocks. The maximum lifetime is seven days.
**403 permission error:** Confirm the signing service account can perform the object operation and the URL generator has `signBlob` permission.
**Signature mismatch:** Ensure the URL was not edited or re-encoded, and that the HTTP method, object path, signed query parameters, and headers match what was used to create it.
**Upload failure:** Check that `PUT`, `Content-Type`, and other signed headers match. Confirm whether overwriting the object requires additional permission. Also check bucket CORS when uploading directly from a browser.
**Unexpected access:** Remember that anyone with the URL can use it without signing in; examine where it may have been exposed and review access logs.
A signed URL is a way to delegate limited use of a service account’s authority, not a way to make anonymous public access safe. For sensitive data, combine a short expiry, least privilege, HTTPS in transit, careful handling of the URL, and object-access logging where needed.
Sources
[Cloud Storage signed URLs](https://docs.cloud.google.com/storage/docs/access-control/signed-urls)
[Create V4 signed URLs with Cloud Storage tools](https://docs.cloud.google.com/storage/docs/access-control/signing-urls-with-helpers)
[V4 signing process with your own program](https://docs.cloud.google.com/storage/docs/access-control/signing-urls-manually)
[Cloud Storage access control overview](https://docs.cloud.google.com/storage/docs/access-control)
[Canonical requests](https://docs.cloud.google.com/storage/docs/authentication/canonical-requests)