Skip to main content
Send one notification to thousands of recipients you supply yourself, with a job you can abandon before anything goes out. Use a list or audience when Courier already holds the group. Use a bulk job when the recipients come from your own system and you pass them in per call. A loop of Send API calls sends each message as it goes. A bulk job sends nothing until you run it, and you build it across as many ingestion calls as you need. An ingestion that fails halfway has delivered nothing, so abandon that job and build a fresh one.

What you’ll build

  1. Create the job.
  2. Ingest recipients, in as many calls as you need.
  3. Run the job once everyone is in.
  4. Poll for progress.

Prerequisites

Run a bulk job

Create the job with the notification and any shared data, ingest recipients into it, then run it once and poll for progress. Ingestion is open-ended and the job doesn’t expire while you fill it. A job runs once, and you can’t recall it after you run it.
1

Create the job

POST /bulk defines the job with an event and any global data that applies to everyone. The required event is either a notification ID or a custom event ID mapped to a notification.
Returns 201 Created with the job ID you use for every call that follows:
You can also pass brand, locale, and override. To send something other than the notification attached to the event, add template. event stays required.
Make a retry safe.
Send an Idempotency-Key header and a retry replays the original result. A repeated create returns the first jobId instead of opening a second job.
2

Ingest your recipients

POST /bulk/{job_id} adds recipients to the job. Identify each one in to, and put their personal variables in data, which merges into the job’s global message.data.
Returns 200 OK, where total is the running count for the whole job rather than the current call:
Provider routing reads profile.email, not to.email. Put each recipient’s address in profile.email so the job delivers to it.Each recipient accepts four fields:
  • to.user_id, who they are
  • profile, inline contact data
  • data, per-recipient variables
  • preferences, per-recipient overrides
Call this endpoint as often as you need, with 1,000 recipients per call. A bigger batch can time out and return a 502 instead of a validation error.
Ingestion doesn’t deduplicate.
The same user_id ingested twice becomes two messages, so deduplicate your list before you ingest it.
3

Run the job

Once everyone is in, POST /bulk/{job_id}/run triggers the send. Courier fans out and delivers to each recipient.
Returns 202 Accepted with an empty body, and the job starts processing in the background. Running it again returns 400 BulkJobDuplicateInvocationError, so create a new job to reach more recipients.
4

Track progress

GET /bulk/{job_id} returns the job’s counts and overall status.
  • received: recipients ingested.
  • enqueued: messages that reached the delivery pipeline.
  • failures: errors hit while processing.
  • status: CREATED, PROCESSING, COMPLETED, or ERROR. COMPLETED and ERROR are both terminal, so stop polling on either one.

Verify

1

Confirm the counts line up

Poll the job until it reaches COMPLETED, then check that enqueued matches received and failures is zero.
2

Spot-check a recipient

GET /bulk/{job_id}/users pages through the job’s recipients. Leave cursor off the first request, then keep passing paging.cursor back while paging.more is true.
Each item carries the recipient as you ingested it, a status of PENDING, ENQUEUED, or ERROR, and a messageId once enqueued:
3

Trace one message end to end

A messageId is the same ID a regular send returns, so look one up in message logs and confirm it delivered.
To skip polling, track delivery with an outbound webhook and handle message:updated, which fires on every status change for every message the job produced.

Troubleshooting