Generate a pre-signed upload URL
POST/api/v1/storage/generate-upload-url
Step 1: issues a time-limited signed URL for direct upload. sizeBytes is checked against current tracked quota and used as the signed upper size bound; it is not an atomic reservation or an exact-size assertion. Send the returned required headers, upload, and then register the returned fileId. The URL can be reused until expiry; treat it as a credential.
The following access conditions are preserved as declared intent and are not implemented by generated code: Accepted storage owner context, Storage owner actor routing.
Use this in a guide: Add file attachments to a support request · Organize a customer’s project documents · Summarize a customer’s uploaded report · Build a signed-in support chat that survives reconnects
Request
Responses
- 200
Upload URL generated
Request a signed upload for the six bytes Hello plus newline; send the returned required headers during upload.
Section ID: DOC-CP-files-data-api-generateUploadUrl#example-storage-generateUploadUrl-request
Request example
{
"folderPath": "reports",
"fileName": "welcome.txt",
"contentType": "text/plain",
"sizeBytes": "6",
"expiresSeconds": 900
}
Guide request for Upload and confirm the recording. Replace example resource identifiers with your own authorized values.
Section ID: DOC-CP-files-data-api-generateUploadUrl#example-cookbook-core-platform-files-data-files-01-request
Request example
{
"folderPath": "/media",
"fileName": "video.mp4",
"contentType": "video/mp4",
"sizeBytes": 52428800,
"expiresSeconds": 3600
}
Illustrative response shape; omitted default fields and actual outcomes depend on the operation.
Section ID: DOC-CP-files-data-api-generateUploadUrl#example-storage-generateUploadUrl-response
Response example
{
"url": "https://example.com/resource",
"fileId": "example_123",
"fullPath": "documents/example.txt",
"requiredHeaders": {}
}
Illustrative response for Upload and confirm the recording. Replace example resource identifiers with your own authorized values.
Section ID: DOC-CP-files-data-api-generateUploadUrl#example-cookbook-core-platform-files-data-files-json-01-response
Response example
{
"url": "https://storage.googleapis.com/bucket/...",
"fileId": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
"fullPath": "/media/video.mp4",
"requiredHeaders": {
"content-type": "video/mp4",
"x-goog-content-length-range": "0,52428800"
}
}
Document ID: DOC-CP-files-data-api-generateUploadUrl. Section identities and revisions.
| Section | Stable reference |
|---|---|
| Generate a pre-signed upload URL | DOC-CP-files-data-api-generateUploadUrl#overview |
| Request | DOC-CP-files-data-api-generateUploadUrl#request |
| Responses | DOC-CP-files-data-api-generateUploadUrl#responses |