Creates a new OneSignal app


Requires User Authentication Key

Requires your OneSignal User Auth Key, available in Account & API Keys.

Body Parameters - Create an app

nameStringRequired: The name of your new app, as displayed on your apps list on the dashboard. This can be renamed later.
apns_envStringiOS: Either sandbox or production
apns_p12StringiOS: Your apple push notification p12 certificate file, converted to a string and Base64 encoded.
apns_p12_passwordStringiOS Required if adding p12 certificate - Password for the apns_p12 file
gcm_keyStringAndroid: Your FCM Google Push Server Auth Key
android_gcm_sender_idStringAndroid: Your FCM Google Project number. Also know as Sender ID.
chrome_web_originStringChrome (All Browsers except Safari) (Recommended): The URL to your website. This field is required if you wish to enable web push and specify other web push parameters.
chrome_web_default_notification_iconStringChrome (All Browsers except Safari): Your default notification icon. Should be 256x256 pixels, min 80x80.
chrome_web_sub_domainStringChrome (All Browsers except Safari): A subdomain of your choice in order to support Web Push on non-HTTPS websites. This field must be set in order for the chrome_web_gcm_sender_id property to be processed.
site_nameStringAll Browsers (Recommended): The Site Name. Requires both chrome_web_origin and safari_site_origin to be set to add or update it.
safari_site_originStringSafari (Recommended): The hostname to your website including http(s)://
safari_apns_p12StringSafari: Your apple push notification p12 certificate file for Safari Push Notifications, converted to a string and Base64 encoded.
safari_apns_p12_passwordStringSafari: Password for safari_apns_p12 file
safari_icon_256_256StringSafari: A url for a 256x256 png notification icon. This is the only Safari icon URL you need to provide.
chrome_keyStringNot for web push
Your Google Push Messaging Auth Key if you use Chrome Apps / Extensions.
additional_data_is_root_payloadBooleaniOS: Notification data (additional data) values will be added to the root of the apns payload when sent to the device.
Ignore if you're not using any other plugins or not using OneSignal SDK methods to read the payload.
organization_idStringThe Id of the Organization you would like to add this app to.

Example Code - Create an app

This method is used to create new apps in your OneSignal account. It allows you to specify your APNS and GCM auth tokens as well.

curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --header "Authorization: Basic USER_AUTH_KEY" \
     --data-binary "{\"name\" : \"Your app 1\",
\"apns_env\": \"production\",
\"apns_p12\": \"asdsadcvawe223cwef...\",
\"apns_p12_password\": \"FooBar\",
\"organization_id\": \"your_organization_id\",
\"gcm_key\": \"a gcm push key\"}" \
    function createApp(){
        $fields = array(
            'name' => "YOUR_APP_NAME"
        $fields = json_encode($fields);
        print("\nJSON sent:\n");
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "");
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8',
                                                   'Authorization: Basic NDBlY2Q2MTMtYjUyOS00YTBhLTlmYjAtMjk2NGE5YzViMWM5'));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_POST, TRUE);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

        $response = curl_exec($ch);
        return $response;
    $response = createApp();
    $return["allresponses"] = $response;
    $return = json_encode( $return);
    print("\n\nJSON received:\n");

Result Format - Create an app

  id: "e4e87830-b954-11e3-811d-f3b376925f15",
  name: "Your app 1",
  players: 0,
  messageable_players: 0,
  updated_at: "2014-04-01T04:20:02.003Z",
  created_at: "2014-04-01T04:20:02.003Z",
  gcm_key: "a gcm push key",
  chrome_web_origin: "Chrome Web Push Site URL",
  chrome_web_default_notification_icon: "",
  apns_env: "production",
  apns_certificates: "Your apns certificate",
  safari_apns_certificate: "Your Safari APNS certificate",
  safari_site_origin: "The homename for your website for Safari Push, including http or https",
  safari_push_id: "The certificate bundle ID for Safari Web Push",
  safari_icon_16_16: "",
  safari_icon_32_32: "[email protected]",
  safari_icon_64_64: "[email protected]",
  safari_icon_128_128: "",
  safari_icon_256_256: "[email protected]",
  site_name: "The URL to your website for Web Push",  
  basic_auth_key: "NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj"