Skip to main content

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.

  1. Visit https://machineid.io
  2. Create a free organization
  3. 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 allowed is 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

machineid_io-0.1.4.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

machineid_io-0.1.4-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file machineid_io-0.1.4.tar.gz.

File metadata

  • Download URL: machineid_io-0.1.4.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for machineid_io-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d91532a0e859c5177928422e0f9a5458088e321e9afc77b9351c630e29bfe632
MD5 2e7e4ab1119781459109260877232098
BLAKE2b-256 fbb169eab9df1288812228c8384f36ace7f64c83e2024238b79986cf2a0b9274

See more details on using hashes here.

File details

Details for the file machineid_io-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: machineid_io-0.1.4-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

Hashes for machineid_io-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7294efd6ce10d130b7fbd1714e0450383d6c5f5c7f964ecddc352348858dd433
MD5 a1f5fc06a2d2520ff5472c66abeaa88e
BLAKE2b-256 d08aaf9e8f9a2f3228d835b1d0abf7122152b3ed4531f2cef9bf816e9a3e1543

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page