# Method: media.upload

- [HTTP request](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/media/upload#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/media/upload#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/media/upload#body.request_body)
- [Response body](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/media/upload#body.response_body)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/media/upload#body.Media.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/media/upload#body.aspect)
- [Try it!](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/media/upload#try-it)

Uploads media for indexing.

The upload endpoint supports direct and resumable upload protocols and is intended for large items that can not be [inlined during index requests](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/indexing.datasources.items#itemcontent). To index large content:

1. Call `https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/indexing.datasources.items/upload#google.apps.search.v1.ItemsService.StartUploadItem` with the item name to begin an upload session and retrieve the `https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/indexing.datasources.items#UploadItemRef`.
2. Call media.upload to upload the content, as a streaming request, using the same resource name from the UploadItemRef from step 1.
3. Call `https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/indexing.datasources.items/index_#google.apps.search.v1.ItemsService.IndexItem` to index the item. Populate the [ItemContent](https://developers.google.com/cloud-search/docs/reference/rest/v1/indexing.datasources.items#ItemContent) with the UploadItemRef from step 1.

For additional information, see [Create a content connector using the REST API](https://developers.google.com/workspace/cloud-search/docs/guides/content-connector#rest).

**Note:** This API requires a service account to execute.

### HTTP request

- Upload URI, for media upload requests:  
  `POST https://cloudsearch.googleapis.com/upload/v1/media/{resourceName=**}`
- Metadata URI, for metadata-only requests:  
  `POST https://cloudsearch.googleapis.com/v1/media/{resourceName=**}`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `resourceName` | `string` Name of the media that is being downloaded. See `ReadRequest.resource_name`. |

### Request body

The request body contains an instance of `https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/media/upload#body.Media`.

### Response body

Media resource.

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

| JSON representation |
|---|
| ``` { "resourceName": string } ``` |

| Fields ||
|---|---|
| `resourceName` | `string` Name of the media resource. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud_search.indexing`
- `https://www.googleapis.com/auth/cloud_search`

For more information, see the [Authorization guide](https://developers.google.com/workspace/guides/configure-oauth-consent).