- [Resource: MigrationToken](https://developers.google.com/android/management/reference/rest/v1/enterprises.migrationTokens#MigrationToken)
  - [JSON representation](https://developers.google.com/android/management/reference/rest/v1/enterprises.migrationTokens#MigrationToken.SCHEMA_REPRESENTATION)
- [ManagementMode](https://developers.google.com/android/management/reference/rest/v1/enterprises.migrationTokens#ManagementMode)
- [Methods](https://developers.google.com/android/management/reference/rest/v1/enterprises.migrationTokens#METHODS_SUMMARY)

## Resource: MigrationToken

A token to initiate the migration of a device from being managed by a third-party DPC to being managed by Android Management API. A migration token is valid only for a single device. See [the guide](https://developers.google.com/android/management/dpc-migration) for more details.

| JSON representation |
|---|
| ``` { "name": string, "value": string, "createTime": string, "userId": string, "deviceId": string, "managementMode": enum (`https://developers.google.com/android/management/reference/rest/v1/enterprises.migrationTokens#ManagementMode`), "policy": string, "additionalData": string, "device": string, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "expireTime": string, "ttl": string // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `name` | `string` Output only. The name of the migration token, which is generated by the server during creation, in the form `enterprises/{enterprise}/migrationTokens/{migrationToken}`. |
| `value` | `string` Output only. The value of the migration token. |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. Time when this migration token was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `userId` | `string` Required. Immutable. The user id of the Managed Google Play account on the device, as in the Play EMM API. This corresponds to the `userId` parameter in Play EMM API's [`Devices.get`](https://developers.google.com/android/work/play/emm-api/v1/devices/get#parameters) call. |
| `deviceId` | `string` Required. Immutable. The id of the device, as in the Play EMM API. This corresponds to the `deviceId` parameter in Play EMM API's [`Devices.get`](https://developers.google.com/android/work/play/emm-api/v1/devices/get#parameters) call. |
| `managementMode` | ``enum (`https://developers.google.com/android/management/reference/rest/v1/enterprises.migrationTokens#ManagementMode`)`` Required. Immutable. The management mode of the device or profile being migrated. |
| `policy` | `string` Required. Immutable. The name of the policy initially applied to the enrolled device, in the form `enterprises/{enterprise}/policies/{policy}`. |
| `additionalData` | `string` Immutable. Optional EMM-specified additional data. Once the device is migrated this will be populated in the `` `migrationAdditionalData` `` field of the Device resource. This must be at most 1024 characters. |
| `device` | `string` Output only. Once this migration token is used to migrate a device, the name of the resulting `https://developers.google.com/android/management/reference/rest/v1/enterprises.devices#Device` resource will be populated here, in the form `enterprises/{enterprise}/devices/{device}`. |
| The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `expireTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Immutable. The time when this migration token expires. This can be at most seven days from the time of creation. The migration token is deleted seven days after it expires. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `ttl` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` Input only. The time that this migration token is valid for. This is input-only, and for returning a migration token the server will populate the `https://developers.google.com/android/management/reference/rest/v1/enterprises.migrationTokens#MigrationToken.FIELDS.expire_time` field. This can be at most seven days. The default is seven days. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| End of mutually exclusive fields. ||

## ManagementMode

The management mode of the device or profile being migrated.

| Enums ||
|---|---|
| `MANAGEMENT_MODE_UNSPECIFIED` | This value must not be used. |
| `WORK_PROFILE_PERSONALLY_OWNED` | A work profile on a personally owned device. Supported only on devices running Android 9 and above. |
| `WORK_PROFILE_COMPANY_OWNED` | A work profile on a company-owned device. Supported only on devices running Android 11 and above. |
| `FULLY_MANAGED` | A fully-managed device. Supported only on devices running Android 9 and above. |

| ## Methods ||
|---|---|
| ### `https://developers.google.com/android/management/reference/rest/v1/enterprises.migrationTokens/create` | Creates a migration token, to migrate an existing device from being managed by the EMM's Device Policy Controller (DPC) to being managed by the Android Management API. |
| ### `https://developers.google.com/android/management/reference/rest/v1/enterprises.migrationTokens/get` | Gets a migration token. |
| ### `https://developers.google.com/android/management/reference/rest/v1/enterprises.migrationTokens/list` | Lists migration tokens. |