Official Python SDK for the MachineID.io API
Project description
MachineID Python SDK
Official Python client for the MachineID API.
This SDK provides a thin, explicit wrapper around MachineID’s device enforcement endpoints.
It is designed for AI agents and distributed systems that need predictable, real-time control over whether a process is allowed to execute.
MachineID acts as an authority layer — not an orchestrator — enabling centralized revoke / allow decisions without managing processes directly.
Installation
pip install machineid-io
Prerequisite (Free Org Key)
MachineID offers a free org key with no billing required.
- Visit https://machineid.io
- Create a free organization
- Copy your org API key (starts with
org_...)
Set it as an environment variable:
export MACHINEID_ORG_KEY=org_your_key_here
Quick Start
from machineid_io import MachineID
client = MachineID.from_env() device_id = "agent-01"
Optional: check plan usage / limits
usage = client.usage() print("Plan:", usage.get("planTier"), "Limit:", usage.get("limit"))
Register device (idempotent)
reg = client.register(device_id)
if reg.get("status") not in ("ok", "exists"): raise RuntimeError(f"Register failed: {reg}")
print("Register success:", reg.get("status"))
Validate before performing work (HARD GATE)
val = client.validate(device_id)
if not val.get("allowed"): print("Device blocked:", val.get("code"), val.get("request_id")) raise SystemExit("Execution denied")
print("Device allowed")
Validate Semantics (Important)
The validate call is the enforcement checkpoint.
- You must stop execution immediately when
allowedis False - A revoked or blocked device will continue running only if you ignore validate
Validate returns structured decision metadata, including:
- allowed — boolean
- code — stable decision code (ALLOW, DEVICE_REVOKED, PLAN_FROZEN, etc.)
- request_id — correlation ID for logs and support
- status / reason — legacy fields (still included)
Supported Operations
This SDK supports:
- register(device_id)
- validate(device_id) (POST, canonical)
- list_devices()
- revoke(device_id)
- unrevoke(device_id)
- remove(device_id)
- usage()
All requests authenticate via the x-org-key header and return raw API JSON.
Scope
This SDK intentionally does not:
- create organizations
- manage billing or checkout
- spawn or orchestrate agents
- perform analytics or metering
It is a device-level enforcement and validation layer only.
Environment-Based Setup
from machineid_io import MachineID
client = MachineID.from_env()
Version
import machineid_io print(machineid_io.version)
Documentation
Docs: https://machineid.io/docs
Dashboard: https://machineid.io/dashboard
Pricing: https://machineid.io/pricing
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file machineid_io-0.1.5.tar.gz.
File metadata
- Download URL: machineid_io-0.1.5.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c28a7df2c5366f0865a18e99f587ad18bf74ed0016978e9b5d0cd73c76eea63a
|
|
| MD5 |
6f020bf6b24bbd6c16855165d46891e4
|
|
| BLAKE2b-256 |
a9627ed213ab227ca8116e4f068a1de8c8ef1b156ecee2216bc23c9628e8b05f
|
File details
Details for the file machineid_io-0.1.5-py3-none-any.whl.
File metadata
- Download URL: machineid_io-0.1.5-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e4e5769fed7444d09339ba5318dbbd98fc9e78770f4b7d4d6ad7daece37b19c
|
|
| MD5 |
9c1d38362e75719b02561744eeb4a86e
|
|
| BLAKE2b-256 |
4cc16c3b5edcb1242a6cf99808887521e83d10bc81150637427560909c03a428
|