Skip to main content

DevHelm Python SDK

Typed Python client for the DevHelm monitoring API — monitors, incidents, alerting, and more.

Installation

pip install devhelm

Quick Start

from devhelm import Devhelm

client = Devhelm(token="your-api-token")

# List all monitors
monitors = client.monitors.list()
for m in monitors:
    print(f"{m.name} — {m.type}")

# Create a monitor
monitor = client.monitors.create({
    "name": "My API Health",
    "type": "HTTP",
    "config": {"url": "https://api.example.com/health", "method": "GET"},
    "frequencySeconds": 60,
    "regions": ["us-east"],
    # `managedBy` records who reconciles drift on this resource. Use
    # "DASHBOARD" (the default for one-off SDK scripts), "CLI" if the
    # monitor lives in a `devhelm.yml` you re-deploy, or "TERRAFORM"
    # if it lives in `.tf` you re-apply.
    "managedBy": "DASHBOARD",
})

# Get a single monitor
monitor = client.monitors.get(monitor.id)

# Inbound testing. `webhooks` stays outbound alert delivery.
inbox = client.inboxes.create(name="stripe")
event = inbox.wait(timeout_ms=30_000, http={"method": "POST"})
payment = event.json()
raw = event.raw()

to = client.email.address(label="signup")
message = to.wait(timeout_ms=60_000, subject_contains="code")
code = message.otp[0].value if message.otp else None
pdf = message.attachments[0].bytes() if message.attachments else None

# Pause / resume
client.monitors.pause(monitor.id)
client.monitors.resume(monitor.id)

# Delete
client.monitors.delete(monitor.id)

Configuration

from devhelm import Devhelm

client = Devhelm(
    token="your-api-token",            # required (or DEVHELM_API_TOKEN env var)
    org_id="1",                        # optional — see notes below
    workspace_id="1",                  # optional — see notes below
    base_url="https://api.devhelm.io", # optional, defaults to production
)

Environment variables are used as fallbacks when constructor arguments are not provided:

Parameter Required Env Variable Notes
token Yes DEVHELM_API_TOKEN Personal or workspace API token.
org_id No DEVHELM_ORG_ID Auto-resolved if your token is scoped to one org. Required only when the token has access to multiple.
workspace_id No DEVHELM_WORKSPACE_ID Auto-resolved if your token is scoped to one workspace. Required only when the token spans multiple.

Resources

The client exposes the following resource modules:

Resource Description
client.monitors HTTP, DNS, TCP, ICMP, MCP, and Heartbeat monitors
client.incidents Manual and auto-detected incidents
client.alert_channels Slack, email, webhook, and other alert channels
client.notification_policies Routing rules for alerts
client.environments Environment grouping (prod, staging, etc.)
client.secrets Encrypted secrets for monitor auth
client.tags Organize monitors with tags
client.resource_groups Logical resource groups
client.webhooks Outgoing webhook endpoints
client.inboxes Inbound HTTP capture URLs
client.email Inbound mailboxes and custom domains
client.api_keys API key management
client.dependencies Service dependency tracking
client.deploy_lock Deploy lock for safe deployments
client.services Status Data catalog: vendor services, components, incidents, uptime
client.status Dashboard overview

Pagination

List methods auto-paginate by default. For manual page control:

# Auto-paginate (fetches all pages)
all_monitors = client.monitors.list()

# Manual page control
page = client.monitors.list_page(page=0, size=20)
print(page.data)       # list of monitors
print(page.has_next)   # True if more pages
print(page.has_prev)   # True if previous page exists

# Cursor pagination (for check results)
results = client.monitors.results(monitor_id, limit=50)
print(results.data)
print(results.next_cursor)
print(results.has_more)

Error Handling

The SDK raises three top-level error types (see 040-codegen-policies.md):

  • DevhelmValidationError — local request/response shape validation failed.
  • DevhelmApiError — the API returned a non-2xx status. Subclassed by HTTP class for ergonomics: DevhelmAuthError (401/403), DevhelmNotFoundError (404), DevhelmConflictError (409), DevhelmRateLimitError (429), DevhelmServerError (5xx).
  • DevhelmTransportError — the request never reached a server response (connection refused, timeout, TLS failure, etc.).

Every DevhelmApiError carries:

  • status — the HTTP status code
  • code — coarse machine-readable category (e.g. NOT_FOUND, RATE_LIMITED); switch on this, not the human-readable message
  • request_id — the per-request id from the X-Request-Id response header; always include this in support tickets
from devhelm import Devhelm, DevhelmAuthError, DevhelmError

client = Devhelm(token="bad-token")

try:
    client.monitors.list()
except DevhelmAuthError as e:
    print(f"Auth failed: {e.message} (HTTP {e.status}, request_id={e.request_id})")
except DevhelmError as e:
    print(f"API error [{e.code}]: {e.message}")

Development

# Install dependencies
uv sync

# Run tests
make test

# Lint + format check
make lint

# Type check
make typecheck

# Regenerate types from OpenAPI spec
make typegen

License

MIT

Metadata

Release files for devhelm 1.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for devhelm 1.11.0
File Size Uploaded
devhelm-1.11.0.tar.gz 349.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for devhelm 1.11.0
File Interpreter ABI Platform
devhelm-1.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 479.1 kB

Release files / devhelm-1.11.0.tar.gz

Download URL devhelm-1.11.0.tar.gz
Size 349.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4f92de47c54f4065edfdd5229290031741a2a5c607dc9493cdb3b61171f0001c
BLAKE2b-256 checksum
How to use checksums
f25fe01bf6377c08f5fbe4f048fd4d5e666838927c5d63d4df2aa61a9abaf043
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.16

Release files / devhelm-1.11.0-py3-none-any.whl

Download URL devhelm-1.11.0-py3-none-any.whl
Size 129.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cee0dd3e05d292b1d90cc6ec92c325d69811b5cad85da3289c60c41638993760
BLAKE2b-256 checksum
How to use checksums
2ceea884b76e7456dbbecf0259cf2def2d3ae3b5d8aceb05828abdd5775317b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.16

Release history Release notifications | RSS feed

This release

1.11.0 This release

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.7.2

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page