Skip to main content
The Courier Ruby SDK provides typed access to the Courier REST API from any Ruby 3.2+ application. It ships with Yard docstrings, RBS and RBI type definitions for Sorbet, and uses net/http with connection pooling. Available on GitHub and RubyGems.

Installation

Add to your Gemfile:
Then run bundle install. Requires Ruby 3.2+. See RubyGems for the latest version.

Quick Start

The client reads COURIER_API_KEY from your environment automatically. You can also pass it explicitly: Courier::Client.new(api_key: "your-key").
The method is send_ (with a trailing underscore) because send is a reserved method in Ruby.

Authentication

Get your API key from Settings > API Keys in the Courier dashboard. Set it as an environment variable:
The SDK picks this up by default. To pass it explicitly:

Sending Notifications

With a template

With inline content

Available Resources

The SDK covers the full Courier API. Every method is documented with Yard docstrings.

Common Operations

Checking Message Status

Managing User Profiles

Issuing JWT Tokens

Configuration

Error Handling

The SDK throws typed errors for API failures. All errors extend Courier::Errors::APIError:

Retries

The SDK automatically retries failed requests up to 2 times with exponential backoff.

Timeouts

Requests time out after 60 seconds by default. Configure globally or per-request:

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 (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.