Aurelia
Clark

Building Custom Automation Workflows with the Hexnode API

Aurelia Clark

Jan 20, 2026

9 min read

Building Custom Automation Workflows with the Hexnode API

In the world of Enterprise IT, the Graphical User Interface (GUI) is a double-edged sword.

For an admin managing 50 devices, a dashboard with buttons is perfect. But for an Enterprise Architect managing 50,000 endpoints, a dashboard is a bottleneck. You cannot click “Wipe” 500 times during a security breach. You cannot manually upload an app 20 times a week for your CI/CD pipeline.

Modern infrastructure is not managed; it is programmed.

Enterprises today operate on the principle of Infrastructure as Code (IaC). They want their Mobile Device Management (MDM) to behave like AWS or Azure—controllable via scripts, triggered by events, and integrated seamlessly into their existing stack.

This guide explores how to move beyond the Hexnode console and leverage the Hexnode REST API to build “Autonomous Endpoint Management.” We will detail three architectural patterns: Automated CI/CD Deployment, Event-Driven Security Remediation, and Bulk Provisioning.

Start Building with Hexnode API

The Philosophy: From “Admin” to “Architect”

The shift to API-based management requires a change in mindset.

  • The Admin waits for a ticket, logs in, finds the device, and clicks a button.
  • The Architect writes a script once that listens for the ticket and executes the action automatically, forever.

Hexnode is an API-First Platform. Almost every action available in our GUI—from locking a device to installing an enterprise app—is available programmatically via our REST endpoints.

Workflow 1: The CI/CD Bridge (Jenkins → Hexnode)

The Scenario:

Your internal development team builds a new version of your proprietary “Field Service App” every Friday.

  • The Old Way: The developer emails the APK/IPA file to the IT Admin. The Admin downloads it, logs into Hexnode, uploads it to the App Inventory, and updates the policy.
  • The Friction: This manual handoff delays deployment and introduces human error (e.g., uploading the Dev build to Prod devices).

The Automated Workflow:

We connect your Build Server (Jenkins/GitLab CI) directly to Hexnode.

  • Build Success: Jenkins finishes compiling FieldService_v2.0.apk.
  • API Call 1 (Upload): Jenkins triggers a Python script to push the new APK to the Hexnode App Inventory.
  • API Call 2 (Deploy): The script calls the install_application endpoint, targeting the “Field Service Devices” smart group.
  • Result: The app updates on 10,000 devices minutes after the code is committed.

The Code Pattern (Python/Requests):

🛠️ Implementation Note: The Two-Step Handshake

The Upload Sequence Before you can trigger a deployment via install_applications, the binary file (APK or IPA) must exist in your Hexnode App Inventory. In a true CI/CD pipeline, your script performs a two-step handshake:

  • POST to /applications/: Send the file as multipart/form-data. Hexnode will return a unique app_id.
  • POST to /actions/install_applications/: Use that fresh app_id to push the update to your devices.


Workflow 2: Event-Driven Security (Splunk → Hexnode)

The Scenario:

Your SIEM (Splunk/Datadog) detects anomalous traffic from a corporate iPad. It’s uploading gigabytes of data to an unknown server in a foreign country.

  • The Old Way: Splunk sends an email alert to the SOC. The analyst sees it 2 hours later. By then, the data is gone.
  • The Old Way: Splunk sends an email alert to the SOC. The analyst sees it 2 hours later. By then, the data is gone.

The Automated Workflow:

We turn Hexnode into the “Muscle” for your SIEM’s “Brain.”

  1. The Trigger: Splunk detects “High Data Exfiltration Risk” on Device ID 998877.
  2. The Webhook: Splunk fires a webhook to a middleware (like Tines, SOAR, or a Lambda function).
  3. The Action: The middleware calls the Hexnode API add_to_device_group endpoint.
  4. Hexnode Policy: This group has a strict policy that disables Wi-Fi, blocks all apps, and displays a lock screen message: “Security Alert. Device Quarantined.”

Event-Driven Autonomous Remediation
Event-Driven Autonomous Remediation
🛡️ The Architect’s Guardrail: Webhook Verification

Never trust an unauthenticated webhook. Because your middleware has the power to isolate enterprise hardware, it is a high-value target. If an attacker discovers your endpoint URL, they could “spoof” a Splunk alert to quarantine your entire fleet.
To prevent this, your middleware must:

  • Check the Signature: Splunk (and most SIEMs) can sign payloads using a shared secret. Your script should verify this HMAC-SHA256 signature before calling Hexnode.
  • Validate the Payload: Ensure the device_id in the request matches your expected corporate formatting.
  • IP Whitelisting: If possible, configure your firewall to only accept incoming traffic from your SIEM’s known IP ranges.

The “Quarantine” Logic:

Why this wins: You have reduced the Mean Time to Remediation (MTTR) from hours to milliseconds. The device is neutralized before the analyst even opens the ticket.

The Cybersecurity Blueprint: How to adopt the right cybersecurity strategy for your business
Featured Resource

The Cybersecurity Blueprint: How to adopt the right cybersecurity strategy for your business

Scale your security with confidence. This blueprint provides the strategic framework needed to transform your automated API workflows into a resilient enterprise defense system.

Download White paper

Workflow 3: Bulk Provisioning (CSV → Kiosk)

The Scenario:

You are deploying 500 tablets to a retail chain. They need to be assigned to 500 different “Store Groups” based on their Serial Number to get the correct localized content.

  • The Old Way: Manually searching each serial number in the GUI and clicking “Add to Group.” (Approx. 10 hours of work).

The Automated Workflow:

  • The Source: You have a CSV file from the procurement team: Serial_Number, Store_ID.
  • The Script: A simple loop reads the CSV, finds the device ID via the API, and assigns it to the correct group.
  • The Result: 500 devices are provisioned in 30 seconds.

💡 Static vs. Smart Groups

Why we use Static Groups here: In Hexnode, Smart Groups are dynamic—they work like a saved search (e.g., “All iPads with iOS 17”). Because their membership is governed by automated rules, you cannot manually “force” a device into one via API. For this workflow, we use Custom (Static) Groups. This allows your script to explicitly “assign” a device to a specific Store ID group, ensuring the device inherits the correct localized policies immediately upon provisioning.


This is the essence of Programmable Infrastructure. By treating your device fleet as a dataset rather than a collection of physical objects, you can manipulate it with the speed and precision of software.

Infrastructure as Code: Provisioning Kiosk Fleets via API

Best Practices for the API Architect

Before you start scripting, adhere to these “Senior Developer” standards:

  1. Rate Limiting: Hexnode enforces API rate limits to protect the integrity of the cloud. Implement “Exponential Backoff” in your scripts (e.g., if you get a 429 Too Many Requests, wait 2 seconds, then 4, then 8 before retrying).
  2. Least Privilege: Do not embed your Super Admin API Key in every script. Create specific API credentials for specific tasks if possible, or use a secrets manager (like HashiCorp Vault) to store the keys.
  3. Idempotency: Ensure your scripts are safe to run twice. For example, before adding a device to a group, check if it is already in the group to avoid redundant API calls.

Conclusion: You Are Building a Platform

When you use the Hexnode GUI, you are using a tool.

When you use the Hexnode API, you are building a Platform.

You are building a custom ecosystem where your CI/CD pipeline, your Security Operations Center, and your HR system all talk to your device fleet in real-time. This is the level of maturity that separates “Device Management” from “Enterprise Orchestration.”

Stop clicking buttons. Start building workflows.

Frequently Asked Questions

What are dynamic parameters in MDM?

Dynamic parameters (wildcards) are placeholders in a policy that resolve into specific user or device data—like %email% or %serialnumber%—at the moment of deployment. They allow one policy to adapt to every device automatically.

How do dynamic parameters prevent “Policy Bloat”?

Instead of creating dozens of separate policies for different departments or users, you create a single “Master Policy.” The parameters handle the personalization, reducing the total number of managed policies by up to 80%.

Can I use wildcards in custom scripts?

Yes. You can use Hexnode wildcards in PowerShell (Windows) and Bash (macOS). Wrapping them in quotes (e.g., “%name%“) ensures the script handles spaces or special characters in user attributes without failing.

What happens if an attribute value is missing?

If a field is empty, the policy might push a blank value or fail. To prevent this, use fallback logic with the OR operator (e.g., %department%OR”Retail”) to provide a default value if the primary attribute is null.

Do dynamic parameters update automatically?

Yes. They are reactive. If you update a user’s department or email in the Hexnode portal or your synced Directory (like Entra ID), the policy reflects that change during the device’s next sync—no re-enrollment required.

Share

Aurelia Clark

Fuelled by coffee, curiosity, and a mildly concerning number of open tabs

Resources Image