Skip to main content
POST
/
send
JavaScript
import Courier from '@trycourier/courier';

const client = new Courier({
  apiKey: 'My API Key',
});

const response = await client.send.message({
  message: { to: { user_id: 'example_user' }, template: 'template_id', data: { foo: 'bar' } },
});

console.log(response.requestId);
{
  "requestId": "1-65f240a0-47a6a120c8374de9bcf9f22a"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
message
object
required

Defines the message to be delivered The message property has the following primary top-level properties. They define the destination and content of the message.

Response

200 - application/json
requestId
string
required

A successful call to POST /send returns a 202 status code along with a requestId in the response body. For single-recipient requests, the requestId is the derived message_id. For multiple recipients, Courier assigns a unique message_id to each derived message.

Example:

"1-65f240a0-47a6a120c8374de9bcf9f22c"