Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
HTTP request
POST https://cloudfunctions.googleapis.com/v1/{name}:generateDownloadUrl
Path parameters
Parameters
name
string
The name of function for which source code Google Cloud Storage signed URL should be generated. It takes the form projects/{project}/locations/{location}/functions/{function}.
Authorization requires the following IAM permission on the specified resource name:
cloudfunctions.functions.sourceCodeGet
Request body
The request body contains data with the following structure:
JSON representation
{"versionId": string}
Fields
versionId
string
The optional version of function. If not set, default, current version is used.
Response body
Response of functions.generateDownloadUrl method.
If successful, the response body contains data with the following structure:
JSON representation
{"downloadUrl": string}
Fields
downloadUrl
string
The generated Google Cloud Storage signed URL that should be used for function source code download.
[[["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-06-16 UTC."],[[["\u003cp\u003eThis API call generates a time-limited, signed URL for downloading the source code of a deployed Google Cloud function.\u003c/p\u003e\n"],["\u003cp\u003eThe HTTP request is a \u003ccode\u003ePOST\u003c/code\u003e operation to a specific endpoint, requiring a function name formatted as \u003ccode\u003eprojects/{project}/locations/{location}/functions/{function}\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe request body accepts an optional \u003ccode\u003eversionId\u003c/code\u003e to specify a version of the function; otherwise, the current version is used.\u003c/p\u003e\n"],["\u003cp\u003eThe successful response body contains a \u003ccode\u003edownloadUrl\u003c/code\u003e, which is the signed URL for downloading the function's source code from Google Cloud Storage.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization to use this API call requires \u003ccode\u003ecloudfunctions.functions.sourceCodeGet\u003c/code\u003e IAM permission on the function and the OAuth scope \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Method: projects.locations.functions.generateDownloadUrl\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.GenerateDownloadUrlResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nReturns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: \u003chttps://cloud.google.com/storage/docs/access-control/signed-urls\u003e\n\n### HTTP request\n\n`POST https://cloudfunctions.googleapis.com/v1/{name}:generateDownloadUrl`\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nResponse of `functions.generateDownloadUrl` method.\n\nIf successful, the response body contains data with the following structure:\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]