The management API
Everything you can do per app in the console also works as a REST call, so a fleet can be provisioned from CI/CD, configuration management or an MDM. This page is the endpoint reference: What each call does, how you authenticate, and why the API never sees protected content.
What it is
- A small REST surface for the app lifecycle: Create, enroll, list, deactivate and delete protected apps.
- Built for automation: Bake an un-enrolled daemon into a golden image and mint enrollment codes in advance; each machine enrolls itself on first start.
- Machine-readable: An OpenAPI 3 specification is published alongside this page.
Management plane versus data plane
The decisive property is what this API does not see. The system has two distinct planes:
| Plane | Traffic | Sees content? |
|---|---|---|
| Management plane | This API: App lifecycle and metadata only (identifier, name, status, platform, agent version, timestamps, enrollment codes). | No: No memory content, no diff, no evaluation payload ever crosses it. |
| Data plane | The daemon's own traffic: Check-ins and, in the cloud-assisted flow, evaluation of redacted diffs. | Content stays on the device; only a redacted projection is evaluated. |
Authentication
Callers authenticate with a bearer key created in the console under Settings, API keys. The key (pz_live_ followed by forty characters) is shown once; at rest only its SHA-256 hash is stored, so a database disclosure yields no usable credential.
curl -H "Authorization: Bearer pz_live_..." \ https://poisonzero.com/api/v1/apps
- Owner-scoped: Every request is bound to the key's owner.
- No enumeration: A foreign or unknown app answers an identical
404, so identifiers outside your fleet cannot be probed. - Ten active keys per account; any key can be revoked independently.
Endpoints
The endpoints mirror the console and are reached over HTTPS at poisonzero.com/api/v1/. Every call takes the bearer key:
| Endpoint | Purpose | Returns |
|---|---|---|
POST /v1/apps | Create an app and a first enrollment code in one call (optional body {"name":"..."}). | 201 with appId, enrollCode, enrollCodeExpiresAt. |
GET /v1/apps | List your fleet. | One entry per app (see the app object below). |
GET /v1/apps/{appId} | Fetch one app. | 404 for unknown or foreign IDs. |
POST /v1/apps/{appId}/enroll-code | Mint a fresh enrollment code, for example to re-provision a machine. | 201; codes are single-use and valid for 30 days. |
POST /v1/apps/{appId}/revoke | Deactivate an app; status becomes revoked and the daemon's credentials stop working immediately. | appId and status. |
DELETE /v1/apps/{appId} | Delete an app permanently (app, configuration, daemon identity, open codes, review-queue entries; audit logs are retained). | 204. |
POST /v1/install-codes | Create a fleet install code that enrolls many devices. | 201 with id, code, expiresAt and maxRedemptions. The code appears only in this response. |
GET /v1/install-codes | List your install codes. | Each entry holds metadata only, never the code. |
POST /v1/install-codes//docs/id/revoke | Revoke an install code so no further device can enroll with it. | id and status. |
GET / PUT / DELETE /v1/otel-config | Manage the OpenTelemetry export configuration for the fleet (Enterprise). | See the observability export page. |
POST /v1/intune/windows-package | Download the Windows Intune package (.intunewin) of your tenant with a new install code inside. | The file as the response body, details in X-PZ-* headers. |
POST /v1/intune/macos-script | Download the ready Intune shell script for macOS with a new install code inside. | The script as the response body, details in X-PZ-* headers. |
POST /v1/intune/linux-script | Download the ready Intune shell script for Linux with a new install code inside. | The script as the response body, details in X-PZ-* headers. |
POST /v1/intune/macos-profile | Download the macOS configuration profile (.mobileconfig) with a new install code inside. | The profile as the response body, details in X-PZ-* headers. |
GET and PUT on /v1/otel-config require an Enterprise owner (otherwise 403); DELETE is always allowed so a downgraded owner can still purge a stored collector secret. The export itself: OpenTelemetry export.Fleet install codes
One install code enrolls many devices, so an Intune or ConfigMgr package needs one code, not one per machine. The API follows the console rules: A code is valid for 30 days, and its device cap follows your plan. The create call takes three optional fields:
| Field | Meaning |
|---|---|
deviceMode | cloud (default) or private sets the mode of every device enrolled with the code. |
profileId | The enrolled devices get this policy profile. |
maxRedemptions | The device cap of the code. On Free and Pro the default is your free device slots, and the plan's device limit is the ceiling. On Enterprise the default is unlimited. |
Pipe the code straight into the next step, here a CI secret, so it never shows up in a log:
curl -fsS -X POST https://poisonzero.com/api/v1/install-codes \
-H "Authorization: Bearer $PZ_API_KEY" -H "Content-Type: application/json" \
-d '{"maxRedemptions": 500}' \
| jq -r .code | gh secret set PZ_ENROLL_CODEid, which cannot enroll a device. Revoking stops new enrollments; devices already enrolled keep working. How the device uses the code: Enroll a device on your account.The app object
List and fetch return the lifecycle metadata of each app, never content:
| Field | Meaning |
|---|---|
appId | Stable app identifier. |
name | Display name. |
status | pending, active or revoked. |
platform | Reported operating system. |
agentVersion | Reported daemon version. |
lastSeenAt, createdAt | Timestamps. |
Transport
- HTTPS at
poisonzero.com/api/v1/; a reverse proxy forwards only the method, path, authorization header, content type and a size-capped body. - The path is decoded to a fixed point and any dot-segment or backslash is rejected, closing path-traversal attempts.
- Fleet management is not gated on an active subscription, so you can provision and revoke while a plan is being arranged.
Errors
All errors share one shape, {"error":{"code":"...","message":"..."}}, with a stable machine-readable code:
| Status | Meaning |
|---|---|
400 | Validation, for example invalid_name, limit_reached or invalid_argument. |
401 | Missing, invalid or revoked key, or a disabled account. |
404 | Unknown endpoint, or an unknown or foreign app ID or install code ID. |
413 | Request body over 64 KiB (payload_too_large). |
429 | Too many requests; slow down and retry (up to 600 per minute per account). |
/docs/api/openapi.json.Read next
The Enterprise export configured through /v1/otel-config: OpenTelemetry export. Where enrollment codes are used at rollout: Installing the poison0 agent.
Intune files for your tenant
You get through the API the same ready files as the console button Download Intune package: The Windows package, the macOS profile and the scripts for macOS and Linux. Each call makes a new install code, valid for one year, and puts it inside the file. A pipeline can fetch a fresh file and hand it to Intune. GET answers like POST; POST is the call, because it makes a key.
| Field or header | Meaning |
|---|---|
deviceNameFromHostname | Optional, true or false (default false). With true, every device enrolled with the file reports its computer name as its device name. POST takes it in the JSON body, GET as a query parameter. Anything else is 400 invalid_argument. |
Content-Disposition | The file name, for example pcg-poisonzero.intunewin or pcg-poisonzero-macos.sh, named after your tenant. |
X-PZ-Install-Code-Id | The id of the new code, as GET /v1/install-codes lists it. POST /v1/install-codes//docs/id/revoke revokes it. |
X-PZ-Install-Code-Last4 | The last four characters of the code, as the console lists them. |
X-PZ-Expires-At | When the code expires (ISO 8601), one year after the call. |
X-PZ-Max-Redemptions | The device cap of the code: A number, or unlimited on Enterprise. |
X-PZ-Sha256 | The SHA-256 digest of the response body. |
X-PZ-Version | Windows package only: The agent release the package installs. |
curl -fsS -X POST https://poisonzero.com/api/v1/intune/windows-package \
-H "Authorization: Bearer $PZ_API_KEY" -H "Content-Type: application/json" \
-d '{"deviceNameFromHostname": true}' \
-o pcg-poisonzero.intunewin
curl -fsS -X POST https://poisonzero.com/api/v1/intune/macos-script \
-H "Authorization: Bearer $PZ_API_KEY" -o pcg-poisonzero-macos.sh| Status | Meaning |
|---|---|
429 | rate_limited: More than 10 calls per hour for this API key or 30 per day for the account. |
429 | intune_code_limit: Too many active Intune install codes; revoke old ones. |
500 | package_failed: The file could not be created; its new install code is revoked again. |
503 | rate_limit_unavailable or release_unavailable: Retry later. |
503 release_unavailable), no code is made.macOS profile
POST /v1/intune/macos-profile returns the profile for the package and profile rollout on macOS (Intune, Jamf or any other MDM). The response is the .mobileconfig file (Content-Type: application/x-apple-aspen-config), named <tenant>-poisonzero-macos.mobileconfig, with a new install code inside (label Intune macOS profile with the date, valid for one year). Options, headers (without X-PZ-Version), limits and errors are the same as above. deviceNameFromHostname sets the key DeviceNameFromHostname in the profile. The package poisonzero-<version>.pkg is the same for every customer and is not part of the API. The steps are in Install the poison0 agent on macOS.
curl -fsS -X POST https://poisonzero.com/api/v1/intune/macos-profile \
-H "Authorization: Bearer $PZ_API_KEY" -H "Content-Type: application/json" \
-d '{"deviceNameFromHostname": true}' \
-o pcg-poisonzero-macos.mobileconfig