Method: projects.locations.functions.generateUploadUrl

Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: Once the function source code upload is complete, the used signed URL should be provided in functions.create or functions.patch request as a reference to the function source code.

When uploading source code to the generated signed URL, please follow these restrictions:

  • Source file type should be a zip file.
  • Source file size should not exceed 100MB limit.

When making a HTTP PUT request, these two headers need to be specified:

  • content-type: application/zip
  • x-goog-content-length-range: 0,104857600

HTTP request


Path parameters



The project and location in which the Google Cloud Storage signed URL should be generated, specified in the format projects/*/locations/*. It takes the form projects/{project_id}/locations/{location_id}.

Authorization requires the following Google IAM permission on the specified resource parent:

  • cloudfunctions.functions.sourceCodeSet

Request body

The request body must be empty.

Response body

If successful, the response body contains data with the following structure:

Response of GenerateSourceUploadUrl method.

JSON representation
  "uploadUrl": string


The generated Google Cloud Storage signed URL that should be used for a function source code upload. The uploaded file should be a zip archive which contains a function.

Authorization Scopes

Requires the following OAuth scope:


For more information, see the Authentication Overview.

Try it!

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Functions