- [HTTP request](https://docs.cloud.google.com/run/docs/reference/rest/v2/projects.locations.sourceUploads/upload#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/run/docs/reference/rest/v2/projects.locations.sourceUploads/upload#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/run/docs/reference/rest/v2/projects.locations.sourceUploads/upload#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/run/docs/reference/rest/v2/projects.locations.sourceUploads/upload#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/run/docs/reference/rest/v2/projects.locations.sourceUploads/upload#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/run/docs/reference/rest/v2/projects.locations.sourceUploads/upload#body.aspect)

Uploads a source archive to a Google Cloud Storage bucket through Cloud Run. The uploaded source object should be used for Cloud Run resource deployments. User is responsible for managing the lifecycle of the uploaded object. If uploading through the Cloud Run API to Cloud Storage is not desired, you can use the IAM Deny Policy to deny the `run.locations.uploadSource` permission for all principals.

### HTTP request

- Upload URI, for media upload requests:  
  `POST https://run.googleapis.com/upload/v2/{parent}:uploadSource`
- Metadata URI, for metadata-only requests:  
  `POST https://run.googleapis.com/v2/{parent}:uploadSource`

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The project and location in which the source archive should be uploaded to, specified in the format `projects/*/locations/*`. It takes the form `projects/{project}/locations/{location}`. Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `parent`: - `run.locations.uploadSource` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { // Union field `target` can be only one of the following: "service": string // End of list of possible types for union field `target`. } ``` |

| Fields ||
|---|---|
| Union field `target`. The Cloud Run resource the upload source archive will be used for. `target` can be only one of the following: ||
| `service` | `string` The name of Cloud Run Service upload source archive will be used for. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/run/docs/reference/rest/v2/projects.locations.sourceUploads#UploadSourceResponse`.

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).