View the details of all the outcomes associated with your app

🚧

Requires Authentication Key

Requires your OneSignal App's REST API Key, available in Keys & IDs.

🚧

Outcome Data Limitations

Outcomes are only accessible for around 30 days before deleted from our servers. You will need to export this data every month if you want to keep it.

Path Parameters

ParameterTypeDescription
outcome_namesStringRequired
Comma-separated list of names and the value (sum/count) for the returned outcome data.
Note: Clicks only support count aggregation.

For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user.

Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum
outcome_names[]
(if outcome names have commas in them)
StringOptional
If outcome names contain any commas, then please specify only one value at a time.

Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count
where “Sales, Purchase” is the custom outcomes with a comma in the name.
outcome_time_rangeStringOptional
Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data).

Default is 1h if the parameter is omitted.
outcome_platformsStringOptional
Platform id. Refer device's platform ids for values.

Example:
outcome_platform=0 for iOS
outcome_platform=7,8 for Safari and Firefox

Default is data from all platforms if the parameter is omitted.
outcome_attributionStringOptional
Attribution type for the outcomes. The values can be direct or influenced or unattributed.

Example: outcome_attribution=direct

Default is total (returns direct+influenced+unattributed) if the parameter is omitted.

Example Code - View Outcomes

curl --include \
    --header "Authorization: Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj" \
    "https://onesignal.com/api/v1/apps/{app_id}/outcomes?outcome_names=os__click.count&outcome_platforms=0"
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://onesignal.com/api/v1/apps/{appId}/outcomes?outcome_names=os__click.count&outcome_platforms=0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');


$headers = array();
$headers[] = 'Authorization: Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);

Returned Fields

  • id - name of the outcome
  • value - returned value of the aggregation type
  • aggregation - aggregation type (sum or count) requested for the outcome

Result Format - View notification

{
 "outcomes": [
   {
     "id": "os__session_duration",
     "value": 100,
     "aggregation": "sum"
   },
   {
     "id": "os__click",
     "value": 4,
     "aggregation": "count"
   },
   {
     "id": "Sales",
     "value": 348,
     "aggregation": "sum"
   }
 ]
}
Language
Authentication
Basic
base64
: