Tool Name: airdroid_business_provisioning_template_delete
Risk Level: 🔴 High Risk
Execution Mode: ⚡ Synchronous
Category: Provisioning Templates
Quick Start (Copy & Use)
Summary: ⚠️ DESTRUCTIVE OPERATION — Bulk delete provisioning templates by their IDs (max 50 per request). Deleted templates are permanently removed and must be recreated manually if needed again. Supports partial success: each ID is validated and processed independently.
Prerequisites: ProvisioningIds (array of template IDs) — obtain and verify via List Provisioning Templates (check is_default). A valid OAuth2 AccessToken configured in the GI node Credential.
Confirmation behavior: By default this high-risk tool opens a manual confirmation form before execution (RequireConfirmation = true). The form requires a non-empty Reason for audit trail. StatusCode = -2 means execution rejected; StatusCode = -3 means the confirmation timed out (24 hours) before the tool ran. Set RequireConfirmation = false only when explicit user approval has already been obtained.
Success Criteria: StatusCode == 200 and ErrorMessage == "" and FailedCount == 0. A non-empty ErrorMessage with StatusCode == 200 means partial or full per-item failure — inspect FailedIds.
What to Do Next: Verify removal via List Provisioning Templates; for FailedIds, follow Hint (e.g. remove default-template IDs, switch credential).
Minimal Request Example (recommended to copy directly):
{
"ProvisioningIds": [17563, 17562],
"RequireConfirmation": true
}
Minimal Response Example (all deleted):
{
"SuccessIds": [17563, 17562],
"FailedIds": [],
"SucceededCount": 2,
"FailedCount": 0,
"Hint": "",
"Retryable": false,
"OriginalStatusCode": 200,
"StatusCode": 200,
"ErrorMessage": ""
}
Recipes (Common Recipes)
Recipe 1: Delete Obsolete Templates (With Confirmation)
When to use: Standard cleanup of deprecated templates. The confirmation form opens and collects the deletion Reason.
{
"ProvisioningIds": [17563],
"RequireConfirmation": true
}
Recipe 2: Delete After Explicit User Approval (Skip Confirmation)
When to use: The user has already explicitly approved the deletion in conversation and wants immediate execution. The audit reason is auto-set to "Confirmation skipped by RequireConfirmation=false.".
{
"ProvisioningIds": [17562, 17561],
"RequireConfirmation": false
}
Recipe 3: Bulk Cleanup With Pre-Flight Verification
When to use: Deleting many templates. First call List Provisioning Templates, exclude any entry with is_default == "Yes" (default templates cannot be deleted and will land in FailedIds), then delete in batches of at most 50 IDs.
{
"ProvisioningIds": [17550, 17551, 17552, 17553, 17554],
"RequireConfirmation": true
}
1. Overview
1.1 Description
Bulk delete device provisioning templates by their IDs. Supports partial success: each ID is validated and processed independently, so valid IDs are deleted even if others fail. The result reports SuccessIds / FailedIds with per-item failure reasons.
1.2 When to Use
- Permanently removing obsolete or incorrect provisioning templates from the account
Don't use when:
- You are unsure which templates to delete — call List Provisioning Templates first to verify ProvisioningIds and default status
- The template is still being used for active enrollment campaigns
1.3 Execution Mode and Response
This operation is synchronous with partial success. Before the API call, the workflow routes through a manual confirmation step (unless RequireConfirmation = false):
- A confirmation form is created describing the side effects; it requires a Reason (audit trail)
- The workflow waits up to 24 hours for the form to be processed
- On approval, the delete request executes; on rejection → StatusCode = -2; on timeout → StatusCode = -3
Response: SuccessIds, FailedIds, SucceededCount, FailedCount, plus the standard envelope (StatusCode, ErrorMessage, Hint, Retryable, OriginalStatusCode).
1.4 Prerequisites
| Condition | Description | How to Check |
|---|---|---|
| Valid credential | A valid OAuth2 AccessToken is required | Configure AirDroid Business OAuth2 credential in the GI node |
| Templates exist | Template IDs must exist | Verify via List Provisioning Templates |
| Not the default template | Default templates cannot be deleted | Check is_default == "No" in List Provisioning Templates output |
| Group access | The credential's account must have access to the group each template belongs to | Failed items report a per-item permission error (see 5.2) |
| Confirmation approval | The confirmation form must be approved (unless RequireConfirmation = false) | Workflow resumes after approval |
1.5 Prerequisite Tools
| Dependency Tool | Purpose | Necessity |
|---|---|---|
| List Provisioning Templates | Obtain ProvisioningIds and verify is_default status | 🔴 Required |
| Get a Provisioning Template | Inspect a template's full settings before deleting | Recommended |
1.6 Differences from Similar Tools
| Tool | Use Case | Key Difference |
|---|---|---|
| Delete Provisioning Templates | Permanently remove templates | Destructive; batch with partial success; manual confirmation step |
| List Provisioning Templates | Browse / verify templates | Read-only; use before deleting |
| Get a Provisioning Template | Single template detail | Read-only; verify configuration before deleting |
2. Inputs
2.1 Parameter List
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| ProvisioningIds | number-array | Yes | - | Template IDs to delete. Max 50 per request |
| RequireConfirmation | bool | No | true | Whether to open the manual confirmation flow before executing |
2.2 Parameter Details
`ProvisioningIds`
Array of provisioning template IDs to delete.
- Type: number-array
- Required: Yes (must be a non-empty array)
- Limits: Maximum 50 templates per request; every element must be a positive integer. Violations return StatusCode = -1
- Source: The provisioning_id field of items returned by List Provisioning Templates
- Default templates: Templates with is_default == "Yes" in the list output cannot be deleted; they will appear in FailedIds with a per-item error message
- How to fill in GI node:
- Constant: Provide an array directly, e.g. [17563, 17562]
- Upstream reference: Map an array of provisioning_id values collected from a List Provisioning Templates node output
- Example:
[17563, 17562]
`RequireConfirmation`
Whether to enter the manual confirmation flow before executing this high-risk action.
- Type: bool
- Default: true — preserves the confirmation step (recommended)
- true: A confirmation form opens ("Confirm Tool Use") explaining the side effects. It requires a non-empty Reason field for the audit trail. The workflow waits up to 24 hours.
- false: Skips the form and executes immediately; the audit reason is automatically set to "Confirmation skipped by RequireConfirmation=false.". Set false only when the caller has already obtained explicit user approval.
Confirmation form (`Reason`)
This tool does not accept an external Reason input parameter. The deletion reason is collected in the confirmation form (required, non-empty) or auto-filled when confirmation is skipped. An empty reason at execution time returns StatusCode = -1 with ErrorMessage = "Reason is required for audit trail. Provide a brief explanation for this deletion.".
2.3 Parameter Combination Logic
- ProvisioningIds is the only business input; RequireConfirmation only controls the approval flow
- More than 50 IDs → StatusCode = -1; split larger batches into multiple requests
3. Outputs
3.1 Response Example
Success response (all deleted): see the Quick Start minimal response example.
Partial success response:
{
"SuccessIds": [17563],
"FailedIds": [
{
"id": 17560,
"ErrorMessage": "Default template cannot be deleted"
}
],
"SucceededCount": 1,
"FailedCount": 1,
"Hint": "Default templates cannot be deleted; remove default template IDs from ProvisioningIds and retry.",
"Retryable": false,
"OriginalStatusCode": 200,
"StatusCode": 200,
"ErrorMessage": "Partial success: 1 deleted, 1 failed. ID 17560: Default template cannot be deleted"
}
Execution rejected before run:
{
"SuccessIds": [],
"FailedIds": [],
"SucceededCount": 0,
"FailedCount": 0,
"Hint": "Do not retry automatically. Ask the user to confirm again only if they still want to perform this action.",
"Retryable": false,
"OriginalStatusCode": -2,
"StatusCode": -2,
"ErrorMessage": "The user canceled tool execution before the tool could run."
}
Confirmation timed out before run:
{
"SuccessIds": [],
"FailedIds": [],
"SucceededCount": 0,
"FailedCount": 0,
"Hint": "Ask the user whether they still want to proceed. If yes, re-invoke this tool to create a new confirmation request.",
"Retryable": false,
"OriginalStatusCode": -3,
"StatusCode": -3,
"ErrorMessage": "The confirmation timed out before the tool could run."
}
3.2 Field Descriptions
| Field Path | Type | Description |
|---|---|---|
| SuccessIds | number-array | IDs of templates deleted successfully. Empty when nothing was deleted or the tool did not execute |
| FailedIds | object-array | Per-item deletion failures |
| FailedIds[].id | number | Template ID that was not deleted |
| FailedIds[].ErrorMessage | string | Failure reason for that ID |
| SucceededCount | number | Number of templates deleted successfully |
| FailedCount | number | Number of templates that failed to delete; check FailedIds for details |
| Hint | string | Next-action guidance when FailedIds is non-empty or the workflow was rejected/timed out. Empty when all succeeded |
| Retryable | boolean | true = transient error (same params may succeed on retry); false = persistent error |
| OriginalStatusCode | number | Upstream HTTP status code (diagnostic-only). 0 = no upstream response (timeout/network); -2 = execution rejected; -3 = confirmation timed out |
| StatusCode | number | See 3.3 |
| ErrorMessage | string | Empty = full success; non-empty = partial or complete failure summary |
Judgment logic: an agent should treat the batch as fully successful only when SucceededCount == len(ProvisioningIds) and FailedCount == 0 (equivalently, ErrorMessage == "" with StatusCode == 200).
3.3 Status Code / Enum Value Mapping
| StatusCode | Meaning | Description |
|---|---|---|
| -3 | Confirmation timed out | The confirmation form expired (24 hours) before the tool ran; nothing was deleted |
| -2 | Execution rejected | The confirmation form was explicitly rejected or canceled; nothing was deleted |
| -1 | Parameter validation error | Empty/oversized/invalid ProvisioningIds, missing reason, or invalid access token |
| 200 | Request completed | Response parsed; check FailedIds / SucceededCount / FailedCount / ErrorMessage for per-item outcomes |
| 500 | System/network error | Timeout, connection failure, rate limit (HTTP 429), or non-200 upstream HTTP status |
4. Examples
4.1 Basic Example: Delete Two Templates
Request Parameters:
{
"ProvisioningIds": [17563, 17562],
"RequireConfirmation": true
}
Response (after confirmation form approval):
{
"SuccessIds": [17563, 17562],
"FailedIds": [],
"SucceededCount": 2,
"FailedCount": 0,
"Hint": "",
"Retryable": false,
"OriginalStatusCode": 200,
"StatusCode": 200,
"ErrorMessage": ""
}
4.2 Advanced Example: Partial Success With a Not-Found ID
Request Parameters:
{
"ProvisioningIds": [17563, 99999],
"RequireConfirmation": true
}
Response:
{
"SuccessIds": [17563],
"FailedIds": [
{
"id": 99999,
"ErrorMessage": "Provisioning template not found"
}
],
"SucceededCount": 1,
"FailedCount": 1,
"Hint": "One or more provisioning templates were not found; verify ProvisioningIds via 'List Provisioning Templates' and retry.",
"Retryable": false,
"OriginalStatusCode": 200,
"StatusCode": 200,
"ErrorMessage": "Partial success: 1 deleted, 1 failed. ID 99999: Provisioning template not found"
}
4.3 Error Example: Batch Too Large
Request Parameters (error — more than 50 IDs):
{
"ProvisioningIds": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51],
"RequireConfirmation": true
}
Response:
{
"SuccessIds": [],
"FailedIds": [],
"SucceededCount": 0,
"FailedCount": 0,
"Hint": "Obtain provisioning_ids via 'List Provisioning Templates', then retry.",
"Retryable": false,
"OriginalStatusCode": 0,
"StatusCode": -1,
"ErrorMessage": "Maximum 50 provisioning templates per request. Split into multiple requests for larger batches."
}
5. Error Handling
5.1 AB Three-Layer Error Codes
| StatusCode | Meaning | Use Case | Agent Response |
|---|---|---|---|
| -3 | Confirmation timed out | The confirmation form expired before execution | Ask the user whether to proceed; re-invoke to create a new confirmation request |
| -2 | Execution rejected | The confirmation form was rejected/canceled | Do not retry automatically; proceed only on a new explicit user request |
| -1 | Parameter validation error | Empty/oversized/non-integer ProvisioningIds, missing reason, invalid token | ❌ Do not retry; fix parameters |
| 200 | Request completed | Full success, partial success, or full per-item failure — check FailedIds | Empty ErrorMessage = full success; otherwise handle per-item failures via Hint |
| 500 | Network / HTTP exception | Timeout, connection failure, rate limit, non-200 upstream HTTP status | Retry only when Retryable == true (max 2 times, 5-second interval) — see idempotency note in 6.3 first |
5.2 Common Errors
| StatusCode | ErrorMessage / cause | Cause | Fix |
|---|---|---|---|
| -1 | ProvisioningIds must be a non-empty array of provisioning template IDs. | Empty or non-array input | Obtain IDs via List Provisioning Templates |
| -1 | Maximum 50 provisioning templates per request. | Batch too large | Split into batches of ≤ 50 |
| -1 | All elements in ProvisioningIds must be positive integers. | Non-numeric / non-positive element | Clean the ID array |
| -1 | Reason is required for audit trail. | Empty reason at execution time | Provide a non-empty reason |
| 200 (per-item) | Template not found | ID does not exist (possibly already deleted) | Verify via List Provisioning Templates; treat as already-deleted if cleanup was the goal |
| 200 (per-item) | Default template cannot be deleted | ID belongs to the default template | Remove default template IDs from ProvisioningIds and retry |
| 200 (per-item) | Group access denied | The selected credential doesn't have permission to delete one or more provisioning templates — its account lacks access to the group the template belongs to | Use a credential with the required permissions, or retry with only the ProvisioningIds visible to this credential in List Provisioning Templates |
| 200 (per-item) | Permission denied | Role lacks Configuration File read access required for policy-based templates | Remove those ProvisioningIds or contact your administrator |
| 200 | Token expired/invalid message | The upstream service rejected the credential | Follow Hint: refresh the OAuth2 access_token, then retry |
| 500 | Rate limited. Please retry after a few seconds. | Upstream HTTP 429 | Wait 10-30 seconds and retry once |
| 500 | Request timeout after 60 seconds. | Request timeout | Do not blind-retry a delete — verify state via List Provisioning Templates first |
5.3 Agent Self-Healing Decision Table
| Condition | Auto Retry | Handling Strategy |
|---|---|---|
| StatusCode == 200, ErrorMessage == "" | - | Full success; optionally verify via List Provisioning Templates |
| StatusCode == 200, FailedCount > 0 | ❌ | Handle each FailedIds[] per its ErrorMessage; follow Hint; do not resend already-succeeded IDs |
| StatusCode == -1 | ❌ | Fix parameters and re-call |
| StatusCode == -2 | ❌ | Wait for a new explicit user request |
| StatusCode == -3 | ❌ | Ask the user whether to continue; re-invoke if yes |
| StatusCode == 500, Retryable == true | ⚠️ | Verify via List Provisioning Templates whether the deletion took effect before retrying |
6. Best Practices
6.1 Performance Optimization
- Batch limit: Max 50 IDs per request; split larger cleanups into multiple calls
- Pre-filter: Exclude is_default == "Yes" and permission-restricted templates up front to avoid predictable per-item failures
6.2 Security Considerations
⚠️ High-Risk Operation Warning: This operation permanently deletes the selected provisioning templates. Deleted templates cannot be recovered and must be recreated manually if needed again.
| Guardrail | Description |
|---|---|
| RequireConfirmation | Default true — opens a manual confirmation form before execution. Set false only with prior explicit user approval |
| Reason (confirmation form) | Required, non-empty, used for the audit trail, e.g. "Removing deprecated Q3 rollout templates" |
Pre-Execution Checklist:
- ☐ Verify every ID via List Provisioning Templates (correct templates, correct account)
- ☐ Confirm no target has is_default == "Yes" (default templates cannot be deleted)
- ☐ Confirm none of the templates are used by active enrollment campaigns
- ☐ Record the template configurations (via Get a Provisioning Template) if they may need to be recreated
- ☐ Obtain explicit user confirmation (or let the confirmation form collect it)
- ☐ Understand the irreversibility — there is no undo
6.3 Idempotency
Idempotency: Not idempotent.
- First call: deletes the templates, returns them in SuccessIds
- Repeat call with the same IDs: the IDs no longer exist, so they are reported as per-item failures in FailedIds (not-found)
Note: Do not blindly retry after a timeout. If unsure whether the deletion succeeded, call List Provisioning Templates to check whether the IDs still exist, then retry only the remaining ones.
7. Related Tools
7.1 Prerequisite Tools
| Tool Name | Purpose |
|---|---|
| List Provisioning Templates | Obtain ProvisioningIds and verify is_default status |
| Get a Provisioning Template | Snapshot a template's configuration before deletion |
7.2 Follow-up Tools
| Tool Name | Purpose |
|---|---|
| List Provisioning Templates | Confirm the templates were removed |
7.3 Similar Tool Comparison
| Tool | Use Case | Difference |
|---|---|---|
| Delete Provisioning Templates | Permanent template removal | Destructive, batch, partial success, confirmation flow |
| Delete Groups | Delete device groups | Different resource type (groups, not templates) |
8. Tool Chains
8.1 Safe Template Cleanup Flow
Scenario: Remove obsolete templates with full verification.
Tool Chain:
List Provisioning Templates → Get a Provisioning Template (optional snapshot) → Delete Provisioning Templates → List Provisioning Templates (verify)
Steps:
- Call List Provisioning Templates and select target templates; exclude is_default == "Yes"
- (Optional) Call Get a Provisioning Template for each target to record its configuration
- Call Delete Provisioning Templates with the verified IDs; approve the confirmation form with a reason
- Check SuccessIds / FailedIds; call List Provisioning Templates to confirm removal
8.2 Handling Partial Failures
Scenario: Some IDs failed to delete in a batch.
Tool Chain:
Delete Provisioning Templates → (inspect FailedIds) → List Provisioning Templates → Delete Provisioning Templates (remaining valid IDs)
Steps:
- After the first delete, group FailedIds by ErrorMessage
- Drop default-template and permission-denied IDs; verify not-found IDs via List Provisioning Templates
- Re-invoke Delete Provisioning Templates with only the remaining deletable IDs
Appendix Reference:
- Field Reference: ./Field Reference.md
- Error Code Quick Reference: ./Error Codes.md
Leave a Reply.