Skip to main content
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.

Installation

Replace LATEST_VERSION with the current version from Maven Central. Requires Java 8+.

Quick Start

CourierOkHttpClient.fromEnv() reads COURIER_API_KEY from your environment (or the courier.apiKey system property). You can also configure it with the builder: .apiKey("your-key").

Authentication

Get your API key from Settings > API Keys in the Courier dashboard. Set it as an environment variable:
Or pass it via the builder:

Sending Notifications

With a template

With inline content

Available Resources

The SDK covers the full Courier API. Every method returns strongly typed response objects.

Common Operations

Checking Message Status

Managing User Profiles

Issuing JWT Tokens

Configuration

Error Handling

When the API returns a non-success status code, the SDK throws a CourierServiceException:

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:
Or override per-request using withOptions:

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 a run with client.journeys().cancel(...), passing exactly one of run_id or cancelation_token (spelled with one “l”). You can also build and manage journeys from code (create, list, publish, 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.