Skip to main content
The Python SDK gives you a typed client for the whole incident.io API. There’s a module for every endpoint and a type for every request and response, all generated from our OpenAPI specification. It ships type annotations, so a type checker like mypy or Pyright can catch mistakes before you run anything. It requires Python 3.11 or later.

Installing

Your first request

You’ll need an API key from Settings > API keys (see API keys). Then:
The isinstance check matters. A failed request doesn’t raise: it comes back as an ErrorResponse, so result is one of the two. Your type checker will tell you if you skip the check.

How endpoints work

Every endpoint is a module with four functions:
  • sync returns the parsed body, or an ErrorResponse for a documented error.
  • sync_detailed returns a Response with status_code, headers, and parsed. This is the most direct way to tell success from failure.
  • asyncio and asyncio_detailed are the async versions of the two above, and share the same client.

Pagination

List endpoints are cursor-paginated. Read the next cursor from pagination_meta.after and pass it back as after:
Optional fields that the API didn’t send are UNSET rather than None, which is why the check above looks for Unset.

Configuration

AuthenticatedClient takes keyword arguments:
raise_on_unexpected_status=True raises incident_io.errors.UnexpectedStatus for a status code the schema doesn’t document, instead of returning None. Documented errors still come back as an ErrorResponse. The client is built on httpx. To reuse a connection pool or bring your own transport, pass httpx_args, or hand the client a configured instance with client.set_httpx_client(...).

Deprecated endpoints

Endpoints we’ve deprecated (for example the v1 incidents and custom fields endpoints, superseded by v2) stay available, but calling one issues a DeprecationWarning naming the endpoint. Python hides these by default, so run with -W default::DeprecationWarning to see them.

Versioning

The SDK is kept up to date with the API automatically. Additions to the API are minor versions. A change that would break your code, like a removed field, is released as a new major version, and its release notes list what changed.

Resources

PyPI

The incident-io package and its versions.

GitHub

Source, README, and issues for the Python SDK.

API reference

Endpoints, authentication, rate limits, and errors.

All SDKs

Clients for Go, TypeScript, Rust, Ruby, PHP, and .NET.