Installation
Quick Start
Authentication
Get your API key from Settings > API Keys in the Courier dashboard. Set it as an environment variable:We recommend using a
.env file with python-dotenv so your API key stays out of source control.Sending Notifications
With a template
Design your notification in Design Studio, then reference it by ID:With inline content
Skip templates and define content directly in code:To multiple recipients
Send to a list of users in a single call:Async Usage
Basic async client
ImportAsyncCourier instead of Courier and use await:
Using aiohttp instead of httpx
For improved concurrency performance, you can swap the HTTP backend toaiohttp:
Available Resources
The SDK covers the full Courier API. Every method is typed and documented with docstrings.Common Operations
Checking Message Status
After sending, use therequest_id to check delivery status or get the full event timeline:
Managing User Profiles
Profiles store recipient data (email, phone, custom fields) that Courier uses for delivery. You need a profile before you can send to auser_id.
create merges with any existing profile. Use replace for a full overwrite (any fields not included will be removed).Issuing JWT Tokens
If you use Courier’s client-side SDKs (React, JavaScript, mobile), your backend needs to issue JWT tokens for user authentication. Theauth.issue_token method handles this:
scope string controls what the token can access. Common scopes:
Bulk Sending
For large recipient lists, use the bulk API. It works in three steps: create a job, add users, then run it.Type Safety
Request parameters are TypedDicts, and responses are Pydantic models. This gives you autocomplete and inline docs in your editor.Configuration
Error Handling
The SDK throws typed errors for API failures. All errors extendcourier.APIError:
Retries
The SDK automatically retries failed requests up to 2 times with exponential backoff. Retried errors include connection failures, 408, 409, 429, and 5xx responses.Timeouts
Requests time out after 60 seconds by default. Configure globally or per-request:APITimeoutError is thrown. Timed-out requests are retried by default.
Logging
Enable debug logging with theCOURIER_LOG environment variable:
logging module, so it integrates with any logging setup you already have.
Raw Response Access
Access HTTP headers or stream the response body:Custom HTTP Client
Override the default httpx client for proxies, custom transports, or other advanced use cases:Journeys
Journeys are multi-step workflows (send, delay, branch, throttle, digest, and more). Invoke one by ID or alias to start a run, then cancel runs by ID or a shared cancelation token.cancel takes exactly one of run_id or cancelation_token (spelled with one “l”). You can also build and manage journeys from code with client.journeys.create, list, publish, and archive. See Build journeys via API.More Operations
The SDK covers the full Courier REST API. Here are a few more resources beyond what’s documented above:API Reference
Full REST API docs with request/response examples.
Send API
Learn about the Send endpoint, routing, and message options.
Quickstart
Send your first notification in under two minutes.
GitHub
Source code, issues, and changelog.