OneSignal Apps API

The Apps API from OneSignal — 21 operation(s) for apps.

Operations 42

GET /apps View apps #
POST /apps Create an app #
GET /apps/{app_id} View an app #
PUT /apps/{app_id} Update an app #
POST /apps/{app_id}/segments Create segment #
GET /apps/{app_id}/segments View segments #
GET /apps/{app_id}/segments/{segment_id} View segment #
PATCH /apps/{app_id}/segments/{segment_id} Update segment #
DELETE /apps/{app_id}/segments/{segment_id} Delete segment #
GET /apps/{app_id}/outcomes?outcome_names={outcome_names}&outcome_time_range={outcome_time_range}&outcome_platforms={outcome_platforms}&outcome_attribution={outcome_attribution} View outcomes #
PATCH /apps/{app_id}/subscriptions/{subscription_id} Update subscription #
DELETE /apps/{app_id}/subscriptions/{subscription_id} Delete subscription #
PATCH /apps/{app_id}/subscriptions_by_token/{token_type}/{token} Update subscription By Token #
POST /apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions Create Subscription by alias #
PATCH /apps/{app_id}/users/by/{alias_label}/{alias_id} Update user #
GET /apps/{app_id}/users/by/{alias_label}/{alias_id} View user #
DELETE /apps/{app_id}/users/by/{alias_label}/{alias_id} Delete user #
POST /apps/{app_id}/users Create user #
GET /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity View user identity #
PATCH /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity Create or update alias #
PATCH /apps/{app_id}/subscriptions/{subscription_id}/owner Transfer subscription #
GET /apps/{app_id}/subscriptions/{subscription_id}/user/identity View user identity (by subscription) #
PATCH /apps/{app_id}/subscriptions/{subscription_id}/user/identity Create alias (by subscription) #
DELETE /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete} Delete alias #
POST /apps/{app_id}/notifications/{notification_id}/unsubscribe?token={token} Unsubscribe email (with token) #
POST /apps/{app_id}/live_activities/{activity_id}/notifications Update Live Activity #
POST /apps/{app_id}/activities/activity/{activity_type} Start Live Activity #
POST /apps/{app_id}/inbox Create inbox broadcast message #
GET /apps/{app_id}/inbox?last_broadcast_id={broadcast_id}&limit={number} View broadcasts #
GET /apps/{app_id}/users/by/{alias_label}/{alias_id}/inbox?last_message_id={message_id} View user broadcasts #
PATCH /apps/{app_id}/users/by/{alias_label}/{alias_id}/inbox?last_message_id={message_id} Bulk update or delete message state #
GET /apps/{app_id}/users/by/{alias_label}/{alias_id}/inbox/unread_count View user unread message count #
PATCH /apps/{app_id}/users/by/{alias_label}/{alias_id}/inbox/{message_id} Update message state #
GET /apps/{app_id}/auth/tokens View API keys #
POST /apps/{app_id}/auth/tokens Create API key #
DELETE /apps/{app_id}/auth/tokens/{token_id} Delete API key #
PATCH /apps/{app_id}/auth/tokens/{token_id} Update API key #
POST /apps/{app_id}/auth/tokens/{token_id}/rotate Rotate API key #
POST /apps/{app_id}/custom_events Create Custom Events #
GET /apps/{app_id}/outcomes View Outcomes #
POST /apps/{app_id}/notifications/{notification_id}/unsubscribe Unsubscribe with token #
POST /apps/{app_id}/integrations/custom_events Create custom events #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/onesignal-apps-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

onesignal-apps-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Onesignal Apps API
  version: '1.0'
  description: 'Operations tagged Apps across 2 of this provider''s published API definitions: onesignal-api-openapi.json, onesignal-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.onesignal.com
tags:
- name: Apps
paths:
  /apps:
    x-mcp:
      enabled: true
    get:
      summary: View apps
      description: Retrieve a list of all OneSignal apps associated with your account, including key app details like name, App ID, subscription counts, and timestamps. Useful for managing multiple apps through the OneSignal API.
      operationId: view-apps
      x-codeSamples:
      - lang: typescript
        label: Node.js SDK
        source: "import Onesignal from '@onesignal/node-onesignal';\n\nconst configuration = Onesignal.createConfiguration({\n    organizationApiKey: 'YOUR_ORGANIZATION_API_KEY',\n});\nconst apiInstance = new Onesignal.DefaultApi(configuration);\n\ntry {\n  const response = await apiInstance.getApps();\n  console.log(response);\n} catch (e) {\n  if (e instanceof Onesignal.ApiException) {\n    // `e.errorMessages` flattens any error-envelope shape to a `string[]`;\n    // the raw parsed body remains on `e.body`.\n    console.error(\"getApps failed: HTTP \" + e.code, e.errorMessages);\n  } else {\n    throw e;\n  }\n}"
      - lang: python
        label: Python SDK
        source: "import onesignal\nfrom onesignal.api import default_api\nfrom onesignal.models import *\nfrom pprint import pprint\n\n# See configuration.py for a list of all supported configuration parameters.\n# Some of the OneSignal endpoints require ORGANIZATION_API_KEY token for authorization, while others require REST_API_KEY.\n# We recommend adding both of them in the configuration page so that you will not need to figure it out yourself.\nconfiguration = onesignal.Configuration(\n    rest_api_key = \"YOUR_REST_API_KEY\", # App REST API key required for most endpoints\n    organization_api_key = \"YOUR_ORGANIZATION_API_KEY\" # Organization key is only required for creating new apps and other top-level endpoints\n)\n\n\n# Enter a context with an instance of the API client\nwith onesignal.ApiClient(configuration) as api_client:\n    # Create an instance of the API class\n    api_instance = default_api.DefaultApi(api_client)\n\n    # example, this endpoint has no required or optional parameters\n    try:\n        # View apps\n        api_response = api_instance.get_apps()\n        pprint(api_response)\n    except onesignal.ApiException as e:\n        print(\"Exception when calling DefaultApi->get_apps: %s\\n\" % e)\n        print(\"Status Code: %s\" % e.status)\n        print(\"Response Body: %s\" % e.body)"
      - lang: php
        label: PHP SDK
        source: "<?php\nrequire_once(__DIR__ . '/vendor/autoload.php');\n\n\n// Configure Bearer authorization: organization_api_key\n$config = onesignal\\client\\Configuration::getDefaultConfiguration()\n                                                ->setRestApiKeyToken('YOUR_REST_API_KEY')\n                                                ->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY');\n\n\n\n$apiInstance = new onesignal\\client\\Api\\DefaultApi(\n    // If you want use custom http client, pass your client which implements `GuzzleHttp\\ClientInterface`.\n    // This is optional, `GuzzleHttp\\Client` will be used as default.\n    new GuzzleHttp\\Client(),\n    $config\n);\n\ntry {\n    $result = $apiInstance->getApps();\n    print_r($result);\n} catch (\\onesignal\\client\\ApiException $e) {\n    echo 'Exception when calling DefaultApi->getApps: ', $e->getMessage(), PHP_EOL;\n    echo 'Status Code: ', $e->getCode(), PHP_EOL;\n    // getErrorMessages() flattens any error-envelope shape to a string[];\n    // the raw body remains on getResponseBody().\n    echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL;\n    echo 'Response Body: ', $e->getResponseBody(), PHP_EOL;\n} catch (\\Exception $e) {\n    echo 'Exception when calling DefaultApi->getApps: ', $e->getMessage(), PHP_EOL;\n}"
      - lang: go
        label: Go SDK
        source: "package main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"os\"\n\n    \"github.com/OneSignal/onesignal-go-api/v5\"\n)\n\nfunc main() {\n\n    configuration := onesignal.NewConfiguration()\n    apiClient := onesignal.NewAPIClient(configuration)\n\n    orgAuth := context.WithValue(context.Background(), onesignal.OrganizationApiKey, \"YOUR_ORGANIZATION_API_KEY\") // Organization API key is only required for creating new apps and other top-level endpoints\n\n    resp, r, err := apiClient.DefaultApi.GetApps(orgAuth).Execute()\n\n    if err != nil {\n        fmt.Fprintf(os.Stderr, \"Error when calling `DefaultApi.GetApps``: %v\\n\", err)\n        fmt.Fprintf(os.Stderr, \"Full HTTP response: %v\\n\", r)\n        if apiErr, ok := err.(*onesignal.GenericOpenAPIError); ok {\n            // ErrorMessages() flattens any error-envelope shape to a []string;\n            // the raw body remains on Body().\n            fmt.Fprintf(os.Stderr, \"Error Messages: %v\\n\", apiErr.ErrorMessages())\n            fmt.Fprintf(os.Stderr, \"Response Body: %s\\n\", apiErr.Body())\n        }\n    }\n    // response from `GetApps`: []App\n    fmt.Fprintf(os.Stdout, \"Response from `DefaultApi.GetApps`: %v\\n\", resp)\n}"
      - lang: ruby
        label: Ruby SDK
        source: "require 'onesignal'\n# setup authorization\nOneSignal.configure do |config|\n  # Configure Bearer authorization: organization_api_key\n  config.organization_api_key = 'YOUR_ORGANIZATION_API_KEY'\n\nend\n\napi_instance = OneSignal::DefaultApi.new\n\nbegin\n  # View apps\n  result = api_instance.get_apps\n  p result\nrescue OneSignal::ApiError => e\n  puts \"Error when calling DefaultApi->get_apps: #{e}\"\n  puts \"Status Code: #{e.code}\"\n  # `e.error_messages` flattens any error-envelope shape to an Array<String>;\n  # the raw body remains on `e.response_body`.\n  puts \"Error Messages: #{e.error_messages}\"\n  puts \"Response Body: #{e.response_body}\"\nend"
      - lang: java
        label: Java SDK
        source: "// Import classes:\nimport java.util.List;\nimport com.onesignal.client.ApiClient;\nimport com.onesignal.client.ApiException;\nimport com.onesignal.client.Configuration;\nimport com.onesignal.client.auth.*;\nimport com.onesignal.client.model.*;\nimport com.onesignal.client.api.DefaultApi;\n\npublic class Example {\n  public static void main(String[] args) {\n    ApiClient defaultClient = Configuration.getDefaultApiClient();\n    defaultClient.setBasePath(\"https://api.onesignal.com\");\n    \n    // Configure HTTP bearer authorization: organization_api_key\n    HttpBearerAuth organization_api_key = (HttpBearerAuth) defaultClient.getAuthentication(\"organization_api_key\");\n    organization_api_key.setBearerToken(\"YOUR_ORGANIZATION_API_KEY\");\n\n    DefaultApi apiInstance = new DefaultApi(defaultClient);\n    try {\n      List<App> result = apiInstance.getApps();\n      System.out.println(result);\n    } catch (ApiException e) {\n      System.err.println(\"Exception when calling DefaultApi#getApps\");\n      System.err.println(\"Status code: \" + e.getCode());\n      // getErrorMessages() flattens any error-envelope shape to a List<String>;\n      // the raw body remains on getResponseBody().\n      System.err.println(\"Error messages: \" + e.getErrorMessages());\n      System.err.println(\"Reason: \" + e.getResponseBody());\n      System.err.println(\"Response headers: \" + e.getResponseHeaders());\n      e.printStackTrace();\n    }\n  }\n}"
      - lang: csharp
        label: C# SDK
        source: "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing OneSignalApi.Api;\nusing OneSignalApi.Client;\nusing OneSignalApi.Model;\n\nnamespace Example\n{\n    public class GetAppsExample\n    {\n        public static void Main()\n        {\n            Configuration config = new Configuration();\n            config.BasePath = \"https://api.onesignal.com\";\n            // Configure Bearer token for authorization: organization_api_key\n            config.AccessToken = \"YOUR_ORGANIZATION_API_KEY\";\n\n            var apiInstance = new DefaultApi(config);\n\n            try\n            {\n                // View apps\n                List<App> result = apiInstance.GetApps();\n                Debug.WriteLine(result);\n            }\n            catch (ApiException  e)\n            {\n                Debug.Print(\"Exception when calling DefaultApi.GetApps: \" + e.Message );\n                Debug.Print(\"Status Code: \"+ e.ErrorCode);\n                // e.ErrorMessages flattens any error-envelope shape to an IReadOnlyList<string>;\n                // the raw body remains on e.ErrorContent.\n                Debug.Print(\"Error Messages: \" + string.Join(\", \", e.ErrorMessages));\n                Debug.Print(\"Response Body: \" + e.ErrorContent);\n                Debug.Print(e.StackTrace);\n            }\n        }\n    }\n}"
      - lang: rust
        label: Rust SDK
        source: "use onesignal_rust_api::apis::configuration::Configuration;\nuse onesignal_rust_api::apis::default_api;\n\n\n#[tokio::main]\nasync fn main() {\n    let mut configuration = Configuration::new();\n    configuration.organization_api_key_token = Some(\"YOUR_ORGANIZATION_API_KEY\".to_string());\n\n\n    match default_api::get_apps(&configuration).await {\n        Ok(resp) => println!(\"{:?}\", resp),\n        Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => {\n            // `e.error_messages()` flattens any error-envelope shape to a Vec<String>;\n            // the raw response remains on the ResponseError variant.\n            eprintln!(\"get_apps failed: {:?}\", e.error_messages());\n        }\n        Err(e) => eprintln!(\"get_apps failed: {:?}\", e),\n    }\n}"
      parameters:
      - name: Authorization
        in: header
        description: Your Organization API key with prefix `Key `. See [Keys & IDs](/docs/en/keys-and-ids).
        required: true
        schema:
          type: string
          default: Key YOUR_ORGANIZATION_API_KEY
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      description: The OneSignal App ID in UUID v4 format.
                      type: string
                    name:
                      description: An internal name you set to help organize and track Apps. Maximum 128 characters.
                      type: string
                    players:
                      description: The total number of Subscriptions in the app. Omitted when `view=config` is passed.
                      type: integer
                    messageable_players:
                      description: The number of Subscriptions eligible to receive messages in the app. Omitted when `view=config` is passed.
                      type: integer
                    created_at:
                      description: The date and time the app was created.
                      type: string
                    updated_at:
                      description: The date and time the app was last updated.
                      type: string
                    organization_id:
                      description: The Organization ID in which the app was created.
                      type: string
                    additional_data_is_root_payload:
                      description: When `true`, custom additional data is sent at the root of the push payload instead of nested under a `custom` key (iOS only).
                      type: boolean
                    gcm_key:
                      description: '**Legacy.** The deprecated Google Cloud Messaging (GCM/FCM legacy) server API key. Retained for backward compatibility; use `fcm_v1_service_account_json` instead.'
                      type: string
                    fcm_v1_service_account_json:
                      description: 'Your FCM Service Account JSON file for Android push notifications. See [Android: Firebase Credentials](/docs/android-firebase-credentials).'
                      type: string
                    fcm_sender_id:
                      description: The FCM Sender ID associated with your Firebase project.
                      type: string
                    chrome_key:
                      description: '**Legacy.** The deprecated Google Chrome extension (GCM) API key. Retained for backward compatibility.'
                      type: string
                    chrome_web_key:
                      description: Web push VAPID public key for Chrome web push notifications.
                      type: string
                    chrome_web_origin:
                      description: The HTTPS origin URL for your website. Required for web push notifications.
                      type: string
                    chrome_web_gcm_sender_id:
                      description: The GCM Sender ID used for web push notifications.
                      type: string
                    chrome_web_default_notification_icon:
                      description: The full HTTPS URL to your default notification icon. Should be a 256x256px PNG.
                      type: string
                    chrome_web_sub_domain:
                      description: The OneSignal subdomain for web push if not using your own origin.
                      type: string
                    apns_env:
                      description: 'The APNS environment: `production` or `development`. See [iOS SDK Setup](/docs/ios-sdk-setup).'
                      type: string
                    apns_certificates:
                      description: The APNS p12 certificate for iOS push notifications.
                      type: string
                    apns_p8:
                      description: The APNs Auth Key (.p8) token-based credential for iOS push notifications.
                      type: string
                    apns_team_id:
                      description: The Apple Developer Team ID associated with the APNs Auth Key.
                      type: string
                    apns_key_id:
                      description: The Key ID of the APNs Auth Key (.p8).
                      type: string
                    apns_bundle_id:
                      description: The app bundle ID associated with the APNs Auth Key.
                      type: string
                    safari_apns_certificate:
                      description: The Safari APNs certificate, or "OneSignal Provided Certificate" when using a OneSignal-managed Safari certificate.
                      type: string
                    safari_site_origin:
                      description: The HTTPS origin URL configured for Safari web push.
                      type: string
                    safari_push_id:
                      description: The Safari Web Push ID (website push ID / certificate bundle ID).
                      type: string
                    safari_icon_16_16:
                      description: URL to the 16x16px Safari notification icon.
                      type: string
                    safari_icon_32_32:
                      description: URL to the 32x32px Safari notification icon.
                      type: string
                    safari_icon_64_64:
                      description: URL to the 64x64px Safari notification icon.
                      type: string
                    safari_icon_128_128:
                      description: URL to the 128x128px Safari notification icon.
                      type: string
                    safari_icon_256_256:
                      description: URL to the 256x256px Safari notification icon.
                      type: string
                    site_name:
                      description: The name of the website configured for web push.
                      type: string
        '400':
          description: Bad request. Returned when the account or organization has more than 1000 apps (this endpoint is disabled above that limit), or when the Authorization key is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BasicErrorResponse'
              example:
                errors:
                - This API endpoint is disabled for organizations with over 1000 apps. Please contact support if you need access to this endpoint.
        '403':
          description: Forbidden. The Authorization key does not have permission to list apps in this organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BasicErrorResponse'
              example:
                errors:
                - You do not have permission to list apps.
        '429':
          description: Rate limit exceeded. Wait the number of seconds in the `Retry-After` header before retrying.
          headers:
            Retry-After:
              description: Number of seconds to wait before retrying the request. Always emitted on 429 responses.
              schema:
                type: integer
                minimum: 0
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BasicErrorResponse'
              example:
                errors:
                - API rate limit exceeded
        '503':
          description: Service temporarily unavailable. Retry after a short backoff. The body may be empty or non-JSON in some failure modes.
          headers:
            Retry-After:
              description: Number of seconds to wait before retrying. Optional — may be absent when the response is generated upstream.
              schema:
                type: integer
                minimum: 0
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BasicErrorResponse'
              example:
                errors:
                - Service temporarily unavailable
      deprecated: false
      tags:
      - Apps
      security:
      - {}
    post:
      summary: Create an app
      description: Programmatically create a new OneSignal app via the REST API. This guide explains required fields, supported platform configurations (Web, Android, iOS), and how to properly authenticate using your Organization API key.
      operationId: create-an-app
      x-codeSamples:
      - lang: typescript
        label: Node.js SDK
        source: "import Onesignal from '@onesignal/node-onesignal';\n\nconst configuration = Onesignal.createConfiguration({\n    organizationApiKey: 'YOUR_ORGANIZATION_API_KEY',\n});\nconst apiInstance = new Onesignal.DefaultApi(configuration);\n\n// App\nconst app: Onesignal.App = {\n    name: \"name_example\",\n    android_gcm_sender_id: \"android_gcm_sender_id_example\",\n    gcm_key: \"gcm_key_example\",\n    chrome_web_origin: \"chrome_web_origin_example\",\n    chrome_key: \"chrome_key_example\",\n    chrome_web_default_notification_icon: \"chrome_web_default_notification_icon_example\",\n    chrome_web_sub_domain: \"chrome_web_sub_domain_example\",\n    apns_env: \"sandbox\",\n    apns_p12: \"apns_p12_example\",\n    apns_p12_password: \"apns_p12_password_example\",\n    safari_apns_p12: \"safari_apns_p12_example\",\n    safari_apns_p12_password: \"safari_apns_p12_password_example\",\n    apns_key_id: \"apns_key_id_example\",\n    apns_team_id: \"apns_team_id_example\",\n    apns_bundle_id: \"apns_bundle_id_example\",\n    apns_p8: \"apns_p8_example\",\n    safari_site_origin: \"safari_site_origin_example\",\n    safari_icon_256_256: \"safari_icon_256_256_example\",\n    site_name: \"site_name_example\",\n    organization_id: \"organization_id_example\",\n    additional_data_is_root_payload: true,\n  };\n\ntry {\n  const response = await apiInstance.createApp(app);\n  console.log(response);\n} catch (e) {\n  if (e instanceof Onesignal.ApiException) {\n    // `e.errorMessages` flattens any error-envelope shape to a `string[]`;\n    // the raw parsed body remains on `e.body`.\n    console.error(\"createApp failed: HTTP \" + e.code, e.errorMessages);\n  } else {\n    throw e;\n  }\n}"
      - lang: python
        label: Python SDK
        source: "import onesignal\nfrom onesignal.api import default_api\nfrom onesignal.models import *\nfrom pprint import pprint\n\n# See configuration.py for a list of all supported configuration parameters.\n# Some of the OneSignal endpoints require ORGANIZATION_API_KEY token for authorization, while others require REST_API_KEY.\n# We recommend adding both of them in the configuration page so that you will not need to figure it out yourself.\nconfiguration = onesignal.Configuration(\n    rest_api_key = \"YOUR_REST_API_KEY\", # App REST API key required for most endpoints\n    organization_api_key = \"YOUR_ORGANIZATION_API_KEY\" # Organization key is only required for creating new apps and other top-level endpoints\n)\n\n\n# Enter a context with an instance of the API client\nwith onesignal.ApiClient(configuration) as api_client:\n    # Create an instance of the API class\n    api_instance = default_api.DefaultApi(api_client)\n    app = App(\n        name=\"name_example\",\n        android_gcm_sender_id=\"android_gcm_sender_id_example\",\n        gcm_key=\"gcm_key_example\",\n        chrome_web_origin=\"chrome_web_origin_example\",\n        chrome_key=\"chrome_key_example\",\n        chrome_web_default_notification_icon=\"chrome_web_default_notification_icon_example\",\n        chrome_web_sub_domain=\"chrome_web_sub_domain_example\",\n        apns_env=\"sandbox\",\n        apns_p12=\"apns_p12_example\",\n        apns_p12_password=\"apns_p12_password_example\",\n        safari_apns_p12=\"safari_apns_p12_example\",\n        safari_apns_p12_password=\"safari_apns_p12_password_example\",\n        apns_key_id=\"apns_key_id_example\",\n        apns_team_id=\"apns_team_id_example\",\n        apns_bundle_id=\"apns_bundle_id_example\",\n        apns_p8=\"apns_p8_example\",\n        safari_site_origin=\"safari_site_origin_example\",\n        safari_icon_256_256=\"safari_icon_256_256_example\",\n        site_name=\"site_name_example\",\n        organization_id=\"organization_id_example\",\n        additional_data_is_root_payload=True,\n    ) \n\n    try:\n        # Create an app\n        api_response = api_instance.create_app(app)\n        pprint(api_response)\n    except onesignal.ApiException as e:\n        print(\"Exception when calling DefaultApi->create_app: %s\\n\" % e)\n        print(\"Status Code: %s\" % e.status)\n        print(\"Response Body: %s\" % e.body)"
      - lang: php
        label: PHP SDK
        source: "<?php\nrequire_once(__DIR__ . '/vendor/autoload.php');\n\n\n// Configure Bearer authorization: organization_api_key\n$config = onesignal\\client\\Configuration::getDefaultConfiguration()\n                                                ->setRestApiKeyToken('YOUR_REST_API_KEY')\n                                                ->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY');\n\n\n\n$apiInstance = new onesignal\\client\\Api\\DefaultApi(\n    // If you want use custom http client, pass your client which implements `GuzzleHttp\\ClientInterface`.\n    // This is optional, `GuzzleHttp\\Client` will be used as default.\n    new GuzzleHttp\\Client(),\n    $config\n);\n$app = new \\onesignal\\client\\model\\App(); // \\onesignal\\client\\model\\App\n\ntry {\n    $result = $apiInstance->createApp($app);\n    print_r($result);\n} catch (\\onesignal\\client\\ApiException $e) {\n    echo 'Exception when calling DefaultApi->createApp: ', $e->getMessage(), PHP_EOL;\n    echo 'Status Code: ', $e->getCode(), PHP_EOL;\n    // getErrorMessages() flattens any error-envelope shape to a string[];\n    // the raw body remains on getResponseBody().\n    echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL;\n    echo 'Response Body: ', $e->getResponseBody(), PHP_EOL;\n} catch (\\Exception $e) {\n    echo 'Exception when calling DefaultApi->createApp: ', $e->getMessage(), PHP_EOL;\n}"
      - lang: go
        label: Go SDK
        source: "package main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"os\"\n\n    \"github.com/OneSignal/onesignal-go-api/v5\"\n)\n\nfunc main() {\n    app := *onesignal.NewApp() // App | \n\n    configuration := onesignal.NewConfiguration()\n    apiClient := onesignal.NewAPIClient(configuration)\n\n    orgAuth := context.WithValue(context.Background(), onesignal.OrganizationApiKey, \"YOUR_ORGANIZATION_API_KEY\") // Organization API key is only required for creating new apps and other top-level endpoints\n\n    resp, r, err := apiClient.DefaultApi.CreateApp(orgAuth).App(app).Execute()\n\n    if err != nil {\n        fmt.Fprintf(os.Stderr, \"Error when calling `DefaultApi.CreateApp``: %v\\n\", err)\n        fmt.Fprintf(os.Stderr, \"Full HTTP response: %v\\n\", r)\n        if apiErr, ok := err.(*onesignal.GenericOpenAPIError); ok {\n            // ErrorMessages() flattens any error-envelope shape to a []string;\n            // the raw body remains on Body().\n            fmt.Fprintf(os.Stderr, \"Error Messages: %v\\n\", apiErr.ErrorMessages())\n            fmt.Fprintf(os.Stderr, \"Response Body: %s\\n\", apiErr.Body())\n        }\n    }\n    // response from `CreateApp`: App\n    fmt.Fprintf(os.Stdout, \"Response from `DefaultApi.CreateApp`: %v\\n\", resp)\n}"
      - lang: ruby
        label: Ruby SDK
        source: "require 'onesignal'\n# setup authorization\nOneSignal.configure do |config|\n  # Configure Bearer authorization: organization_api_key\n  config.organization_api_key = 'YOUR_ORGANIZATION_API_KEY'\n\nend\n\napi_instance = OneSignal::DefaultApi.new\napp = OneSignal::App.new # App | \n\nbegin\n  # Create an app\n  result = api_instance.create_app(app)\n  p result\nrescue OneSignal::ApiError => e\n  puts \"Error when calling DefaultApi->create_app: #{e}\"\n  puts \"Status Code: #{e.code}\"\n  # `e.error_messages` flattens any error-envelope shape to an Array<String>;\n  # the raw body remains on `e.response_body`.\n  puts \"Error Messages: #{e.error_messages}\"\n  puts \"Response Body: #{e.response_body}\"\nend"
      - lang: java
        label: Java SDK
        source: "// Import classes:\nimport com.onesignal.client.ApiClient;\nimport com.onesignal.client.ApiException;\nimport com.onesignal.client.Configuration;\nimport com.onesignal.client.auth.*;\nimport com.onesignal.client.model.*;\nimport com.onesignal.client.api.DefaultApi;\n\npublic class Example {\n  public static void main(String[] args) {\n    ApiClient defaultClient = Configuration.getDefaultApiClient();\n    defaultClient.setBasePath(\"https://api.onesignal.com\");\n    \n    // Configure HTTP bearer authorization: organization_api_key\n    HttpBearerAuth organization_api_key = (HttpBearerAuth) defaultClient.getAuthentication(\"organization_api_key\");\n    organization_api_key.setBearerToken(\"YOUR_ORGANIZATION_API_KEY\");\n\n    DefaultApi apiInstance = new DefaultApi(defaultClient);\n    App app = new App(); // App | \n    try {\n      App result = apiInstance.createApp(app);\n      System.out.println(result);\n    } catch (ApiException e) {\n      System.err.println(\"Exception when calling DefaultApi#createApp\");\n      System.err.println(\"Status code: \" + e.getCode());\n      // getErrorMessages() flattens any error-envelope shape to a List<String>;\n      // the raw body remains on getResponseBody().\n      System.err.println(\"Error messages: \" + e.getErrorMessages());\n      System.err.println(\"Reason: \" + e.getResponseBody());\n      System.err.println(\"Response headers: \" + e.getResponseHeaders());\n      e.printStackTrace();\n    }\n  }\n}"
      - lang: csharp
        label: C# SDK
        source: "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing OneSignalApi.Api;\nusing OneSignalApi.Client;\nusing OneSignalApi.Model;\n\nnamespace Example\n{\n    public class CreateAppExample\n    {\n        public static void Main()\n        {\n            Configuration config = new Configuration();\n            config.BasePath = \"https://api.onesignal.com\";\n            // Configure Bearer token for authorization: organization_api_key\n            config.AccessToken = \"YOUR_ORGANIZATION_API_KEY\";\n\n            var apiInstance = new DefaultApi(config);\n            var app = new App(); // App | \n\n            try\n            {\n                // Create an app\n                App result = apiInstance.CreateApp(app);\n                Debug.WriteLine(result);\n            }\n            catch (ApiException  e)\n            {\n                Debug.Print(\"Exception when calling DefaultApi.CreateApp: \" + e.Message );\n                Debug.Print(\"Status Code: \"+ e.ErrorCode);\n                // e.ErrorMessages flattens any error-envelope shape to an IReadOnlyList<string>;\n                // the raw body remains on e.ErrorContent.\n                Debug.Print(\"Error Messages: \" + string.Join(\", \", e.ErrorMessages));\n                Debug.Print(\"Response Body: \" + e.ErrorContent);\n                Debug.Print(e.StackTrace);\n            }\n        }\n    }\n}"
      - lang: rust
        label: Rust SDK
        source: "use onesignal_rust_api::apis::configuration::Configuration;\nuse onesignal_rust_api::apis::default_api;\n\nuse onesignal_rust_api::models;\n\n\n#[tokio::main]\nasync fn main() {\n    let mut configuration = Configuration::new();\n    configuration.organization_api_key_token = Some(\"YOUR_ORGANIZATION_API_KEY\".to_string());\n\n\n    // Realistic values are pulled from the spec's `example:` fields where present.\n    let app: models::App = todo!();\n\n    match default_api::create_app(&configuration, app).await {\n        Ok(resp) => println!(\"{:?}\", resp),\n        Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => {\n            // `e.error_messages()` flattens any error-envelope shape to a Vec<String>;\n            // the raw response remains on the ResponseError variant.\n            eprintln!(\"create_app failed: {:?}\", e.error_messages());\n        }\n        Err(e) => eprintln!(\"create_app failed: {:?}\", e),\n    }\n}"
      parameters:
      - name: Content-Type
        in: header
        required: true
        schema:
          type: string
          default: application/json
      - name: Authorization
        in: header
        description: Your Organization API key with prefix `Key `. See [Keys & IDs](/docs/en/keys-and-ids).
        required: true
        schema:
          type: string
          default: Key YOUR_ORGANIZATION_API_KEY
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
              - name
              - organization_id
              properties:
                name:
                  type: string
                  description: An internal name you set to help organize and track Apps. Maximum 128 characters.
                  default: NAME_OF_NEW_APP
                organization_id:
                  type: string
                  description: The [Organization ID](/docs/en/keys-and-ids#organization-id) that the app will be associated with.
                  default: YOUR_ORG_ID
                chrome_web_origin:
                  type: string
                  description: The HTTPS [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) URL for your website. Required for web push notifications.
                site_name:
                  type: string
                  description: The name of your website. Used for web push notification titles when omitted from the notification payload. Required for web push notifications.
                  default: SITE_NAME
                safari_site_origin:
                  type: string
                  description: The HTTPS [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) URL for your website. Required for web push notifications for Safari and should be the same as `chrome_web_origin`.
                chrome_web_default_notification_icon:
                  type: string
                  description: The full `https` URL to your default icon resource. The icon should be a `256x256px` PNG.
                safari_icon_256_256:
                  type: string
                  description: The 

# --- truncated at 32 KB (701 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/onesignal/refs/heads/main/openapi/onesignal-apps-api-openapi.yml