Create outgoing e-mail

Returns either a newly created outgoing e-mail integration, or validation errors. See the outgoing e-mails guide for the dashboard walkthrough.

POST https://incidents.betterstack.com/api/v2/outgoing-emails

Headers

Authorization
required string
Content-Type
string

Body parameters

team_name
string
name
string
recipients
required array
on_incident_started
boolean
on_incident_acknowledged
boolean
on_incident_resolved
boolean
on_incident_reopened
boolean
on_incident_comment
boolean
notify_alongside_primary_responder
boolean
templates
array
201

Response body

{
  "data": {
    "id": "42",
    "type": "outgoing_email",
    "attributes": {
      "name": "Client distribution list",
      "recipients": [
        {
          "email": "noc@client.com"
        },
        {
          "email": "ops@client.com",
          "first_name": "Sam",
          "team": "SRE"
        }
      ],
      "team_name": "My team",
      "paused": false,
      "notify_alongside_primary_responder": true,
      "on_incident_started": true,
      "on_incident_acknowledged": true,
      "on_incident_resolved": true,
      "on_incident_reopened": true,
      "on_incident_comment": true,
      "templates": [
        {
          "incident_stage": "started",
          "subject": "Incident: $NAME",
          "title": "We're investigating an issue with $NAME",
          "body": "Hi $RECIPIENT.first_name, we detected a problem: $CAUSE. Follow along at $INCIDENT_URL."
        }
      ]
    }
  }
}
403

Response body

{
  "errors": "Can't add an outgoing e-mail integration. Upgrade your account to send incident notifications to external e-mail addresses."
}
422

Response body

{
  "errors": {
    "base": [
      "Please add at least one e-mail address"
    ]
  }
}

Example cURL

Example
curl -X "POST" "https://incidents.betterstack.com/api/v2/outgoing-emails" \
     -H "Authorization: Bearer $TOKEN" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "name": "Client distribution list",
  "recipients": [
    "noc@client.com",
    { "email": "ops@client.com", "first_name": "Sam" }
  ],
  "on_incident_started": true,
  "on_incident_resolved": true,
  "templates": [
    { "incident_stage": "started", "subject": "Incident: $NAME" }
  ]
}'