- [HTTP request](https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions/batchGet#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions/batchGet#body.PATH_PARAMETERS)
- [Query parameters](https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions/batchGet#body.QUERY_PARAMETERS)
- [Request body](https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions/batchGet#body.request_body)
- [Response body](https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions/batchGet#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions/batchGet#body.BatchGetSessionsResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions/batchGet#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions/batchGet#body.aspect_1)
- [Try it!](https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions/batchGet#try-it)

Retrieves multiple automation sessions in a single batch request.

Sessions are returned in the same order as the `names` in the request. If any of the requested sessions does not exist, the whole request fails with `NOT_FOUND` and no sessions are returned.

When calling this method over HTTP/REST with a large number of `names`, the request URL may exceed the maximum URL length (about 16 KB) and be rejected. In that case, send a `POST` request to the same URL with the `X-HTTP-Method-Override: GET` header and pass the request parameters in a JSON (`application/json`) or form-encoded (`application/x-www-form-urlencoded`) body. See [Long request URLs](https://docs.cloud.google.com/apis/docs/http#long_request_urls).

### HTTP request

`GET https://devicerun.googleapis.com/v1alpha/{parent=projects/*/locations/*}/sessions:batchGet`

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The parent resource shared by all sessions being retrieved. Format: `projects/{project}/locations/{location}`. The `parent` field in the `BatchGetSessionsRequest` message must match the `parent` of all `Session` resource names in `names`. It takes the form `projects/{project}/locations/{location}`. |

### Query parameters

| Parameters ||
|---|---|
| `names[]` | `string` Required. The names of the sessions to retrieve. A maximum of 500 sessions can be retrieved in a batch. Format: `projects/{project}/locations/{location}/sessions/{session}`. |

### Request body

The request body must be empty.

### Response body

Response including the requested sessions.

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

| JSON representation |
|---|
| ``` { "sessions": [ { object (`https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions#Session`) } ] } ``` |

| Fields ||
|---|---|
| `sessions[]` | ``object (`https://docs.cloud.google.com/developer-device-platform/reference/device-run/rest/v1alpha/projects.locations.sessions#Session`)`` The requested sessions, in the same order as the `names` in the request. |

### 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).

### IAM Permissions

Requires the following [IAM](https://docs.cloud.google.com/iam/docs) permission on the `parent` resource:

- `devicerun.sessions.get`

For more information, see the [IAM documentation](https://docs.cloud.google.com/iam/docs).