The Courier Java SDK provides typed access to the Courier REST API from applications written in Java 8+. It uses builder-pattern request construction, OkHttp for transport, and returns strongly typed response objects. Available on GitHub and Maven Central.Documentation Index
Fetch the complete documentation index at: https://www.courier.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Installation
LATEST_VERSION with the current version from Maven Central. Requires Java 8+.
Quick Start
Authentication
Get your API key from Settings > API Keys in the Courier dashboard. Set it as an environment variable:| Setter | System property | Environment variable | Default |
|---|---|---|---|
apiKey | courier.apiKey | COURIER_API_KEY | — |
baseUrl | courier.baseUrl | COURIER_BASE_URL | https://api.courier.com |
Sending Notifications
With a template
With inline content
Available Resources
The SDK covers the full Courier API. Every method returns strongly typed response objects.| Resource | Namespace | Description |
|---|---|---|
| Send | client.send() | Send messages to one or more recipients |
| Messages | client.messages() | Retrieve status, history, and content of sent messages |
| Profiles | client.profiles() | Create, update, and retrieve user profiles |
| Users | client.users() | Manage preferences, tenants, and push tokens per user |
| Auth | client.auth() | Issue JWT tokens for client-side SDK authentication |
| Bulk | client.bulk() | Send messages to large recipient lists via jobs |
| Lists | client.lists() | Manage subscription lists and their subscribers |
| Audiences | client.audiences() | Define and query audience segments |
| Tenants | client.tenants() | Manage tenants for multi-tenant setups |
| Automations | client.automations() | Invoke multi-step automation workflows |
| Brands | client.brands() | Manage brand settings (logos, colors, templates) |
| Notifications | client.notifications() | List and inspect notification templates |
| Translations | client.translations() | Manage localized content |
Common Operations
Checking Message Status
Managing User Profiles
Issuing JWT Tokens
| Scope | Permission |
|---|---|
user_id:<id> | Which user the token is for (required) |
inbox:read:messages | Read inbox messages |
inbox:write:events | Mark messages as read/archived |
read:preferences | Read notification preferences |
write:preferences | Update notification preferences |
write:user-tokens | Register push notification tokens |
Configuration
Error Handling
When the API returns a non-success status code, the SDK throws aCourierServiceException:
Retries
The SDK automatically retries failed requests up to 2 times with exponential backoff. Configure globally:Timeouts
Requests time out after 60 seconds by default. Configure globally:withOptions:
More Operations
The SDK covers the full Courier REST API. Here are a few more resources beyond what’s documented above:| Resource | Method | Use case |
|---|---|---|
| User preferences | client.users().preferences().retrieve(userId) | Fetch a user’s notification preferences for your preference center |
| Cancel a message | client.messages().cancel(messageId) | Cancel a delayed or queued message before delivery |
| Push tokens | client.users().tokens().addSingle(token, params) | Register a device push token for iOS, Android, or React Native |
| Automations | client.automations().invoke().invokeAdHoc(params) | Run a multi-step workflow via Automations |
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.