Getting Started with the AlertOps Python SDK
Install alertops-sdk from PyPI, set ALERTOPS_API_KEY and create an AlertOps() client; every AlertOps endpoint is then a method such as ao.groups.list().
Overview
Relevant for Python developers automating AlertOps
The AlertOps Python SDK (alertops-sdk) puts the whole AlertOps API in one client object. Each endpoint is a method on a resource, such as ao.groups.list or ao.escalation_policies.create. It includes a synchronous client (AlertOps), an asynchronous client (AsyncAlertOps) with the same methods, helpers for common multi-step tasks, and the semantic layer for planning on-call setups.
Key benefits:
- Complete — every AlertOps endpoint is available as a method.
- Sync and async — use the same calls from scripts or asyncio services.
- Helpers included — find-or-create, safe updates and alert ingestion in one call.
- Lightweight — Python 3.10 or later; the only runtime dependency is httpx.
Install the SDK
Relevant for Developers setting up a project
pip install alertops-sdk # endpoints and helpers
pip install "alertops-sdk[semantic]" # adds the semantic layer (planners and executor)
Set your API key
Relevant for Developers connecting to an AlertOps account
Create an API key in AlertOps, then make it available to the SDK in one of three ways:
| Option | How |
| Environment variable | ALERTOPS_API_KEY=<your key> |
| .env file | AlertOps(dotenv=".env") reads ALERTOPS_API_KEY from the file |
| Client option | AlertOps(api_key="<your key>") |
Keep the key on servers, in scripts and in CI secrets.
Make your first calls
Relevant for Developers checking that the connection works
from alertops import AlertOps
with AlertOps() as ao:
print(ao.account.time_zone()) # your account's time zone
for g in ao.groups.list.iter(): # every group, across all pages
print(g.group_id, g.group_name)
group, created = ao.groups.ensure("NOC") # find or create a group
ao.groups.members.add_users(group.group_id, [101, 102])
Results are plain JSON objects with attribute access (g.group_name), and paginated endpoints have .iter() and .all() to read every page. For asyncio services, AsyncAlertOps offers the same methods with await.
Common tasks
Relevant for Developers looking for the right method
| Task | Method |
| Find or create a group | ao.groups.ensure |
| Create an on-call shift | ao.schedules.create_shift |
| Create an API integration | ao.inbound.create_api |
| Send an alert | ao.ingest.post_to_integration |
| List recent alerts | ao.alerts.list_recent |
| Post a status page incident | ao.status_hub.incidents.create |
Every other AlertOps feature follows the same pattern, one resource per area of the app.
What you can build
Relevant for Teams planning their first automation
| Goal | Where to start |
| Keep on-call teams in sync with your HR or identity system | Users, groups and schedules |
| Send alerts from your own services | Inbound integrations and alert ingestion |
| Roll out a complete on-call setup from a short description | The semantic layer |
| Publish incidents to customers | Status Hub pages and incidents |
Next steps
Relevant for Developers building their first automation
- Follow the guides for each area: people and schedules, escalation, alert sources, alerts, workflows, status pages and administration.
- Use the semantic layer to plan and apply a complete on-call setup in one call.
- The full developer documentation, with every method, ships with the library: github.com/alertops/alertops-python.
Related Articles
- AlertOps SDKs for Python, TypeScript, Go, Java and .NET
- Users, Groups and On-Call Schedules with the AlertOps SDKs
- Inbound Integrations, Alert Ingestion and Heartbeats with the AlertOps SDKs
- Planning On-Call Setups with the AlertOps Semantic Layer
Need help?
Email support@alertops.com or contact your AlertOps representative.