---
title: "PATCH /v1/projects/{projectsId}/deviceSessions/{deviceSessionsId}"
method: PATCH
path: "/v1/projects/{projectsId}/deviceSessions/{deviceSessionsId}"
tags: ["projects"]
---

# PATCH /v1/projects/{projectsId}/deviceSessions/{deviceSessionsId}

`PATCH /v1/projects/{projectsId}/deviceSessions/{deviceSessionsId}`

## Request

- Base URL: `https://testing.googleapis.com`
- URL: `https://testing.googleapis.com/v1/projects/{projectsId}/deviceSessions/{deviceSessionsId}`
- Auth: OAuth 2 and OAuth 2
  - Implicit: `https://accounts.google.com/o/oauth2/auth`
  - Scopes: `https://www.googleapis.com/auth/cloud-platform`
  - Authorization code: `https://accounts.google.com/o/oauth2/auth`
  - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`

PATCH /v1/projects/{projectId}/deviceSessions/deviceSessionId}:updateDeviceSession Updates the current device session to the fields described by the update_mask.

## Path parameters

- `projectsId` string, required
- `deviceSessionsId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string
- `updateMask` string, google-fieldmask

## Request body

- DeviceSession: Protobuf message describing the device message, used from several RPCs.
  - `activeStartTime` string, google-datetime: Output only. The timestamp that the session first became ACTIVE.
  - `androidDevice` AndroidDevice: A single Android device.
    - `androidModelId` string: Required. The id of the Android device to be used. Use the TestEnvironmentDiscoveryService to get supported options.
    - `androidVersionId` string: Required. The id of the Android OS version to be used. Use the TestEnvironmentDiscoveryService to get supported options.
    - `locale` string: Required. The locale the test device used for testing. Use the TestEnvironmentDiscoveryService to get supported options.
    - `orientation` string: Required. How the device is oriented during the test. Use the TestEnvironmentDiscoveryService to get supported options.
  - `createTime` string, google-datetime: Output only. The time that the Session was created.
  - `displayName` string: Output only. The title of the DeviceSession to be presented in the UI.
  - `expireTime` string, google-datetime: Optional. If the device is still in use at this time, any connections will be ended and the SessionState will transition from ACTIVE to FINISHED.
  - `inactivityTimeout` string, google-duration: Output only. The interval of time that this device must be interacted with before it transitions from ACTIVE to TIMEOUT_INACTIVITY.
  - `name` string: Optional. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
  - `state` 'SESSION_STATE_UNSPECIFIED' | 'REQUESTED' | 'PENDING' | 'ACTIVE' | 'EXPIRED' | 'FINISHED' | 'UNAVAILABLE' | 'ERROR': Output only. Current state of the DeviceSession.
  - `stateHistories` SessionStateEvent[]: Output only. The historical state transitions of the session_state message including the current session state.
    - `eventTime` string, google-datetime: Output only. The time that the session_state first encountered that state.
    - `sessionState` 'SESSION_STATE_UNSPECIFIED' | 'REQUESTED' | 'PENDING' | 'ACTIVE' | 'EXPIRED' | 'FINISHED' | 'UNAVAILABLE' | 'ERROR': Output only. The session_state tracked by this event
    - `stateMessage` string: Output only. A human-readable message to explain the state.
  - `ttl` string, google-duration: Optional. The amount of time that a device will be initially allocated for. This can eventually be extended with the UpdateDeviceSession RPC. Default: 15 minutes.

## Response `200`

Successful response

- DeviceSession: Protobuf message describing the device message, used from several RPCs.
  - `activeStartTime` string, google-datetime: Output only. The timestamp that the session first became ACTIVE.
  - `androidDevice` AndroidDevice: A single Android device.
    - `androidModelId` string: Required. The id of the Android device to be used. Use the TestEnvironmentDiscoveryService to get supported options.
    - `androidVersionId` string: Required. The id of the Android OS version to be used. Use the TestEnvironmentDiscoveryService to get supported options.
    - `locale` string: Required. The locale the test device used for testing. Use the TestEnvironmentDiscoveryService to get supported options.
    - `orientation` string: Required. How the device is oriented during the test. Use the TestEnvironmentDiscoveryService to get supported options.
  - `createTime` string, google-datetime: Output only. The time that the Session was created.
  - `displayName` string: Output only. The title of the DeviceSession to be presented in the UI.
  - `expireTime` string, google-datetime: Optional. If the device is still in use at this time, any connections will be ended and the SessionState will transition from ACTIVE to FINISHED.
  - `inactivityTimeout` string, google-duration: Output only. The interval of time that this device must be interacted with before it transitions from ACTIVE to TIMEOUT_INACTIVITY.
  - `name` string: Optional. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
  - `state` 'SESSION_STATE_UNSPECIFIED' | 'REQUESTED' | 'PENDING' | 'ACTIVE' | 'EXPIRED' | 'FINISHED' | 'UNAVAILABLE' | 'ERROR': Output only. Current state of the DeviceSession.
  - `stateHistories` SessionStateEvent[]: Output only. The historical state transitions of the session_state message including the current session state.
    - `eventTime` string, google-datetime: Output only. The time that the session_state first encountered that state.
    - `sessionState` 'SESSION_STATE_UNSPECIFIED' | 'REQUESTED' | 'PENDING' | 'ACTIVE' | 'EXPIRED' | 'FINISHED' | 'UNAVAILABLE' | 'ERROR': Output only. The session_state tracked by this event
    - `stateMessage` string: Output only. A human-readable message to explain the state.
  - `ttl` string, google-duration: Optional. The amount of time that a device will be initially allocated for. This can eventually be extended with the UpdateDeviceSession RPC. Default: 15 minutes.

---

[API](https://skmtc.dev/google/apis/testing.md) - [All operations](https://skmtc.dev/google/apis/testing/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/testing/revisions/fe5d421501fc?raw)
