The Courier Go SDK provides typed access to the Courier REST API from applications written in Go. It uses strongly typed request structs withDocumentation 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.
omitzero semantics and returns parsed response types.
Available on
GitHub
and pkg.go.dev.
Installation
Quick Start
Authentication
Get your API key from Settings > API Keys in the Courier dashboard. Set it as an environment variable:Sending Notifications
With a template
With inline content
Available Resources
The SDK covers the full Courier API. Every method is typed and documented with Go docstrings.| 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 returns an error that can be unwrapped to access status and details:Retries
The SDK automatically retries failed requests up to 2 times with exponential backoff. Configure globally or per-request:Timeouts
Requests time out after 60 seconds by default. Configure with a custom context or client option: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(ctx, userId) | Fetch a user’s notification preferences for your preference center |
| Cancel a message | client.Messages.Cancel(ctx, messageId) | Cancel a delayed or queued message before delivery |
| Push tokens | client.Users.Tokens.AddSingle(ctx, token, params) | Register a device push token for iOS, Android, or React Native |
| Automations | client.Automations.Invoke.InvokeAdHoc(ctx, 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.