Favicon

You are here: Home > API Reference > Android > Commands > Create device command

Create device command

Required Permission: mdm.android.command.create

Creates and queues a new management command for execution on the target device.

POST
/v1/organizations/:organizationId/mdm/android/enterprise/devices/:emmDeviceId/commands/
Copy to clipboard

Create device command

Required Permission: mdm.android.command.create

Creates and queues a new management command for execution on the target device.

Request

Add parameter in header authorization
Example: Authorization: Bearer <token>
organizationId string
required
Match pattern: ^(([a-fA-F0-9]{24})|([a-zA-Z0-9\\-]{3,}))$
emmDeviceId string
required
Also support serialNumber, IMEI or enrollmentSpecificId obtained with method getEnrollmentTokenId
Match pattern: ^(([a-fA-F0-9]{24})|(\w{1,}))$
Body Params application/json
type string required
Management operation type specifying the action to execute on target device such as lock, reboot, password reset, or lost mode control.
LOCK RESET_PASSWORD REBOOT START_LOST_MODE STOP_LOST_MODE RELINQUISH_OWNERSHIP ADD_ESIM REMOVE_ESIM CLEAR_APP_DATA
duration string optional
Time duration specification for time-bound commands like lost mode defining how long the operation remains active before automatic expiration.
≤ 256 characters
newPassword string optional
New password value for RESET_PASSWORD commands setting the device unlock credential while adhering to device policy complexity requirements.
≤ 256 characters
resetPasswordFlags array [string] optional
Array of behavioral flags controlling password reset execution such as requiring immediate entry or locking device after reset.
startLostModeParams object optional
Configuration parameters for START_LOST_MODE command including message text, phone number, and location tracking settings.
clearAppsDataParams object optional
Configuration parameters for CLEAR_APP_DATA command specifying which application packages should have their data cleared.
stopLostModeParams object optional
Configuration parameters for STOP_LOST_MODE command controlling how lost mode is deactivated and normal device operation restored.
addEsimParams object optional
Configuration parameters for ADD_ESIM command providing carrier profile download information and activation codes for eSIM provisioning.
removeEsimParams object optional
Configuration parameters for REMOVE_ESIM command specifying which eSIM profile to delete from the device.
{
    "type": "LOCK",
    "duration": "3600s",
    "newPassword": "NewSecureP@ss123",
    "resetPasswordFlags": [
        "REQUIRE_ENTRY",
        "LOCK_NOW"
    ],
    "startLostModeParams": {
        "lostMessage": {
            "defaultMessage": "This device is lost. Please contact owner."
        },
        "lostPhoneNumber": {
            "defaultMessage": "+1-555-0123"
        }
    },
    "clearAppsDataParams": {
        "packageNames": [
            "com.example.app"
        ]
    },
    "stopLostModeParams": {},
    "addEsimParams": {
        "carrierName": "Acme Mobile",
        "activationCode": "LPA: 1$carrier.com$activation-code"
    },
    "removeEsimParams": {
        "iccid": "89012345678901234567"
    }
}

Responses

200 Response application/json
status boolean optional
data object optional
id string optional
Unique identifier for the command record enabling tracking of individual device management operations across their full execution lifecycle.
Match pattern: ^[a-fA-F0-9]{24}$
organization string optional
Reference to the organization owning this command providing organizational context and access control boundaries for device management operations.
Match pattern: ^[a-fA-F0-9]{24}$
emmEnterprise string optional
Reference to the Android Enterprise configuration under which this command executes linking operations to Google Android Management API resources.
Match pattern: ^[a-fA-F0-9]{24}$
mdmUser string optional
Reference to the mobile device user associated with the target device enabling user-specific command tracking and attribution.
Match pattern: ^[a-fA-F0-9]{24}$
status string optional
Current execution state of the command indicating whether operation is queued, completed, or canceled affecting subsequent action availability.
DONE PENDING CANCEL
config object optional
Command configuration object containing Google Android Management API response data including metadata and execution details.
metadata object optional
Command metadata object containing execution details such as operation type, timestamps, and initiating user information.
@type string optional
Google API type identifier specifying the schema version for command metadata structure used for protocol versioning.
≤ 256 characters
type string optional
Command operation type defining the specific management action to execute such as lock, reboot, or password reset.
LOCK RESET_PASSWORD REBOOT START_LOST_MODE STOP_LOST_MODE RELINQUISH_OWNERSHIP ADD_ESIM REMOVE_ESIM CLEAR_APP_DATA
createTime string optional
ISO 8601 timestamp when Google Android Management API received and registered the command for execution tracking.
Format: date-time
duration string optional
Command duration specification defining time constraints or validity period for operations like lost mode activation.
≤ 128 characters
userName string optional
Email or identifier of the administrator who initiated the command providing attribution for audit trails and compliance reporting.
≤ 256 characters
done boolean optional
Boolean flag indicating whether command execution completed successfully enabling status polling and workflow automation triggers.
_config object optional
Raw command configuration object from Google Android Management API preserved for debugging and advanced troubleshooting by administrators.
updatedAt string optional
Timestamp recording the most recent command state modification enabling change tracking and execution progress monitoring.
Format: date-time
createdAt string optional
Timestamp marking command creation establishing audit trail foundation and enabling time-based filtering for operational analysis.
Format: date-time
{
    "status": true,
    "data": {
        "id": "507f1f77bcf86cd799439011",
        "organization": "507f1f77bcf86cd799439012",
        "emmEnterprise": "507f1f77bcf86cd799439013",
        "mdmUser": "507f1f77bcf86cd799439014",
        "status": "PENDING",
        "config": {
            "metadata": {
                "@type": "type.googleapis.com/google.apps.gmm.v1.Command",
                "type": "LOCK",
                "createTime": "2026-02-10T12: 00:00Z",
                "duration": "3600s",
                "userName": "[email protected]"
            },
            "done": true
        },
        "_config": {
            "name": "enterprises/LC04z6vydu/devices/123456789/operations/abc123",
            "metadata": {
                "type": "LOCK"
            }
        },
        "updatedAt": "2026-02-10T14: 30:00Z",
        "createdAt": "2026-02-10T12: 00:00Z"
    }
}
400 Response application/json
status boolean optional
false
error object optional
code number optional
5051
message string optional
EmmDevice without mdmUser
{
    "status": false,
    "error": {
        "code": 5050,
        "message": "Feature not allowed for you billing plan"
    }
}
401 Response application/json
status boolean optional
false
error object optional
code number optional
4004
message string optional
Invalid Token
{
    "status": false,
    "error": {
        "code": 4002,
        "message": "No auth token"
    }
}
404 Response application/json
status boolean optional
false
error object optional
code number optional
3001
message string optional
Entity not found
{
    "status": false,
    "error": {
        "code": 3001,
        "message": "Entity not found"
    }
}