Skip to main content
The Courier Ruby SDK gives typed access to the 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. Pass it explicitly: Courier::Client.new(api_key: "YOUR_COURIER_API_KEY").
The method is send_ (with a trailing underscore) because send is a reserved method in Ruby.

Authentication

Get your API key from in the Courier dashboard. Set it as an environment variable:
The SDK reads it by default. To pass the key explicitly:

Sending notifications

Design your notification in , then reference it by ID:

Available resources

The SDK covers the full Courier API. Every method carries Yard docstrings.

Common operations

Checking message status

Managing user profiles

Issuing JWT tokens

Courier’s (React, JavaScript, mobile) authenticate users with a JWT your backend issues. covers the token flow, the scope strings, and token refresh. Use client.auth.issue_token:

Configuration

Error handling

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

Retries

The SDK 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

are multi-step workflows: send, delay, branch, throttle, digest, and more. Invoke one by ID or alias to start a run. Cancel runs by ID, or by a shared cancelation token.
cancel takes exactly one of run_id or cancelation_token (spelled with one “l”). Build and manage journeys from code with create, list, publish, and archive. See .

More operations

A few more resources from the full :

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.

Idempotent sends

Pass an idempotency key and Courier replays the first response for that key instead of sending again. The SDK sets the Idempotency-Key header for you. covers the scoping rule and the replay window.