Remove a deployment from devices or a device group
const url = 'http://localhost:3000/api/v1/deployments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/targets/remove';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"deviceIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"group":{"labelKey":"site","labelValue":"berlin"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/api/v1/deployments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/targets/remove \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "deviceIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "group": { "labelKey": "site", "labelValue": "berlin" } }'Removes the deployment from the given devices (or from every current target in one label group) while it stays live on the others. The group is resolved once, at request time; devices that join it later are unaffected. A removed device stays excluded, even if it still matches the deployment selector, until it is re-included. Like DELETE /deployments/:id this only requests removal: the device confirms via the Margo status endpoint, and progress is visible in removal-status and awaiting-removal. When the request covers every remaining target, the whole deployment is removed and deploymentRemoved is true. Provide exactly one of deviceIds or group.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Deployment UUID
Request Bodyrequired
Section titled “Request Bodyrequired”object
Devices to remove the deployment from. Mutually exclusive with group.
Device group (label key/value). Its members are resolved once, at request time. Mutually exclusive with deviceIds.
object
Label key that defines the group
Example
siteLabel value that defines the group
Example
berlinResponses
Section titled “Responses”Removal requested
object
True when the request covered every remaining target, so the whole deployment was removed (the same flow as DELETE /deployments/:id). False when the deployment stays live.
Devices the removal was requested for (group members resolved at request time)
Devices that remain targets of the deployment after this request
Examplegenerated
{ "deploymentRemoved": true, "removedDeviceIds": [ "example" ], "remainingTargets": 1}Neither or both of deviceIds/group given, the device was already removed, or the group has no current target
Forbidden — caller lacks required permission
Deployment not found, or the device is not a target