• Tools
Tools
  • Tools
loading...
No Results
  • ActiveCampaign
  • AirDroid Business
    • Index
    • Batch Resolve Device and Group IDs by Name
    • Batch Resolve Device IDs by Name
    • Batch Resolve Group IDs by Name
    • Batch Get Devices by Device or Group IDs
    • Clear app data and cache
    • Create a group
    • Delete groups
    • Delete Provisioning Templates
    • Disable lost mode
    • Error codes
    • Enable lost mode
    • Field reference
    • Get average screen time
    • Get account activities
    • Get a Configuration
    • Get a device by name
    • Get a device app by name
    • Get a group
    • Get a group id by group name
    • Get a Provisioning Template
    • Get an activity log
    • Get all devices
    • Get all device apps
    • Get all devices with filter
    • Get Config File Deployment Status
    • Get device info push
    • Get device location report
    • Get device network connection history
    • Get device application usage duration
    • Get device application report
    • Get device online status report
    • Get device remote access report
    • Get data usage overview and trends
    • Get tag ids by tag names
    • Get top 10 apps by usage duration
    • Get top 10 data usage apps
    • Generate Device Owner Enrollment QR for Template
    • List Groups
    • List Policy and Kiosk Configurations
    • List Provisioning Templates
    • Lock a device
    • Move devices to a group
    • Open app to foreground
    • Power off a device
    • Reboot device
    • Remote operation
    • Search Groups
    • Set tags
    • Turn off device screen
    • Unenroll a device
    • Update a device name
    • Update a device remark
    • Update a group name
    • Update a group remark
  • Adalo
  • Appstore
  • Asana
  • AWS Lambda
  • AWS-S3
  • BambooHR
  • Bitbucket
  • Brevo
  • Clockify
  • Coda
  • ConvertKit
  • DingTalk
  • Discord
  • Discourse
  • Dropbox
  • Elasticsearch
  • Elastic Security
  • FeiShu
  • Firecrawl
  • Freshdesk
  • Freshservice
  • Freshworks CRM
  • Gerrit
  • Github
  • Gitlab
  • Google Ads
  • Google Analytics
  • Google Calendar
  • Google Developer
  • Google Docs
  • Google Drive
  • Google Gmail
  • Google Sheets
  • Grafana
  • Hacker News
  • HaloPSA
  • Harvest
  • Help Scout
  • Hubspot
  • Intercom
  • Jenkins
  • Jira
  • Kafka
  • Lemlist
  • Linear
  • Magento
  • MailChimp
  • Mautic
  • Metabase
  • Microsoft Excel
  • Microsoft OneDrive
  • Microsoft Outlook
  • Microsoft Sharepoint
  • Microsoft Teams
  • Microsoft To Do
  • monday.com
  • MySQL
  • Nextcloud
  • Notion
  • Odoo
  • Okta
  • OpenAI
  • Ortto
  • Paddle
  • PayPal
  • Pipedrive
  • PostgreSQL
  • PostHog
  • Qdrant
  • QuickBooks
  • Redis
  • Segment
  • SendGrid
  • ServiceNow
  • Shopify
  • Slack
  • Splunk
  • Spotify
  • Strapi
  • Stripe
  • System Tools
    • Code
    • CSV
    • Crypto
    • Data Shaping
    • Date & Time
    • Delay
    • Documents
    • QRCode
    • Search&Crawl
    • Text
    • Xml
  • Teambition
  • Telegram
  • Todoist
  • Trello
  • Twilio
  • Webflow
  • Wekan
  • Wikipedia
  • WooCommerce
  • WordPress
  • X
  • YouTube
  • Zammad
  • Zendesk
  • Zoho CRM
  • Zoom
  • Zulip
Home > Tools > AirDroid Business

Generate Device Owner Enrollment QR for Template

Tool Name: airdroid_business_provisioning_template_device_owner_enrollment_qr_generate

Risk Level: 🟢 Low Risk

Execution Mode: ⚡ Synchronous

Category: Provisioning Templates

Quick Start (Copy & Use)

Summary: Generate a Device Owner enrollment QR code (SVG markup or PNG Base64) for a provisioning template. This QR is the Device Owner registration code used in the console enrollment flow — it is rendered from the template's configuration_code.

Prerequisites: ProvisioningId (positive integer ≥ 1) — obtain via List Provisioning Templates. The template must be Android with packapk_progress = "Package ready" (check via Get a Provisioning Template). A valid OAuth2 AccessToken configured in the GI node Credential.

Success Criteria: StatusCode == 200, ErrorMessage == "", and ProvisionCode is non-empty.

Enrollment implications: A device that scans this QR during factory setup is enrolled as a fully managed Device Owner device under the template's group/policy configuration. Treat the QR as an enrollment secret — anyone with it can enroll devices into your organization.

> 🚨 Output integrity — do not modify ProvisionCode: The QR payload is a very long string (tens of KB of SVG markup or PNG Base64). It must be passed on verbatim and in full — never truncate it, insert ..., summarize, rewrite, or re-encode it. One changed character makes the QR unscannable. Reference the output variable directly in downstream nodes instead of copying it into prose.

What to Do Next: Pass ProvisionCode directly (by variable reference) to a display, email, or file node; scan the QR on the target device during Android factory setup.

Minimal Request Example (recommended to copy directly):

{
  "ProvisioningId": 100
}

Minimal Response Example:

{
  "ProvisionCode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==",
  "Hint": "",
  "Retryable": false,
  "OriginalStatusCode": 200,
  "StatusCode": 200,
  "ErrorMessage": ""
}

> Note: the ProvisionCode value above is shortened only to keep this document readable — a real payload is tens of kilobytes. In actual responses it must always be handled complete and unmodified.

Recipes (Common Recipes)

Recipe 1: Generate a QR for a Known Template

When to use: You already have an Android template's ProvisioningId and its package is ready.

{
  "ProvisioningId": 17563
}

Recipe 2: Verify Readiness First, Then Generate

When to use: You are unsure whether the template's configuration_code is available. Call Get a Provisioning Template first and check platform_type, packapk_progress, and configuration_code; generate the QR only when packapk_progress == "Package ready".

{
  "ProvisioningId": 100
}

Recipe 3: Retry After Packaging Completes

When to use: A previous call returned Retryable = true with ErrorMessage containing packapk_progress (e.g. "Packaging in progress"). Poll Get a Provisioning Template until packapk_progress == "Package ready", then re-invoke with the same ID.

{
  "ProvisioningId": 100
}

1. Overview

1.1 Description

Generate a Device Owner enrollment QR code for a provisioning template. Internally the workflow:

  1. Calls Get a Provisioning Template with the given ProvisioningId
  2. Extracts the template's configuration_code
  3. If the code is non-empty, renders it as a QR image (SVG markup or PNG Base64) and returns it in ProvisionCode
  4. If the code is empty or the lookup fails, returns an empty ProvisionCode with a diagnostic ErrorMessage / Hint derived from platform_type / packapk_progress

1.2 When to Use

  • Device Owner enrollment: Produce the registration QR scanned during Android factory setup to enroll devices as fully managed under the template's configuration
  • Enrollment kits: Embed the QR into onboarding documents or displays for field provisioning

Don't use when:

  • The template is Windows — Windows templates never provide configuration_code; use the template's deploy_code (from Get a Provisioning Template) instead
  • You don't have the ProvisioningId — call List Provisioning Templates first

1.3 Execution Mode and Response

This operation is synchronous (template lookup + QR render only; it is effectively read-only and creates no server-side changes). Returns:

  • ProvisionCode: The QR payload (empty string on any failure path)
  • StatusCode / ErrorMessage / Hint / Retryable / OriginalStatusCode: Call status and error information

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
Template exists ProvisioningId must reference an existing template List Provisioning Templates / Get a Provisioning Template
Android platform Windows templates never provide an enrollment QR Check platform_type via Get a Provisioning Template
Package ready Android configuration_code is available only when packapk_progress == "Package ready" Check packapk_progress via Get a Provisioning Template

1.5 Prerequisite Tools

Dependency Tool Purpose Necessity
List Provisioning Templates Obtain the ProvisioningId 🔴 Required (if ID unknown)
Get a Provisioning Template Pre-check platform_type / packapk_progress / configuration_code Recommended

1.6 Differences from Similar Tools

Tool Use Case Key Difference
Generate Device Owner Enrollment QR for Template Produce a scannable enrollment QR image Renders configuration_code as SVG/PNG QR
Get a Provisioning Template Inspect template configuration Returns the raw configuration_code / deploy_code strings, not a QR image

2. Inputs

2.1 Parameter List

Parameter Type Required Default Description
ProvisioningId number Yes - Provisioning template ID. Positive integer ≥ 1

2.2 Parameter Details

`ProvisioningId`

Provisioning template unique identifier.

  • Type: number
  • Required: Yes
  • Format: Positive integer greater than 0. Invalid values fail the underlying template lookup with StatusCode = -1
  • Source: The provisioning_id field of items returned by List Provisioning Templates
  • How to fill in GI node:
    • Constant: Enter the numeric ID directly, e.g. 17563
    • Upstream reference: Use ProvisioningList[0].provisioning_id from a List Provisioning Templates node output, or Provisioning.provisioning_id from Get a Provisioning Template
  • Example:
17563

2.3 Parameter Combination Logic

ProvisioningId is the only business input; there are no combination rules.

3. Outputs

3.1 Response Example

Success response: see the Quick Start minimal response example above.

Error response (Windows template — QR unsupported):

{
  "ProvisionCode": "",
  "Hint": "Call 'Get a Provisioning Template' with the same ProvisioningId and use the returned deploy_code for Windows enrollment. Do not retry this tool for Windows templates.",
  "Retryable": false,
  "OriginalStatusCode": 200,
  "StatusCode": 200,
  "ErrorMessage": "Windows provisioning templates do not provide configuration_code or enrollment QR codes. Use deploy_code from 'Get a Provisioning Template' instead."
}

Error response (Android package not ready — retryable):

{
  "ProvisionCode": "",
  "Hint": "Wait until packapk_progress becomes 'Package ready', then retry 'Generate Device Owner Enrollment QR for Template' with the same ProvisioningId. You can check status via 'Get a Provisioning Template'.",
  "Retryable": true,
  "OriginalStatusCode": 200,
  "StatusCode": 200,
  "ErrorMessage": "configuration_code is empty. packapk_progress: Packaging in progress."
}

3.2 Field Descriptions

Field Path Type Description
ProvisionCode string Device Owner enrollment QR (SVG markup or PNG Base64) rendered from the template's configuration_code. Empty string when the lookup fails or configuration_code is unavailable (check ErrorMessage). 🚨 Very long payload (tens of KB) — pass it on verbatim and in full; never truncate, insert ..., summarize, or re-encode. One changed character makes the QR unscannable. Reference the output variable directly instead of copying it into prose.
Hint string Next-action guidance. Not found → obtain ProvisioningId via List Provisioning Templates. Windows → use deploy_code via Get a Provisioning Template. Android packaging → wait for "Package ready" then retry. Empty on success
Retryable boolean true only when Android packapk_progress indicates packaging may complete later; false for not-found / Windows / auth / permission errors
OriginalStatusCode number Upstream HTTP status code from the provisioning-template lookup (diagnostic-only); 0 = no upstream response
StatusCode number 200 = completed (check ErrorMessage and ProvisionCode), -1 = parameter validation failed, 500 = system/network error
ErrorMessage string Empty on success. On lookup failure, passes through the Get a Provisioning Template error. When configuration_code is empty on a found template, explains the reason using platform_type and/or packapk_progress

3.3 Status Code / Enum Value Mapping

Retryable for the "configuration_code unavailable" path is derived from packapk_progress:

packapk_progress value Retryable Meaning
"Not packaged yet" true Packaging has not started; may complete later
"Repackaging required" true Template changed; repackaging pending
"Packaging in progress" true Packaging running; retry after it finishes
"Packaging timeout" true Packaging timed out; may recover
"Package verification failed" false Packaging failed verification; do not retry blindly
(absent) with platform_type = Windows false Windows never provides an enrollment QR
(absent, other platforms) false Inspect the template via Get a Provisioning Template before deciding

3.4 Determining the Outcome

Condition Meaning
ErrorMessage == "" and ProvisionCode non-empty QR generated — deliver ProvisionCode unmodified
ErrorMessage != "" and Retryable == true Android packaging not finished — wait and retry
ErrorMessage != "" and Retryable == false Not found / Windows / permission issue — follow Hint, do not retry with the same params

4. Examples

4.1 Basic Example: Generate the Enrollment QR

Request Parameters:

{
  "ProvisioningId": 100
}

Response: see the Quick Start minimal response example. Deliver ProvisionCode by variable reference — never inline-edit it.

4.2 Advanced Example: Poll Until Package Ready

Scenario: The first call reports packaging in progress.

  1. Call this tool → response has Retryable = true, ErrorMessage = "configuration_code is empty. packapk_progress: Packaging in progress."
  2. Poll Get a Provisioning Template with the same ProvisioningId every few minutes until Provisioning.packapk_progress == "Package ready"
  3. Re-invoke this tool with the same ProvisioningId:
{
  "ProvisioningId": 100
}

4.3 Error Example: Template Not Found

Request Parameters:

{
  "ProvisioningId": 99999
}

Response:

{
  "ProvisionCode": "",
  "Hint": "Provisioning template was not found; obtain provisioning_id via 'List Provisioning Templates' and retry.",
  "Retryable": false,
  "OriginalStatusCode": 200,
  "StatusCode": 200,
  "ErrorMessage": "Provisioning template not found."
}

5. Error Handling

5.1 AB Three-Layer Error Codes

StatusCode Meaning Use Case Agent Response
-1 Parameter validation error Invalid ProvisioningId or empty access token (from the underlying template lookup) ❌ Do not retry; fix parameters
200 Completed — success or business error Check ErrorMessage and ProvisionCode. Not-found, Windows-unsupported, and packaging-pending outcomes all return 200 with a non-empty ErrorMessage Empty ErrorMessage + non-empty ProvisionCode = success; otherwise follow Hint and respect Retryable
500 Network / HTTP / request exception Timeout, connection failure, rate limit, or non-200 upstream HTTP status (inherited from the template lookup) Retry only when Retryable == true (max 2 times, 5-second interval)

5.2 Common Errors

StatusCode ErrorMessage Example Cause Fix
-1 Invalid provisioning_id, must be a positive integer greater than 0. Bad ProvisioningId Obtain a valid ID via List Provisioning Templates
-1 access_token is invalid. Credential not configured or token empty Configure AirDroid Business OAuth2 Credential
200 Template not found (from lookup; ProvisionCode empty) Template does not exist Obtain ProvisioningId via List Provisioning Templates
200 Windows provisioning templates do not provide configuration_code or enrollment QR codes. ... Windows template Use deploy_code from Get a Provisioning Template; never retry this tool for Windows
200 configuration_code is empty. packapk_progress: Packaging in progress. Android package not ready Wait for "Package ready" (check via Get a Provisioning Template), then retry
200 configuration_code is empty. packapk_progress: Package verification failed. Packaging failed Inspect the template; do not blind-retry (Retryable = false)
200 configuration_code is empty (platform_type: ...). packapk_progress was not returned by the API. API fields incomplete Inspect platform_type, packapk_progress, configuration_code, deploy_code via Get a Provisioning Template
500 Rate limited. Please retry after a few seconds. HTTP 429 Wait 10-30 seconds and retry once
500 Request timeout after 60 seconds. Request timeout Retry once; contact support if persistent

5.3 Agent Self-Healing Decision Table

Condition Handling Strategy
StatusCode == 200, ErrorMessage == "", ProvisionCode non-empty Success — deliver ProvisionCode verbatim by variable reference
StatusCode == 200, ErrorMessage != "", Retryable == true Android packaging pending — poll Get a Provisioning Template for "Package ready", then retry
StatusCode == 200, ErrorMessage != "", Retryable == false Follow Hint (fix ID / use deploy_code for Windows / fix permissions); do not retry same params
StatusCode == -1 Fix input parameters or Credential and retry
StatusCode == 500, Retryable == true Retry up to 2 times (5-second interval)

6. Best Practices

6.1 Performance Optimization

  • Pre-check readiness with Get a Provisioning Template to avoid wasted calls while Android packaging is in progress
  • Do not route ProvisionCode through an LLM message: the payload is tens of KB. Wire it directly from this node's output into the consuming node (display / file / email) by variable reference — this saves tokens and eliminates corruption risk

6.2 Security Considerations

🟢 Read operation (lookup + QR render only; no server-side changes). However, mind the enrollment implications:

  • Scanning this QR during Android factory setup enrolls the device as a fully managed Device Owner device under the template's group/policy configuration
  • Treat the QR (and the underlying configuration_code) as an enrollment secret: anyone who obtains it can enroll devices into your organization — share it only through controlled channels and regenerate it if the template changes

🚨 Output integrity: ProvisionCode must never be truncated, elided with ..., re-encoded, or otherwise rewritten by the model or any intermediate node. A single altered character renders the QR unscannable.

6.3 Idempotency

Idempotency: Naturally idempotent. Read-only; repeated calls with the same ProvisioningId return the same QR (unless the template's configuration_code changes, e.g. after repackaging).

7. Related Tools

7.1 Prerequisite Tools

Tool Name Purpose
List Provisioning Templates Obtain the ProvisioningId
Get a Provisioning Template Pre-check platform_type, packapk_progress, configuration_code, deploy_code

7.2 Follow-up Tools

Tool Name Purpose
List Devices After devices scan the QR and enroll, confirm they appear in the organization

7.3 Similar Tool Comparison

Tool Use Case Difference
Generate Device Owner Enrollment QR for Template Scannable enrollment QR image Returns rendered SVG/PNG payload
Get a Provisioning Template Raw template configuration Returns configuration_code / deploy_code as plain strings

8. Tool Chains

8.1 Full Enrollment QR Flow

Scenario: Produce an enrollment QR for a template known only by name.

Tool Chain:

List Provisioning Templates → Get a Provisioning Template → Generate Device Owner Enrollment QR for Template

Steps:

  1. Call List Provisioning Templates with a Name keyword and PlatformType = 1 (Android)
  2. Call Get a Provisioning Template with the matched provisioning_id; verify packapk_progress == "Package ready" and configuration_code non-empty
  3. Call Generate Device Owner Enrollment QR for Template with the same ID; deliver ProvisionCode verbatim

8.2 Packaging-Pending Retry Loop

Scenario: The template's APK package is still being built.

Tool Chain:

Generate Device Owner Enrollment QR for Template → (Retryable=true) → Get a Provisioning Template (poll packapk_progress) → Generate Device Owner Enrollment QR for Template

Steps:

  1. First call returns Retryable = true with packapk_progress in ErrorMessage
  2. Poll Get a Provisioning Template until packapk_progress == "Package ready"
  3. Re-invoke this tool with the same ProvisioningId

Appendix Reference:

  • Field Reference: ./Field Reference.md
  • Error Code Quick Reference: ./Error Codes.md
Updated on: Jul 16, 2026
Was This Page Helpful?
Prev Get top 10 data usage apps
Next List Groups
Discussion

Leave a Reply. Cancel reply

Your email address will not be published. Required fields are marked*

Product-related questions?Contact Our Support Team to Get a Quick Solution>
On this page
  • Quick Start (Copy & Use)
  • Recipes (Common Recipes)
    • Recipe 1: Generate a QR for a Known Template
    • Recipe 2: Verify Readiness First, Then Generate
    • Recipe 3: Retry After Packaging Completes
  • 1. Overview
    • 1.1 Description
    • 1.2 When to Use
    • 1.3 Execution Mode and Response
    • 1.4 Prerequisites
    • 1.5 Prerequisite Tools
    • 1.6 Differences from Similar Tools
  • 2. Inputs
    • 2.1 Parameter List
    • 2.2 Parameter Details
    • 2.3 Parameter Combination Logic
  • 3. Outputs
    • 3.1 Response Example
    • 3.2 Field Descriptions
    • 3.3 Status Code / Enum Value Mapping
    • 3.4 Determining the Outcome
  • 4. Examples
    • 4.1 Basic Example: Generate the Enrollment QR
    • 4.2 Advanced Example: Poll Until Package Ready
    • 4.3 Error Example: Template Not Found
  • 5. Error Handling
    • 5.1 AB Three-Layer Error Codes
    • 5.2 Common Errors
    • 5.3 Agent Self-Healing Decision Table
  • 6. Best Practices
    • 6.1 Performance Optimization
    • 6.2 Security Considerations
    • 6.3 Idempotency
  • 7. Related Tools
    • 7.1 Prerequisite Tools
    • 7.2 Follow-up Tools
    • 7.3 Similar Tool Comparison
  • 8. Tool Chains
    • 8.1 Full Enrollment QR Flow
    • 8.2 Packaging-Pending Retry Loop
loading...
No Results