Help Center/ Workspace/ API Reference/ Workspace APIs/ Desktops/ Terminating Desktop Processes in Batches
Updated on 2026-11-20 GMT+08:00

Terminating Desktop Processes in Batches

Function

Terminates processes on a specified desktop in batches.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    workspace:desktops:batchStopProcesses

    Write

    desktop *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    -

    -

URI

POST /v2/{project_id}/desktops/{desktop_id}/processes/batch-stop

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

desktop_id

Yes

String

Desktop ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

process_list

No

Array of BatchStopProcessReqItem objects

List of desktop processes to be terminated.

Table 3 BatchStopProcessReqItem

Parameter

Mandatory

Type

Description

pid

Yes

Long

Process ID.

start_time

Yes

Long

Process start time, which is a Unix timestamp, in seconds. It is used to accurately locate a process to prevent terminating an incorrect process.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total

Integer

Total number of processes to be terminated.

success_count

Integer

Number of processes that are successfully terminated.

fail_count

Integer

Number of processes that fail to be terminated.

results

Array of BatchStopProcessResult objects

List of process termination results.

Table 5 BatchStopProcessResult

Parameter

Type

Description

pid

Long

Process ID.

name

String

Process name.

success

Boolean

Whether the termination is successful.

message

String

Termination result description. If the operation is successful, the value is OK. If the operation fails, the value is the error description.

Status code: 207

Table 6 Response body parameters

Parameter

Type

Description

total

Integer

Total number of processes to be terminated.

success_count

Integer

Number of processes that are successfully terminated.

fail_count

Integer

Number of processes that fail to be terminated.

results

Array of BatchStopProcessResult objects

List of process termination results.

Table 7 BatchStopProcessResult

Parameter

Type

Description

pid

Long

Process ID.

name

String

Process name.

success

Boolean

Whether the termination is successful.

message

String

Termination result description. If the operation is successful, the value is OK. If the operation fails, the value is the error description.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 403

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 404

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Example Requests

POST /v2/0bec5db98280d2d02fd6c00c2de791ce/desktops/a130ab3a-72bf-4b71-baa9-af4987c8e338/processes/batch-stop

{
  "process_list" : [ {
    "pid" : 123,
    "start_time" : 1720160000
  }, {
    "pid" : 234,
    "start_time" : 1720160100
  } ]
}

Example Responses

Status code: 200

{
  "total" : 2,
  "success_count" : 2,
  "fail_count" : 0,
  "results" : [ {
    "pid" : 1234,
    "name" : "chrome.exe",
    "success" : true,
    "message" : "OK"
  }, {
    "pid" : 2345,
    "name" : "notepad.exe",
    "success" : true,
    "message" : "OK"
  } ]
}

Status code: 207

{
  "total" : 2,
  "success_count" : 1,
  "fail_count" : 1,
  "results" : [ {
    "pid" : 1234,
    "name" : "chrome.exe",
    "success" : true,
    "message" : "OK"
  }, {
    "pid" : 2345,
    "name" : "notepad.exe",
    "success" : false,
    "message" : "process not found"
  } ]
}

Status Codes

Status Code

Description

200

Response to the request for terminating desktop processes in batches.

207

Response to the request for terminating desktop processes in batches.

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error. For details, see the error code description.

Error Codes

See Error Codes.