Skip to main content
The Rootly Python SDK (rootly-sdk) is an auto-generated client for the Rootly API. Every path and method becomes a typed Python module with both synchronous and asynchronous variants, powered by httpx.

Features

  • Full API coverage — every endpoint becomes a Python module with typed parameters and responses
  • Sync and async — each endpoint has blocking (sync) and async (asyncio) variants
  • Type-safe models — generated data models for all request and response types
  • Built on httpx — modern HTTP client with connection pooling, HTTP/2, and event hooks

Requirements

  • Python 3.8+

Installation

pip install rootly-sdk
poetry add rootly-sdk

Quick Start

from rootly_sdk import AuthenticatedClient

client = AuthenticatedClient(
    base_url="https://api.rootly.com",
    token="YOUR_API_TOKEN",
)

Getting an API Key

  1. Log in to your Rootly account
  2. Navigate to Settings > API Keys
  3. Create a new API key with the permissions you need

Usage

Synchronous Requests

from rootly_sdk.api.incidents import list_incidents, get_incident
from rootly_sdk.types import Response

with client as c:
    # List incidents
    incidents = list_incidents.sync(client=c)

    # Get full response details
    response: Response = list_incidents.sync_detailed(client=c)
    print(response.status_code)

Async Requests

from rootly_sdk.api.incidents import list_incidents, get_incident

async with client as c:
    # Async list
    incidents = await list_incidents.asyncio(client=c)

    # Async with full response
    response = await list_incidents.asyncio_detailed(client=c)

Endpoint Pattern

Every endpoint provides four functions:
FunctionDescription
syncBlocking request, returns parsed data or None
sync_detailedBlocking request, returns full Response with status code
asyncioAsync version of sync
asyncio_detailedAsync version of sync_detailed
All path parameters, query parameters, and request bodies become function arguments.

Using Models

from rootly_sdk.models import Incident, Service, Alert

Configuration

Custom Base URL

client = AuthenticatedClient(
    base_url="https://custom.rootly.com",
    token="your-token",
)

Custom SSL Certificate

client = AuthenticatedClient(
    base_url="https://internal_api.rootly.com",
    token="your-token",
    verify_ssl="/path/to/certificate_bundle.pem",
)

Custom httpx Configuration

def log_request(request):
    print(f"{request.method} {request.url}")

def log_response(response):
    print(f"{response.status_code}")

client = AuthenticatedClient(
    base_url="https://api.rootly.com",
    token="your-token",
    httpx_args={
        "event_hooks": {
            "request": [log_request],
            "response": [log_response],
        }
    },
)
You can also access the underlying httpx client directly:
httpx_client = client.get_httpx_client()
async_client = client.get_async_httpx_client()

Feedback & Support