POST
/
notifications?c=email
curl --request POST \
  --url 'https://api.onesignal.com/notifications?c=email' \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "app_id": "YOUR_APP_ID",
  "include_aliases": {
    "external_id": [
      "<string>"
    ],
    "onesignal_id": [
      "<string>"
    ]
  },
  "target_channel": "email",
  "include_subscription_ids": [
    "<string>"
  ],
  "email_to": [
    "<string>"
  ],
  "included_segments": [
    "<string>"
  ],
  "excluded_segments": [
    "<string>"
  ],
  "filters": [
    {
      "field": "first_session",
      "key": "<string>",
      "relation": ">",
      "value": "1"
    }
  ],
  "email_subject": "This is your email subject.",
  "email_preheader": "<string>",
  "email_body": "<string>",
  "name": "<string>",
  "template_id": "<string>",
  "custom_data": {},
  "email_from_name": "Your Company",
  "email_from_address": "<string>",
  "email_sender_domain": "<string>",
  "email_reply_to_address": "<string>",
  "include_unsubscribed": true,
  "disable_email_click_tracking": true,
  "send_after": "<string>",
  "delayed_option": "<string>",
  "delivery_time_of_day": "<string>",
  "idempotency_key": "<string>"
}'
{
  "id": "<string>",
  "external_id": "<string>",
  "errors": {
    "invalid_email_tokens": [
      "<string>"
    ],
    "invalid_aliases": {
      "external_id": [
        "[\"user_id_1\", \"user_id_1\", \"user_id_2\"]"
      ],
      "onesignal_id": [
        "[\"1589641e-bed1-4325-bce4-d2234e578884\", \"1589641e-bed1-4325-bce4-d2234e578884\", \"1589641e-bed1-4325-bce4-d2234e578884\"]"
      ]
    },
    "invalid_player_ids": [
      "<string>"
    ]
  }
}

Overview

The Create message API allows you to send push notifications, emails, and SMS to your users. This guide is specific for email. See Push notification or SMS to send to those channels.

Ensure your Email setup is complete.


Headers

Authorization
string
default:Key YOUR_APP_API_KEY
required

Your App API key with prefix Key. See Keys & IDs.

Body

application/json

Response

200
application/json

200

The response is of type object.

POST
/
notifications?c=email
curl --request POST \
  --url 'https://api.onesignal.com/notifications?c=email' \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "app_id": "YOUR_APP_ID",
  "include_aliases": {
    "external_id": [
      "<string>"
    ],
    "onesignal_id": [
      "<string>"
    ]
  },
  "target_channel": "email",
  "include_subscription_ids": [
    "<string>"
  ],
  "email_to": [
    "<string>"
  ],
  "included_segments": [
    "<string>"
  ],
  "excluded_segments": [
    "<string>"
  ],
  "filters": [
    {
      "field": "first_session",
      "key": "<string>",
      "relation": ">",
      "value": "1"
    }
  ],
  "email_subject": "This is your email subject.",
  "email_preheader": "<string>",
  "email_body": "<string>",
  "name": "<string>",
  "template_id": "<string>",
  "custom_data": {},
  "email_from_name": "Your Company",
  "email_from_address": "<string>",
  "email_sender_domain": "<string>",
  "email_reply_to_address": "<string>",
  "include_unsubscribed": true,
  "disable_email_click_tracking": true,
  "send_after": "<string>",
  "delayed_option": "<string>",
  "delivery_time_of_day": "<string>",
  "idempotency_key": "<string>"
}'
{
  "id": "<string>",
  "external_id": "<string>",
  "errors": {
    "invalid_email_tokens": [
      "<string>"
    ],
    "invalid_aliases": {
      "external_id": [
        "[\"user_id_1\", \"user_id_1\", \"user_id_2\"]"
      ],
      "onesignal_id": [
        "[\"1589641e-bed1-4325-bce4-d2234e578884\", \"1589641e-bed1-4325-bce4-d2234e578884\", \"1589641e-bed1-4325-bce4-d2234e578884\"]"
      ]
    },
    "invalid_player_ids": [
      "<string>"
    ]
  }
}

Overview

The Create message API allows you to send push notifications, emails, and SMS to your users. This guide is specific for email. See Push notification or SMS to send to those channels.

Ensure your Email setup is complete.


Headers

Authorization
string
default:Key YOUR_APP_API_KEY
required

Your App API key with prefix Key. See Keys & IDs.

Body

application/json

Response

200
application/json

200

The response is of type object.