Issues a command to a device. The Operation resource returned contains a Command in its metadata field. Use the get operation method to get the status of the command.
HTTP request
POST https://androidmanagement.googleapis.com/v1/{name=enterprises/*/devices/*}:issueCommand
{ "type": enum (CommandType), "createTime": string, "duration": string, "userName": string, "errorCode": enum (CommandErrorCode), "newPassword": string, "resetPasswordFlags": [ enum (ResetPasswordFlag) ], // Union field params can be only one of the following: "clearAppsDataParams": { object (ClearAppsDataParams) }, "startLostModeParams": { object (StartLostModeParams) }, "stopLostModeParams": { object (StopLostModeParams) }, "addEsimParams": { object (AddEsimParams) }, "removeEsimParams": { object (RemoveEsimParams) }, "requestDeviceInfoParams": { object (RequestDeviceInfoParams) }, "wipeParams": { object (WipeParams) } // End of list of possible types for union field params. // Union field status can be only one of the following: "clearAppsDataStatus": { object (ClearAppsDataStatus) }, "startLostModeStatus": { object (StartLostModeStatus) }, "stopLostModeStatus": { object (StopLostModeStatus) }, "esimStatus": { object (EsimCommandStatus) }, "requestDeviceInfoStatus": { object (RequestDeviceInfoStatus) } // End of list of possible types for union field status. }
string (Timestamp format) The timestamp at which the command was created. The timestamp is automatically generated by the server.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".
duration
string (Duration format) The duration for which the command is valid. The command will expire if not executed by the device during this time. The default duration if unspecified is ten minutes. There is no maximum duration.A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
userName
string The resource name of the user that owns the device in the form enterprises/{enterpriseId}/users/{userId}. This is automatically generated by the server based on the device the command is sent to.
errorCode
enum (CommandErrorCode) If the command failed, an error code explaining the failure. This is not set when the command is cancelled by the caller. For reasoning about command errors, prefer fields in the following order (most preferred first): 1. Command-specific fields like clearAppsDataStatus, startLostModeStatus, or similar, if they exist. 2. This field, if set. 3. The generic error field in the Operation that wraps the command.
newPassword
string For commands of type RESET_PASSWORD, optionally specifies the new password. Note: The new password must be at least 6 characters long if it is numeric in case of Android 14 devices. Else the command will fail with INVALID_VALUE.
resetPasswordFlags[]
enum (ResetPasswordFlag) For commands of type RESET_PASSWORD, optionally specifies flags.
Union field params. Parameters specific to the command. Note that some commands do not use this, in particular LOCK, RESET_PASSWORD, REBOOT, and RELINQUISH_OWNERSHIP. In future these commands may use this as well.If this is set, then the fields new_password and reset_password_flags must not be set. params can be only one of the following:
clearAppsDataParams
object (ClearAppsDataParams) Parameters for the CLEAR_APP_DATA command to clear the data of specified apps from the device. See ClearAppsDataParams. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to CLEAR_APP_DATA. It is also acceptable to explicitly set type to CLEAR_APP_DATA.
startLostModeParams
object (StartLostModeParams) Parameters for the START_LOST_MODE command to put the device into lost mode. See StartLostModeParams. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to START_LOST_MODE. It is also acceptable to explicitly set type to START_LOST_MODE.
stopLostModeParams
object (StopLostModeParams) Parameters for the STOP_LOST_MODE command to take the device out of lost mode. See StopLostModeParams. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to STOP_LOST_MODE. It is also acceptable to explicitly set type to STOP_LOST_MODE.
addEsimParams
object (AddEsimParams) Optional. Parameters for the ADD_ESIM command to add an eSIM profile to the device. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to ADD_ESIM. It is also acceptable to explicitly set type to ADD_ESIM.
removeEsimParams
object (RemoveEsimParams) Optional. Parameters for the REMOVE_ESIM command to remove an eSIM profile from the device. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to REMOVE_ESIM. It is also acceptable to explicitly set type to REMOVE_ESIM.
object (WipeParams) Optional. Parameters for the WIPE command to wipe the device. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to WIPE. It is also acceptable to explicitly set type to WIPE.
Union field status. Status specific to the command. Note that some commands do not use this, in particular LOCK, RESET_PASSWORD, REBOOT, and RELINQUISH_OWNERSHIP. In future these commands may use this as well. status can be only one of the following:
Lock the device, as if the lock screen timeout had expired. For a work profile, if there is a separate work profile lock, this only locks the work profile, with one exception: on work profiles on an organization-owned device running Android 8, 9, or 10, this locks the entire device.
RESET_PASSWORD
Reset the user's password.
REBOOT
Reboot the device. Only supported on fully managed devices running Android 7.0 (API level 24) or higher.
RELINQUISH_OWNERSHIP
Removes the work profile and all policies from a company-owned Android 8.0+ device, relinquishing the device for personal use. Apps and data associated with the personal profile(s) are preserved. The device will be deleted from the server after it acknowledges the command.
CLEAR_APP_DATA
Clears the application data of specified apps. This is supported on Android 9 and above. Note that an application can store data outside of its application data, for example in external storage or in a user dictionary. See also clearAppsDataParams.
START_LOST_MODE
Puts the device into lost mode. Only supported on fully managed devices or organization-owned devices with a managed profile. See also startLostModeParams.
STOP_LOST_MODE
Takes the device out of lost mode. Only supported on fully managed devices or organization-owned devices with a managed profile. See also stopLostModeParams.
ADD_ESIM
Adds an eSIM profile to the device. This is supported on Android 15 and above. See also addEsimParams. To remove an eSIM profile, use the REMOVE_ESIM command. To determine what happens to the eSIM profile when a device is wiped, set wipeDataFlags in the policy. Note: To provision multiple eSIMs on a single device, it is recommended to introduce a delay of a few minutes between successive executions of the command.
REMOVE_ESIM
Removes an eSIM profile from the device. This is supported on Android 15 and above. See also removeEsimParams.
REQUEST_DEVICE_INFO
Request information related to the device.
WIPE
Wipes the device, via a factory reset for a company owned device, or by deleting the work profile for a personally owned device with work profile. The wipe only occurs once the device acknowledges the command. The command can be cancelled before then.
CommandErrorCode
A command error code. This is a read-only field populated by the server.
Enums
COMMAND_ERROR_CODE_UNSPECIFIED
There was no error.
UNKNOWN
An unknown error occurred.
API_LEVEL
The API level of the device does not support this command.
MANAGEMENT_MODE
The management mode (profile owner, device owner, etc.) does not support the command.
INVALID_VALUE
The command has an invalid parameter value.
UNSUPPORTED
The device doesn't support the command. Updating Android Device Policy to the latest version may resolve the issue.
ResetPasswordFlag
Flags that can be used for the RESET_PASSWORD command type.
Enums
RESET_PASSWORD_FLAG_UNSPECIFIED
This value is ignored.
REQUIRE_ENTRY
Don't allow other admins to change the password again until the user has entered it.
DO_NOT_ASK_CREDENTIALS_ON_BOOT
Don't ask for user credentials on device boot.
LOCK_NOW
Lock the device after password reset.
ClearAppsDataParams
Parameters associated with the [CLEAR_APP_DATA](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.CLEAR%5FAPP%5FDATA) command to clear the data of specified apps from the device.
JSON representation
{ "packageNames": [ string ] }
Fields
packageNames[]
string The package names of the apps whose data will be cleared when the command is executed.
StartLostModeParams
Parameters associated with the [START_LOST_MODE](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.START%5FLOST%5FMODE) command to put the device into lost mode. At least one of the parameters, not including the organization name, must be provided in order for the device to be put into lost mode.
object (UserFacingMessage) The message displayed to the user when the device is in lost mode.
lostPhoneNumber
object (UserFacingMessage) The phone number that will be called when the device is in lost mode and the call owner button is tapped.
lostEmailAddress
string The email address displayed to the user when the device is in lost mode.
lostStreetAddress
object (UserFacingMessage) The street address displayed to the user when the device is in lost mode.
lostOrganization
object (UserFacingMessage) The organization name displayed to the user when the device is in lost mode.
StopLostModeParams
This type has no fields.
Parameters associated with the [STOP_LOST_MODE](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.STOP%5FLOST%5FMODE) command to take the device out of lost mode.
AddEsimParams
Parameters associated with the [ADD_ESIM](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.ADD%5FESIM) command to add an eSIM profile to the device.
string Required. The activation code for the eSIM profile.
activationState
enum (ActivationState) Required. The activation state of the eSIM profile once it is downloaded.
ActivationState
The activation state of the eSIM profile once it is downloaded.
Enums
ACTIVATION_STATE_UNSPECIFIED
eSIM activation state is not specified. This defaults to the eSIM profile being NOT_ACTIVATED on personally-owned devices and ACTIVATED on company-owned devices.
ACTIVATED
The eSIM is automatically activated after downloading. Setting this as the activation state for personally-owned devices will result in the command being rejected.
NOT_ACTIVATED
The eSIM profile is downloaded but not activated. In this case, the user will need to activate the eSIM manually on the device.
RemoveEsimParams
Parameters associated with the [REMOVE_ESIM](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.REMOVE%5FESIM) command to remove an eSIM profile from the device.
JSON representation
{ "iccId": string }
Fields
iccId
string Required. ICC ID of the eSIM profile to be deleted.
RequestDeviceInfoParams
Parameters associated with the [REQUEST_DEVICE_INFO](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.REQUEST%5FDEVICE%5FINFO) command to get device related information.
enum (DeviceInfo) Required. Type of device information to be requested.
DeviceInfo
Type of device information to be requested.
Enums
DEVICE_INFO_UNSPECIFIED
This value is disallowed.
EID
Request the identifier for eSIM. The user will be asked to approve the disclosure of the information before the result can be returned. If the user doesn't approve the disclosure, USER_DECLINED will be returned. This is supported only for personally owned devices with work profiles and Android versions 13 and above.
WipeParams
Parameters associated with the [WIPE](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.WIPE) command to wipe the device.
enum (WipeDataFlag) Optional. Flags to determine what data to wipe.
wipeReason
object (UserFacingMessage) Optional. A short message displayed to the user before wiping the work profile on personal devices. This has no effect on company owned devices. The maximum message length is 200 characters.
ClearAppsDataStatus
Status of the [CLEAR_APP_DATA](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.CLEAR%5FAPP%5FDATA) command to clear the data of specified apps from the device.
map (key: string, value: object (PerAppResult)) The per-app results, a mapping from package names to the respective clearing result.An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
PerAppResult
The result of an attempt to clear the data of a single app.
enum (ClearingResult) The result of an attempt to clear the data of a single app.
ClearingResult
The result of an attempt to clear the data of a single app.
Enums
CLEARING_RESULT_UNSPECIFIED
Unspecified result.
SUCCESS
This app’s data was successfully cleared.
APP_NOT_FOUND
This app’s data could not be cleared because the app was not found.
APP_PROTECTED
This app’s data could not be cleared because the app is protected. For example, this may apply to apps critical to the functioning of the device, such as Google Play Store.
API_LEVEL
This app’s data could not be cleared because the device API level does not support this command.
StartLostModeStatus
Status of the [START_LOST_MODE](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.START%5FLOST%5FMODE) command to put the device into lost mode.
The status. See [StartLostModeStatus](/android/management/reference/rest/v1/enterprises.devices/issueCommand#StartLostModeStatus).
Enums
STATUS_UNSPECIFIED
Unspecified. This value is not used.
SUCCESS
The device was put into lost mode.
RESET_PASSWORD_RECENTLY
The device could not be put into lost mode because the admin reset the device's password recently.
USER_EXIT_LOST_MODE_RECENTLY
The device could not be put into lost mode because the user exited lost mode recently.
ALREADY_IN_LOST_MODE
The device is already in lost mode.
StopLostModeStatus
Status of the [STOP_LOST_MODE](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.STOP%5FLOST%5FMODE) command to take the device out of lost mode.
The status. See [StopLostModeStatus](/android/management/reference/rest/v1/enterprises.devices/issueCommand#StopLostModeStatus).
Enums
STATUS_UNSPECIFIED
Unspecified. This value is not used.
SUCCESS
The device was taken out of lost mode.
NOT_IN_LOST_MODE
The device is not in lost mode.
EsimCommandStatus
Status and error details (if present) of an [ADD_ESIM](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.ADD%5FESIM) or [REMOVE_ESIM](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.REMOVE%5FESIM) command.
JSON representation
{ "status": enum (Status), "esimInfo": { object (EsimInfo) }, // Union field status_details can be only one of the following: "internalErrorDetails": { object (InternalErrorDetails) } // End of list of possible types for union field status_details. }
Status of an [ADD_ESIM](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.ADD%5FESIM) or [REMOVE_ESIM](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.REMOVE%5FESIM) command.
Enums
STATUS_UNSPECIFIED
Unspecified. This value is not used.
SUCCESS
The eSIM operation was successfully performed on the device.
IN_PROGRESS
The eSIM operation is in progress.
PENDING_USER_ACTION
The user needs to take an action for the eSIM operation to proceed.
ERROR_SETUP_IN_PROGRESS
The eSIM operation cannot be executed when setup is in progress.
ERROR_USER_DENIED
The user has denied the eSIM operation.
INTERNAL_ERROR
An error has occurred while trying to add or remove the eSIM on the device, see internalErrorDetails.
ERROR_ICC_ID_NOT_FOUND
For a REMOVE_ESIM command, the iccId of the eSIM to be removed was not found on the device. This could either mean the eSIM does not belong to the enterprise or the eSIM corresponding to the iccId is not present on the device.
ERROR_MULTIPLE_ACTIVE_ESIMS_NO_AVAILABLE_SLOT
The ADD_ESIM command failed when attempting to add a new eSIM with its activation state set to ACTIVATED since multiple eSIM slots on the device contain active eSIM profiles and there is no free eSIM slot available. To resolve this, the new eSIM can be added with its activation state as NOT_ACTIVATED for later manual activation, or the user must first deactivate an existing active eSIM for the operation to proceed.
InternalErrorDetails
Internal error details if present for the [ADD_ESIM](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.ADD%5FESIM) or [REMOVE_ESIM](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.REMOVE%5FESIM) command.
The operation code detail corresponding to the [operationCode](/android/management/reference/rest/v1/enterprises.devices/issueCommand#InternalErrorDetails.FIELDS.operation%5Fcode).
Enums
OPERATION_CODE_DETAIL_UNSPECIFIED
Operation code detail is unspecified. The operationCode is not recognized by Android Management API. However, see operationCode.
See EuiccManager.OPERATION_SMDX_SUBJECT_REASON_CODE for details. Note that, in this case, errorCode is the least significant 3 bytes of the EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE specifying the subject code and the reason code as indicated here. The most significant byte of the integer is zeroed out. For example, a Subject Code of 8.11.1 and a Reason Code of 5.1 is represented in errorCode as 0000 0000 1000 1011 0001 0000 0101 0001 in binary, which is 9113681 in decimal.
Error code detail corresponding to the [errorCode](/android/management/reference/rest/v1/enterprises.devices/issueCommand#InternalErrorDetails.FIELDS.error%5Fcode).
Enums
ERROR_CODE_DETAIL_UNSPECIFIED
Error code detail is unspecified. The errorCode is not recognized by Android Management API. However, see errorCode
Status of the [REQUEST_DEVICE_INFO](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.REQUEST%5FDEVICE%5FINFO) command.
JSON representation
{ "status": enum (Status), // Union field device_info can be only one of the following: "eidInfo": { object (EidInfo) } // End of list of possible types for union field device_info. }
Union field device_info. Details of the device information requested by the admin. This is populated only when the status is SUCCEEDED. device_info can be only one of the following:
eidInfo
object (EidInfo) Information related to the EIDs of the device.
Status
Status of a [REQUEST_DEVICE_INFO](/android/management/reference/rest/v1/enterprises.devices/issueCommand#CommandType.ENUM%5FVALUES.REQUEST%5FDEVICE%5FINFO) command.
Enums
STATUS_UNSPECIFIED
Unspecified. This value is not used.
SUCCEEDED
Device information has been successfully delivered.
PENDING_USER_ACTION
The user has not completed the actions required to share device information.
USER_DECLINED
The user declined sharing device information.
UNSUPPORTED
The requested device info is not supported on this device, e.g. eSIM is not supported on the device.