Skip to content
  • There are no suggestions because the search field is empty.

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:

OptionHow
Environment variableALERTOPS_API_KEY=<your key>
.env fileAlertOps(dotenv=".env") reads ALERTOPS_API_KEY from the file
Client optionAlertOps(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

TaskMethod
Find or create a groupao.groups.ensure
Create an on-call shiftao.schedules.create_shift
Create an API integrationao.inbound.create_api
Send an alertao.ingest.post_to_integration
List recent alertsao.alerts.list_recent
Post a status page incidentao.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

GoalWhere to start
Keep on-call teams in sync with your HR or identity systemUsers, groups and schedules
Send alerts from your own servicesInbound integrations and alert ingestion
Roll out a complete on-call setup from a short descriptionThe semantic layer
Publish incidents to customersStatus 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

Need help?

Email support@alertops.com or contact your AlertOps representative.