NAV Navbar
shell ruby php python javascript

Introduction

Welcome to the UserWise platform API documentation page!

This website is here to provide you and your team with all the necessary documentation to get up and running with our platform.

Security

Authentication

# Header Authentication Example
curl https://api.userwise.io/api/v1/countries
  -H 'X-Api-Key: NTAyMTVhOGQtZjFhMy00ZjI0LThiYmQtNzExZTdmMzcyMWE4'

# Query Parameter Authentication Example
curl https://api.userwise.io/api/v1/countries?api_key=50215a8d-a1a3-4f24-8xbd-721e763721a8
# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI("https://api.userwise.io/api/v1/countries")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request["X-Api-Key"] = Base64.encode64("50215a8d-a1a3-4f24-8xbd-721e763721a8")

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: "https://api.userwise.io/api/v1/countries",
  content_type: "application/json",
  headers: {
    "X-Api-Key": Base64.encode64("50215a8d-a1a3-4f24-8xbd-721e763721a8")
  }
)
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/countries",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "X-Api-Key: " . base64_encode("50215a8d-a1a3-4f24-8xbd-721e763721a8")
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET"
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/countries"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("50215a8d-a1a3-4f24-8xbd-721e763721a8")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/countries",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("50215a8d-a1a3-4f24-8xbd-721e763721a8").toString('base64')
  }
};

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write();
request.end();

All requests made via either the server or sdk API requires the use of API key based authentication.

There are two primary methods for authenticating via your API key:

  1. Provide your base64 encoded API key in the X-Api-Key HTTP header.
  2. Provide your API key in the api_key query parameter.

HTTP Header Encoder for API Keys

IP Whitelisting (Optional)

Within your company's api settings page, you can provide a list of whitelisted static IP addresses. The IP addresses provided only pertain to the server-to-server api requests. Requests that do not originate from one of the IPs provided will be rejected.

To enable this feature go to your company's api settings and provide a list of ip addresses.

Request Hashing (Required)

The What?

Request hashing is used by UserWise to validate the authenticity of a given request. We do this through hashing api requests, along with your company’s secret key. The hashing algorithm used currently defaults to sha3-256, which is the recommended algorithm to be used with our system.

The Why?

Request hashing is a required feature of the UserWise API that allows us to validate the authenticity of API requests made on your company's behalf.

The How?

Request hashing is accomplished by creating a hash of your request url (including query parameters), your company’s secret key, and the request's raw post body (if provided). The hashed value is then added to the end of your request url using the enc query parameter.

# Using rhash
echo "{{ request_url }}{{ json_body}}{{ secret_key }}" > /tmp/checksum_test
rhash --sha3-256 /tmp/checksum_test
require 'sha3'

request_url = 'https://api.userwise.io/api/v1/countries'
json_body = { :key => 'value' }
secret_key = 'abcd1234'

secret_url = request_url + json_body.to_json + secret_key
hash = SHA3::Digest.hexdigest :sha256, secret_url

hashed_url = request_url + '?enc=' + hash
<?php

$request_url = 'https://api.userwise.io/api/v1/countries';
$json_body = ['key' => 'value'];
$secret_key = 'abcd1234';

$secret_url = $request_url . json_encode($json_body) . $secret_key;
$hash = hash('sha3-256', $secret_url);

$hashed_url = $request_url . '?enc=' . $hash;
import json
import hashlib

request_url = 'https://api.userwise.io/api/v1/countries'
json_body = { 'key': 'value' }
secret_key = 'abcd1234'

secret_url = "{}{}{}".format(request_url, json.dumps(json_body), secret_key)

h = hashlib.sha3_256()
h.update(secret_url.encode('utf-8'))

hashed_url = "{}?enc={}".format(request_url, h.hexdigest())
const { SHA3 } = require('sha3');

const requestUrl = 'https://api.userwise.io/api/v1/countries';
const jsonBody = { 'key': 'value' };
const secretKey = 'abcd1234';

const secretUrl = requestUrl + JSON.encode(jsonBody) + secretKey;

const hash = new SHA3(256);
hash.update(secretUrl);

hashedUrl = `${requestUrl}?enc=${hash.digest('hash')}`;

GET/DELETE Requests

Given The Values
Request URL: https://userwise.io/api/endpoint?param_one=value_one
Company Secret Key: UbsXaKTGWNd3wD8y5ZeV

We Hash Them
{Request URL}+{Company Secret Key}
https://userwise.io/api/endpoint?param_one=value_oneUbsXaKTGWNd3wD8y5ZeV

Which Gives The Hash
5d0cf6bfeca88e853cd4330cffaaed87febb5038b3c4835681f8f34d8966dc27

And Gets Added To The URL
https://userwise.io/api/endpoint?param_one=value_one&enc=5d0cf6bfeca88e853cd4330cffaaed87febb5038b3c4835681f8f34d8966dc27

POST/PUT Requests

Given The Values
Request URL: http://www.example.com/endpoint
Company Secret Key: UbsXaKTGWNd3wD8y5ZeV
JSON Body: {“key”:“value”}

We Hash Them
{Request URL}+{JSON Body}+{Company Secret Key}
https://userwise.io/api/endpoint{“key”:“value”}UbsXaKTGWNd3wD8y5ZeV

Which Gives The Hash
1c3893648029aa032e8eec93fb5e5db9347abf7d36c107db3409de975f1f4290

And Gets Added To The URL Or JSON Body
https://userwise.io/api/endpoint?enc=1c3893648029aa032e8eec93fb5e5db9347abf7d36c107db3409de975f1f4290

Guides

Attribute Targeting

Attributes (along with Event Targeting) are the bread-and-butter of the UserWise targeting framework.

Attributes can be thought of as a key-value store for your app user. You can set various traits that a user has currently; and then in the future you can overwrite those values. So, given that our fictious game UserWise Hero Wars has a premium currency of diamonds and a general currency of coins, we can keep our app user updated within the UserWise platform by updating their coins and diamonds attributes via a Platform SDK or through the Server-to-Server API.

Supported Attribute Data Types

The UserWise platform tries to be as fluid as possible. At the moment we provide native support for the following data types:

Data Type Name UserWise Platform Representation
String string
Boolean boolean
Integer integer
Float float
DateTime datetime

Setting an App User's Attributes

Setting the value of an app user's attributes can be done through the use of the Server API or a Native SDK. The choice is up to you and what works best with your flow. Each of those sections will guide you through how to assign attributes given the environment.

Event Targeting

Targeting events are named events that may occur within your game. These events can be registered on the fly, allowing you to not worry about updating the UserWise platform.

At a minimum, an event is an unique string identifying an event that the app user has experienced. offer_123_shown, offer_123_purchased, tutorial_completed are all examples of possible events that could occur within your game.

Event Attributes

Events can have uniquely (or non-uniquely) defined attributes. These attributes are not tied to the app user's current attributes, but rather give you an opportunity to track various attributes that were present during an event's execution.

The event attributes abide by the same set of rules as general Attribute Targeting.

Setting Event Attributes

Assigning events can be done through the use of the Server API, or a Native SDK. The choice is up to you and what works best with your flow. Each of those sections will guide you through how to assign attributes given the environment.

Segment Targeting

When using the attribute and event targeting functionality, there is a specific schema you must abide by in order for your segment to not only be saved, but also target the proper segment of app users. Below, you can find sections describing how to use each of the targeting functions appropriately.

Attribute Targeting Groups

Attribute Targeting Schema

[
  // an example attribute targeting group
  {
    "group_logical_operator": "and|or",
    "name": "attribute_name",
    "values": ["array", "of", "values", 123, true],
    "operator": "equal|greater_than|less_than|contain|between"
  }
]

Attribute Targeting Example (whale player, <500 diamonds, last purchase >30 days)

[
  { "name": "is_whale", "operator": "equal", "values": [true] },
  { "group_logical_operator": "and", "name": "current_diamonds", "operator": "less_than", "values": [500] },
  { "group_logical_operator": "and", "name": "last_offer_purchase_date", "operator": "less_than", "values": ["2020-02-04T00:00:00Z"] }
]

Attribute targeting is the simplest segment targeting method offered, and can be used in conjunction with event targeting.

As with the event targeting methods, our first field is the group_logical_operator, which acts as the connecting logical operator between the current and previous group.

Next, we have the name and values fields. The name field refers to the attribute to target against, and values is an array of data to compare the app user's current attribute values against, in conjunction with the final field - operator. The operators available for each attribute are dependent upon their data type. Each operator functions as you would expect, except for maybe equal and contain. equal does a hard equals while contain allows you to do a form of fuzzy searching of strings.

Attribute Operator Availability

Data Type Operators Available
string equal, contain
integer equal, greater_than, less_than, between
float equal, greater_than, less_than, between
datetime equal, greater_than, less_than, between
boolean equal

Event Targeting Groups

Event Targeting Schema

[
  // event targeting group
  {
    "group_logical_operator": "and|or",
    "logical_operator": "and|or|not",
    "event_sets": [
      { "event_id": "played_halloween_event", attributes: [] },
      { "event_id": "iap_purchased", attributes: [
        { "name": "bundle_cost", "operator": "greater_than", "values": [9.99] },
        { "name": "snapshot_player_ltv", "operator": "greater_than", "values": [100] }
      ] }
    ]
  },
  ...
]

Event targeting is slightly more complex and makes use of basic event_id matching, along with intermixed event attribute targeting. Event attributes are attributes that pertain to only the event they were attached to and allows finer control over targeting your userbase based on the events that have occurred.

As you can see from the schema to the right, our system expects an array of hash maps, aptly nicknamed event targeting groups. These groups are interconnected through the use of the group_logical_operator field, which acts as the connecting logical operator between the current and previous group. Next we have the logical_operator field which acts as the logical operator (and/or/not) for the event_sets defined within each group.

Though it can seem somewhat confusing initially, event_groups are just containers for inner event_sets which define the individual event_id + attribute targeting.

Event Targeting Example (purchased offer 123, did not purchase offer 456)

[
  { "logical_operator": "and", "event_ids": ["offer_123_viewed", "offer_123_purchased", "offer_456_viewed"] },
  { "group_logical_operator": "and", "logical_operator": "not", "event_ids": ["offer_456_purchased"] }
]

Server Callbacks

Server-to-server callbacks enable you to confidently handle various events that can occur and which would possibly necessitate a server-side verification scheme (i.e: successful survey complete in order to reward your app users appropriately).

Each callback defined will have variables with template macros available for you to set in your app's callback url. Available variables for each callback are defined in tables within their corresponding section.

All server callbacks will fail and retry automatically, with an exponentially growing back-off. Your system must respond with a 200-ranged HTTP status in order for our system to mark the callback as completed.

We have static IPs for our server callbacks the available IPs are: 1. 44.196.100.149 2. 44.196.6.34 3. 54.243.243.191

Survey Complete Callback URL

Example Survey Complete Callback URL

https://example.com/myApp/reward?tid={transaction_id}&uid={appuser_id}&sid={survey_id}&mode={mode}&enc={request_hash}

The survey complete callback url can be defined in your app's settings page, aptly labeled Successful Survey Complete, under the Callback URLs section. The URL provided be called for each app user successful survey complete.

Available Data Example Data Callback URL Template
Transaction ID 6ea91937-f588-4622-ba32-1ee4a8354c19 {transaction_id}
App user's ID your_defined_user_id {appuser_id}
Survey ID 0849c822-8b5a-42b7-b982-fa5776d20677 {survey_id}
Mode Indicator live or test {mode}
Security Request Hashing 1110f2e11d37eee719fd640c9d4f00d2134b9137806fd6dc735b3f76b120ef47 {request_hash}

Server API

Apps

Get All Apps

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/apps?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/apps?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/apps?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/apps?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/apps?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/apps?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": [
    {
      "id": "bce6fa6f-43ca-42f7-b2a5-3316c2599f0b",
      "name": "UserWise Hero Wars",
      "state": "live",
      "api_key": "9a87cb8b-7791-4c01-9705-0e2f006af781",
      "secret_key": "937ce876-170f-4531-a5ba-cb08c8bf054b",
      "survey_complete_callback_url": "https://192.168.200.14/your/survey/callback/path",
      "icon_url": "https://s3.amazonaws.com/some/bucket/path/to/your/icon.png",
      "sdk_disallow_closing_surveys": false,
      "sdk_allow_close_after_seconds": 30,
      "sdk_survey_interval_refresh_seconds": 10,
      "audience_stats": {
        "total_user_count": 123000,
        "trailing_30d_active_user_count": 90000,
        "trailing_7d_active_user_count": 10000
      }
    },
    ...
  ]
}

Retrieves a list of app resources you have created within our system. Each app returned includes basic app information, sdk settings, and api credentials for the app. The provided secret_key is the same across your entire company account.

HTTP Request

GET https://api.userwise.io/api/v1/apps

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Get an App

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "bce6fa6f-43ca-42f7-b2a5-3316c2599f0b",
    "name": "UserWise Hero Wars",
    "state": "live",
    "api_key": "9a87cb8b-7791-4c01-9705-0e2f006af781",
    "secret_key": "937ce876-170f-4531-a5ba-cb08c8bf054b",
    "survey_complete_callback_url": "https://192.168.200.14/your/survey/callback/path",
    "icon_url": "https://s3.amazonaws.com/some/bucket/path/to/your/icon.png",
    "sdk_disallow_closing_surveys": false,
    "sdk_allow_close_after_seconds": 30,
    "sdk_survey_interval_refresh_seconds": 10,
    "audience_stats": {
      "total_user_count": 123000,
      "trailing_30d_active_user_count": 90000,
      "trailing_7d_active_user_count": 10000
    }
  }
}

Retrieves an app resource you have created within our system. The app returned includes basic app information, sdk settings, and api credentials. The provided secret_key is the same across your entire company account.

HTTP Request

GET https://api.userwise.io/api/v1/apps/{{ app_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Create New App

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/apps?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:name=>"UserWise Hero Wars", :survey_complete_callback_url=>"https://192.168.200.14/your/survey/callback/path", :sdk_disallow_closing_surveys=>"No Example Provided", :sdk_allow_close_after_seconds=>30, :sdk_survey_refresh_interval_seconds=>"No Example Provided"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/apps?enc={{ generated_request_hash }}',
  payload: {:name=>"UserWise Hero Wars", :survey_complete_callback_url=>"https://192.168.200.14/your/survey/callback/path", :sdk_disallow_closing_surveys=>"No Example Provided", :sdk_allow_close_after_seconds=>30, :sdk_survey_refresh_interval_seconds=>"No Example Provided"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/apps?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"name":"UserWise Hero Wars","survey_complete_callback_url":"https://192.168.200.14/your/survey/callback/path","sdk_disallow_closing_surveys":"No Example Provided","sdk_allow_close_after_seconds":30,"sdk_survey_refresh_interval_seconds":"No Example Provided"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/apps?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"name":"UserWise Hero Wars","survey_complete_callback_url":"https://192.168.200.14/your/survey/callback/path","sdk_disallow_closing_surveys":"No Example Provided","sdk_allow_close_after_seconds":30,"sdk_survey_refresh_interval_seconds":"No Example Provided"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/apps?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"name":"UserWise Hero Wars","survey_complete_callback_url":"https://192.168.200.14/your/survey/callback/path","sdk_disallow_closing_surveys":"No Example Provided","sdk_allow_close_after_seconds":30,"sdk_survey_refresh_interval_seconds":"No Example Provided"}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/apps?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"name":"UserWise Hero Wars","survey_complete_callback_url":"https://192.168.200.14/your/survey/callback/path","sdk_disallow_closing_surveys":"No Example Provided","sdk_allow_close_after_seconds":30,"sdk_survey_refresh_interval_seconds":"No Example Provided"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "bce6fa6f-43ca-42f7-b2a5-3316c2599f0b",
    "name": "UserWise Hero Wars",
    "state": "live",
    "api_key": "9a87cb8b-7791-4c01-9705-0e2f006af781",
    "secret_key": "937ce876-170f-4531-a5ba-cb08c8bf054b",
    "survey_complete_callback_url": "https://192.168.200.14/your/survey/callback/path",
    "icon_url": "https://s3.amazonaws.com/some/bucket/path/to/your/icon.png",
    "sdk_disallow_closing_surveys": false,
    "sdk_allow_close_after_seconds": 30,
    "sdk_survey_interval_refresh_seconds": 10,
    "audience_stats": {
      "total_user_count": 123000,
      "trailing_30d_active_user_count": 90000,
      "trailing_7d_active_user_count": 10000
    }
  }
}

Creates a new app resource within our system with the provided information. App information returned follows the same schema as when retrieving a single app.

HTTP Request

POST https://api.userwise.io/api/v1/apps

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
name Yes string The display name for your app
survey_complete_callback_url No string The full url we should use when handling server-to-server survey callback communication
sdk_disallow_closing_surveys No boolean If 'true', removes the ability for appusers to close surveys they are taking.
sdk_allow_close_after_seconds No integer The delay the user must wait before they can close out of the survey before completing.
sdk_survey_refresh_interval_seconds No integer The delay in seconds in between polling requests sent to the UserWise server, to check available surveys.

Update an App

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Put.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:name=>"UserWise Hero Wars", :survey_complete_callback_url=>"https://192.168.200.14/your/survey/callback/path", :sdk_disallow_closing_surveys=>"No Example Provided", :sdk_allow_close_after_seconds=>30, :sdk_survey_refresh_interval_seconds=>"No Example Provided"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :put,
  url: 'https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}',
  payload: {:name=>"UserWise Hero Wars", :survey_complete_callback_url=>"https://192.168.200.14/your/survey/callback/path", :sdk_disallow_closing_surveys=>"No Example Provided", :sdk_allow_close_after_seconds=>30, :sdk_survey_refresh_interval_seconds=>"No Example Provided"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}"
  -X PUT
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"name":"UserWise Hero Wars","survey_complete_callback_url":"https://192.168.200.14/your/survey/callback/path","sdk_disallow_closing_surveys":"No Example Provided","sdk_allow_close_after_seconds":30,"sdk_survey_refresh_interval_seconds":"No Example Provided"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => '{"name":"UserWise Hero Wars","survey_complete_callback_url":"https://192.168.200.14/your/survey/callback/path","sdk_disallow_closing_surveys":"No Example Provided","sdk_allow_close_after_seconds":30,"sdk_survey_refresh_interval_seconds":"No Example Provided"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"name":"UserWise Hero Wars","survey_complete_callback_url":"https://192.168.200.14/your/survey/callback/path","sdk_disallow_closing_surveys":"No Example Provided","sdk_allow_close_after_seconds":30,"sdk_survey_refresh_interval_seconds":"No Example Provided"}
requests.put(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "PUT",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"name":"UserWise Hero Wars","survey_complete_callback_url":"https://192.168.200.14/your/survey/callback/path","sdk_disallow_closing_surveys":"No Example Provided","sdk_allow_close_after_seconds":30,"sdk_survey_refresh_interval_seconds":"No Example Provided"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 Created

{
  "data": {
    "id": "bce6fa6f-43ca-42f7-b2a5-3316c2599f0b",
    "name": "UserWise Hero Wars",
    "state": "live",
    "api_key": "9a87cb8b-7791-4c01-9705-0e2f006af781",
    "secret_key": "937ce876-170f-4531-a5ba-cb08c8bf054b",
    "survey_complete_callback_url": "https://192.168.200.14/your/survey/callback/path",
    "icon_url": "https://s3.amazonaws.com/some/bucket/path/to/your/icon.png",
    "sdk_disallow_closing_surveys": false,
    "sdk_allow_close_after_seconds": 30,
    "sdk_survey_interval_refresh_seconds": 10,
    "audience_stats": {
      "total_user_count": 123000,
      "trailing_30d_active_user_count": 90000,
      "trailing_7d_active_user_count": 10000
    }
  }
}

Updates an app resource within our system with the provided information. App information returned follows the same schema as when retrieving a single app.

HTTP Request

PUT https://api.userwise.io/api/v1/apps/{{ app_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
name No string The display name for your app
survey_complete_callback_url No string The full url we should use when handling server-to-server successful survey completion callback communication
sdk_disallow_closing_surveys No boolean If 'true', removes the ability for appusers to close surveys they are taking.
sdk_allow_close_after_seconds No integer The delay the user must wait before they can close out of the survey before completing.
sdk_survey_refresh_interval_seconds No integer The delay in seconds in between polling requests sent to the UserWise server, to check available surveys.

Delete an App

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :delete,
  url: 'https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}"
  -X DELETE
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.delete(url, headers=headers)
const https = require('https');

const options = {
  "method": "DELETE",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/apps/{{ app_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 204 No Content

Deletes an app resource record within our system. At this time, deleting an app does not clear out any app user data stored in our system.

HTTP Request

DELETE https://api.userwise.io/api/v1/apps/{{ app_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Player Events

Get All Events

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/events?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/events?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/events?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/events?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/events?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/events?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "2b5eefe3-5440-49c9-b7c3-4aa1247ff4b1": [
      { "event_id": "achievement_level_20", "attributes": [] },
      { "event_id": "act_one_completed", "attributes": [] },
      { "event_id": "iap_purchased", "attributes": [
        { "name": "purchased_on", "data_type": "datetime" },
        { "name": "bundle_cost", "data_type": "float" }
      ] }
    ],
    "{{ app_id }}": [{}]
  }
} 

Retrieves a unique set of all events with any attributes we've encountered, broken out by each app.

HTTP Request

GET https://api.userwise.io/api/v1/events

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Assign Events (w/ Attributes)

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/events?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:events=>[{:event_id=>"achievement_level_20"}, {:event_id=>"act_one_completed", :attributes=>[{:name=>"act_one_completed_on", :value=>"2020-02-01T00:00:00Z"}]}]}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/events?enc={{ generated_request_hash }}',
  payload: {:events=>[{:event_id=>"achievement_level_20"}, {:event_id=>"act_one_completed", :attributes=>[{:name=>"act_one_completed_on", :value=>"2020-02-01T00:00:00Z"}]}]},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/events?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"events":[{"event_id":"achievement_level_20"},{"event_id":"act_one_completed","attributes":[{"name":"act_one_completed_on","value":"2020-02-01T00:00:00Z"}]}]}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/events?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"events":[{"event_id":"achievement_level_20"},{"event_id":"act_one_completed","attributes":[{"name":"act_one_completed_on","value":"2020-02-01T00:00:00Z"}]}]}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/events?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"events":[{"event_id":"achievement_level_20"},{"event_id":"act_one_completed","attributes":[{"name":"act_one_completed_on","value":"2020-02-01T00:00:00Z"}]}]}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/appuser/{{ appuser_external_id }}/events?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"events":[{"event_id":"achievement_level_20"},{"event_id":"act_one_completed","attributes":[{"name":"act_one_completed_on","value":"2020-02-01T00:00:00Z"}]}]};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 204 No Content

Assigns the appuser the provided event ids, along with any accompanying attributes. These attributes are tied uniquely to this event. This will not overwrite any app user attributes.

For a better understanding of how attributes work, see the Assign Attributes section of our documentation.

HTTP Request

POST https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/events

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Description
events[].event_id Yes string The event id that should be assigned to the app user.
events[].attributes[].name No string An attribute name to assign to the app user.
events[].attributes[].value No any An attribute value to assign to the app user.
events[].attributes[].data_type No string The attribute data type that should be used if encountering a new attribute.

Revenue Events

Revenue events allows UserWise to provide better analytics regarding one of the most important parts of your game, earning revenue.

Assign Events (w/ Attributes)

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/revenue_events?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:revenue_events=>[{:transaction_id=>"b9e67424-8634-4d54-8fad-0ccc1f36a1f4", :revenue=>3.12, :product_id=>"124", :revenue_type=>"purchase"}, {:transaction_id=>"95ce3d88-bb30-4400-8b7d-e16a58cc810e", :revenue=>-0.34, :product_id=>"222", :revenue_type=>"refunded", :attributes=>[{:name=>"level", :value=>"43"}]}]}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/revenue_events?enc={{ generated_request_hash }}',
  payload: {:revenue_events=>[{:transaction_id=>"b9e67424-8634-4d54-8fad-0ccc1f36a1f4", :revenue=>3.12, :product_id=>"124", :revenue_type=>"purchase"}, {:transaction_id=>"95ce3d88-bb30-4400-8b7d-e16a58cc810e", :revenue=>-0.34, :product_id=>"222", :revenue_type=>"refunded", :attributes=>[{:name=>"level", :value=>"43"}]}]},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/revenue_events?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"revenue_events":[{"transaction_id":"b9e67424-8634-4d54-8fad-0ccc1f36a1f4","revenue":3.12,"product_id":"124","revenue_type":"purchase"},{"transaction_id":"95ce3d88-bb30-4400-8b7d-e16a58cc810e","revenue":-0.34,"product_id":"222","revenue_type":"refunded","attributes":[{"name":"level","value":"43"}]}]}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/revenue_events?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"revenue_events":[{"transaction_id":"b9e67424-8634-4d54-8fad-0ccc1f36a1f4","revenue":3.12,"product_id":"124","revenue_type":"purchase"},{"transaction_id":"95ce3d88-bb30-4400-8b7d-e16a58cc810e","revenue":-0.34,"product_id":"222","revenue_type":"refunded","attributes":[{"name":"level","value":"43"}]}]}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/revenue_events?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"revenue_events":[{"transaction_id":"b9e67424-8634-4d54-8fad-0ccc1f36a1f4","revenue":3.12,"product_id":"124","revenue_type":"purchase"},{"transaction_id":"95ce3d88-bb30-4400-8b7d-e16a58cc810e","revenue":-0.34,"product_id":"222","revenue_type":"refunded","attributes":[{"name":"level","value":"43"}]}]}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/appuser/{{ appuser_external_id }}/revenue_events?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"revenue_events":[{"transaction_id":"b9e67424-8634-4d54-8fad-0ccc1f36a1f4","revenue":3.12,"product_id":"124","revenue_type":"purchase"},{"transaction_id":"95ce3d88-bb30-4400-8b7d-e16a58cc810e","revenue":-0.34,"product_id":"222","revenue_type":"refunded","attributes":[{"name":"level","value":"43"}]}]};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 204 No Content

Assigns the appuser the provided revenue events, along with any accompanying attributes. These attributes are tied uniquely to this event. This will not overwrite any app user attributes.

For a better understanding of how attributes work, see the Assign Attributes section of our documentation.

HTTP Request

POST https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/revenue_events

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Description
revenue_events[].revenue Yes float How much revenue was involved in this revenue event.
revenue_events[].transaction_id No string Your unique transaction id for this event; should be unique. This field is optional yet if you provide it we'll attempt to update the event if we've seen it before. If you use a single transaction_id for a purchase and then refund you would send in 0 for revenue to reverse it. If you have different transaction_ids you would send in in the refund as a negative number.
revenue_events[].product_id No string This field is for you have skus you wish to better track in analytics.
revenue_events[].revenue_type No string Allows you specify a self-defined type of revenue. For instance purchase or refund.
revenue_events[].attributes[].name No string An attribute name to assign to the app user.
revenue_events[].attributes[].value No any An attribute value to assign to the app user.
revenue_events[].attributes[].data_type No string The attribute data type that should be used if encountering a new attribute.

App Regions

Get All App Regions

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_regions?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/app_regions?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_regions?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_regions?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_regions?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_regions?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "9b5759d6-656e-4f4d-ad6c-672ad800f3de": [
      { "name": "main_menu", "metadata": [] },
      { "name": "settings", "metadata": [] },
      { "name": "team_battle", "metadata": [
        { "name": "is_pvp", "data_type": "boolean" },
        { "name": "team_one_power_level", "data_type": "float" },
        { "name": "team_two_power_level", "data_type": "float" }
      ] }
    ],
    "{{ app_id }}": [{}]
  }
} 

Retrieves a unique set of all defined app regions with any metadata definitions we've encountered, broken out by each app.

HTTP Request

GET https://api.userwise.io/api/v1/app_regions

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Player Attributes

Get All Attributes

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/attributes?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/attributes?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/attributes?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/attributes?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/attributes?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/attributes?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "aad008d2-261b-4491-8ddf-4aa2d5d9ccdf": [
      { "name": "level", "data_type": "integer" },
      { "name": "is_whale", "data_type": "boolean" },
      { "name": "last_login", "data_type": "datetime" },
      { "name": "name", "data_type": "string" },
      { "name": "act_one_progress", "data_type": "float" }
    ],
    "{{ app_id }}": [{}]
  }
} 

Retrieves a unique set of attributes broken down by the app's they've been seen in. The attribute name and data type is returned.

HTTP Request

GET https://api.userwise.io/api/v1/attributes

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Assign Attributes

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/attributes?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:attributes=>[{:name=>"player_level", :value=>120}, {:name=>"is_whale", :value=>true, :data_type=>"boolean"}]}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/attributes?enc={{ generated_request_hash }}',
  payload: {:attributes=>[{:name=>"player_level", :value=>120}, {:name=>"is_whale", :value=>true, :data_type=>"boolean"}]},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/attributes?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"attributes":[{"name":"player_level","value":120},{"name":"is_whale","value":true,"data_type":"boolean"}]}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/attributes?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"attributes":[{"name":"player_level","value":120},{"name":"is_whale","value":true,"data_type":"boolean"}]}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/attributes?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"attributes":[{"name":"player_level","value":120},{"name":"is_whale","value":true,"data_type":"boolean"}]}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/appuser/{{ appuser_external_id }}/attributes?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"attributes":[{"name":"player_level","value":120},{"name":"is_whale","value":true,"data_type":"boolean"}]};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 204 No Content

Assigns the appuser the provided attribute names and value pairs. This operation acts as an upsert for attributes for the app user.

HTTP Request

POST https://api.userwise.io/api/v1/appuser/{{ appuser_external_id }}/attributes

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Description
attributes[].name Yes string The attribute name to assign to the app user.
attributes[].value Yes any The attribute value to assign to the app user.
attributes[].data_type No string The attribute data type that should be used if encountering a new attribute.

Segments

List all Segments

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/segments?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page_size={{ page_size }}&page={{ page }}&enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/segments?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page_size={{ page_size }}&page={{ page }}&enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/segments?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page_size={{ page_size }}&page={{ page }}&enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/segments?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page_size={{ page_size }}&page={{ page }}&enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/segments?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page_size={{ page_size }}&page={{ page }}&enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/segments?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page_size={{ page_size }}&page={{ page }}&enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "bba12c90-040d-4987-8e19-91da3eebb212",
    "name": "XYZ Whale Users",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "attributes": [
      {
        "operator": "equal",
        "name": "_platform",
        "values": [
          "android",
          "ios"
        ]
      },
      {
        "group_logical_operator": "and",
        "operator": "greater_than",
        "name": "player_level",
        "values": [
          50
        ]
      }
    ],
    "events": [
      {
        "logical_operator": "or",
        "event_sets": [
          {
            "event_id": "played_halloween_event_2020"
          },
          {
            "event_id": "iap_purchased",
            "attributes": [
              {
                "name": "player_ltv",
                "operator": "greater_than",
                "values": [
                  120
                ]
              }
            ]
          }
        ]
      },
      {
        "group_logical_operator": "and",
        "logical_operator": "not",
        "event_sets": [
          {
            "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
            "event_id": "played_christmas_event_2020"
          }
        ]
      }
    ],
    "audience_stats": {
      "total_user_count": 123000,
      "trailing_30d_active_user_count": 90000,
      "trailing_7d_active_user_count": 10000
    }
  }
}

Retrieves all segments in our system. The segment data returned includes name, app_id, targeting data, and various other stats regarding the users that match this segment.

HTTP Request

GET https://api.userwise.io/api/v1/segments

Query Parameters

Parameter Required Default Description
query No None Filter segments by names matching the query string provided. This is a funny search.
app_id No None Filter the segments by the provided app_id. By default UserWise will return segments for all of your apps.
sort_by No None The field to sort by.
sort_direction No None Direction to order the sorted results by. (asc or desc)
page_size No None How many results to return, per page. Default: 10
page No None Which page of results should be returned. (1 thru n). Default: 1
enc Yes None Generated request hash

Get a Segment

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "bba12c90-040d-4987-8e19-91da3eebb212",
    "name": "XYZ Whale Users",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "attributes": [
      {
        "operator": "equal",
        "name": "_platform",
        "values": [
          "android",
          "ios"
        ]
      },
      {
        "group_logical_operator": "and",
        "operator": "greater_than",
        "name": "player_level",
        "values": [
          50
        ]
      }
    ],
    "events": [
      {
        "logical_operator": "or",
        "event_sets": [
          {
            "event_id": "played_halloween_event_2020"
          },
          {
            "event_id": "iap_purchased",
            "attributes": [
              {
                "name": "player_ltv",
                "operator": "greater_than",
                "values": [
                  120
                ]
              }
            ]
          }
        ]
      },
      {
        "group_logical_operator": "and",
        "logical_operator": "not",
        "event_sets": [
          {
            "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
            "event_id": "played_christmas_event_2020"
          }
        ]
      }
    ],
    "audience_stats": {
      "total_user_count": 123000,
      "trailing_30d_active_user_count": 90000,
      "trailing_7d_active_user_count": 10000
    }
  }
}

Retrieves a single segment resource from our system. The segment data returned includes name, app_id, targeting data, and various other stats regarding the users that match this segment.

HTTP Request

GET https://api.userwise.io/api/v1/segments/{{ segment_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Create a Segment

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/segments?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"XYZ Whale Users", :events=>[{:logical_operator=>"or", :event_sets=>[{:event_id=>"played_halloween_event_2020"}, {:event_id=>"iap_purchased", :attributes=>[{:name=>"player_ltv", :operator=>"greater_than", :values=>[120]}]}]}, {:group_logical_operator=>"and", :logical_operator=>"not", :event_sets=>[{:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :event_id=>"played_christmas_event_2020"}]}], :attributes=>[{:operator=>"equal", :name=>"_platform", :values=>["android", "ios"]}, {:group_logical_operator=>"and", :operator=>"greater_than", :name=>"player_level", :values=>[50]}]}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/segments?enc={{ generated_request_hash }}',
  payload: {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"XYZ Whale Users", :events=>[{:logical_operator=>"or", :event_sets=>[{:event_id=>"played_halloween_event_2020"}, {:event_id=>"iap_purchased", :attributes=>[{:name=>"player_ltv", :operator=>"greater_than", :values=>[120]}]}]}, {:group_logical_operator=>"and", :logical_operator=>"not", :event_sets=>[{:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :event_id=>"played_christmas_event_2020"}]}], :attributes=>[{:operator=>"equal", :name=>"_platform", :values=>["android", "ios"]}, {:group_logical_operator=>"and", :operator=>"greater_than", :name=>"player_level", :values=>[50]}]},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/segments?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"XYZ Whale Users","events":[{"logical_operator":"or","event_sets":[{"event_id":"played_halloween_event_2020"},{"event_id":"iap_purchased","attributes":[{"name":"player_ltv","operator":"greater_than","values":[120]}]}]},{"group_logical_operator":"and","logical_operator":"not","event_sets":[{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","event_id":"played_christmas_event_2020"}]}],"attributes":[{"operator":"equal","name":"_platform","values":["android","ios"]},{"group_logical_operator":"and","operator":"greater_than","name":"player_level","values":[50]}]}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/segments?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"XYZ Whale Users","events":[{"logical_operator":"or","event_sets":[{"event_id":"played_halloween_event_2020"},{"event_id":"iap_purchased","attributes":[{"name":"player_ltv","operator":"greater_than","values":[120]}]}]},{"group_logical_operator":"and","logical_operator":"not","event_sets":[{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","event_id":"played_christmas_event_2020"}]}],"attributes":[{"operator":"equal","name":"_platform","values":["android","ios"]},{"group_logical_operator":"and","operator":"greater_than","name":"player_level","values":[50]}]}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/segments?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"XYZ Whale Users","events":[{"logical_operator":"or","event_sets":[{"event_id":"played_halloween_event_2020"},{"event_id":"iap_purchased","attributes":[{"name":"player_ltv","operator":"greater_than","values":[120]}]}]},{"group_logical_operator":"and","logical_operator":"not","event_sets":[{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","event_id":"played_christmas_event_2020"}]}],"attributes":[{"operator":"equal","name":"_platform","values":["android","ios"]},{"group_logical_operator":"and","operator":"greater_than","name":"player_level","values":[50]}]}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/segments?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"XYZ Whale Users","events":[{"logical_operator":"or","event_sets":[{"event_id":"played_halloween_event_2020"},{"event_id":"iap_purchased","attributes":[{"name":"player_ltv","operator":"greater_than","values":[120]}]}]},{"group_logical_operator":"and","logical_operator":"not","event_sets":[{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","event_id":"played_christmas_event_2020"}]}],"attributes":[{"operator":"equal","name":"_platform","values":["android","ios"]},{"group_logical_operator":"and","operator":"greater_than","name":"player_level","values":[50]}]};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "bba12c90-040d-4987-8e19-91da3eebb212",
    "name": "XYZ Whale Users",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "attributes": [
      {
        "operator": "equal",
        "name": "_platform",
        "values": [
          "android",
          "ios"
        ]
      },
      {
        "group_logical_operator": "and",
        "operator": "greater_than",
        "name": "player_level",
        "values": [
          50
        ]
      }
    ],
    "events": [
      {
        "logical_operator": "or",
        "event_sets": [
          {
            "event_id": "played_halloween_event_2020"
          },
          {
            "event_id": "iap_purchased",
            "attributes": [
              {
                "name": "player_ltv",
                "operator": "greater_than",
                "values": [
                  120
                ]
              }
            ]
          }
        ]
      },
      {
        "group_logical_operator": "and",
        "logical_operator": "not",
        "event_sets": [
          {
            "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
            "event_id": "played_christmas_event_2020"
          }
        ]
      }
    ],
    "audience_stats": {
      "total_user_count": 123000,
      "trailing_30d_active_user_count": 90000,
      "trailing_7d_active_user_count": 10000
    }
  },
}

Creates a new segment with the provided targeting information.

HTTP Request

POST https://api.userwise.io/api/v1/segments

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
app_id Yes string And array of app ids that should be associated with the survey
name No string The display name for the segment
events No hash[] Array of hash maps containing groups of event targeting logic. Checkout the guides section Targeting Events for an in-depth guide on how to properly target based on events and event attributes.
attributes No hash[] Array of hash maps containing groups of attribute targeting logic. Checkout the guides section Targeting Attributes for an in-depth guide on how to properly target based on events and event attributes.

Update a Segment

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/segments?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Put.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:name=>"XYZ Whale Users", :events=>[{:logical_operator=>"or", :event_sets=>[{:event_id=>"played_halloween_event_2020"}, {:event_id=>"iap_purchased", :attributes=>[{:name=>"player_ltv", :operator=>"greater_than", :values=>[120]}]}]}, {:group_logical_operator=>"and", :logical_operator=>"not", :event_sets=>[{:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :event_id=>"played_christmas_event_2020"}]}], :attributes=>[{:operator=>"equal", :name=>"_platform", :values=>["android", "ios"]}, {:group_logical_operator=>"and", :operator=>"greater_than", :name=>"player_level", :values=>[50]}]}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :put,
  url: 'https://api.userwise.io/api/v1/segments?enc={{ generated_request_hash }}',
  payload: {:name=>"XYZ Whale Users", :events=>[{:logical_operator=>"or", :event_sets=>[{:event_id=>"played_halloween_event_2020"}, {:event_id=>"iap_purchased", :attributes=>[{:name=>"player_ltv", :operator=>"greater_than", :values=>[120]}]}]}, {:group_logical_operator=>"and", :logical_operator=>"not", :event_sets=>[{:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :event_id=>"played_christmas_event_2020"}]}], :attributes=>[{:operator=>"equal", :name=>"_platform", :values=>["android", "ios"]}, {:group_logical_operator=>"and", :operator=>"greater_than", :name=>"player_level", :values=>[50]}]},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/segments?enc={{ generated_request_hash }}"
  -X PUT
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"name":"XYZ Whale Users","events":[{"logical_operator":"or","event_sets":[{"event_id":"played_halloween_event_2020"},{"event_id":"iap_purchased","attributes":[{"name":"player_ltv","operator":"greater_than","values":[120]}]}]},{"group_logical_operator":"and","logical_operator":"not","event_sets":[{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","event_id":"played_christmas_event_2020"}]}],"attributes":[{"operator":"equal","name":"_platform","values":["android","ios"]},{"group_logical_operator":"and","operator":"greater_than","name":"player_level","values":[50]}]}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/segments?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => '{"name":"XYZ Whale Users","events":[{"logical_operator":"or","event_sets":[{"event_id":"played_halloween_event_2020"},{"event_id":"iap_purchased","attributes":[{"name":"player_ltv","operator":"greater_than","values":[120]}]}]},{"group_logical_operator":"and","logical_operator":"not","event_sets":[{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","event_id":"played_christmas_event_2020"}]}],"attributes":[{"operator":"equal","name":"_platform","values":["android","ios"]},{"group_logical_operator":"and","operator":"greater_than","name":"player_level","values":[50]}]}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/segments?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"name":"XYZ Whale Users","events":[{"logical_operator":"or","event_sets":[{"event_id":"played_halloween_event_2020"},{"event_id":"iap_purchased","attributes":[{"name":"player_ltv","operator":"greater_than","values":[120]}]}]},{"group_logical_operator":"and","logical_operator":"not","event_sets":[{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","event_id":"played_christmas_event_2020"}]}],"attributes":[{"operator":"equal","name":"_platform","values":["android","ios"]},{"group_logical_operator":"and","operator":"greater_than","name":"player_level","values":[50]}]}
requests.put(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "PUT",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/segments?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"name":"XYZ Whale Users","events":[{"logical_operator":"or","event_sets":[{"event_id":"played_halloween_event_2020"},{"event_id":"iap_purchased","attributes":[{"name":"player_ltv","operator":"greater_than","values":[120]}]}]},{"group_logical_operator":"and","logical_operator":"not","event_sets":[{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","event_id":"played_christmas_event_2020"}]}],"attributes":[{"operator":"equal","name":"_platform","values":["android","ios"]},{"group_logical_operator":"and","operator":"greater_than","name":"player_level","values":[50]}]};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "bba12c90-040d-4987-8e19-91da3eebb212",
    "name": "XYZ Whale Users",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "attributes": [
      {
        "operator": "equal",
        "name": "_platform",
        "values": [
          "android",
          "ios"
        ]
      },
      {
        "group_logical_operator": "and",
        "operator": "greater_than",
        "name": "player_level",
        "values": [
          50
        ]
      }
    ],
    "events": [
      {
        "logical_operator": "or",
        "event_sets": [
          {
            "event_id": "played_halloween_event_2020"
          },
          {
            "event_id": "iap_purchased",
            "attributes": [
              {
                "name": "player_ltv",
                "operator": "greater_than",
                "values": [
                  120
                ]
              }
            ]
          }
        ]
      },
      {
        "group_logical_operator": "and",
        "logical_operator": "not",
        "event_sets": [
          {
            "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
            "event_id": "played_christmas_event_2020"
          }
        ]
      }
    ],
    "audience_stats": {
      "total_user_count": 123000,
      "trailing_30d_active_user_count": 90000,
      "trailing_7d_active_user_count": 10000
    }
  },
}

Updates an existing segment resource in our system with the provided targeting data.

HTTP Request

PUT https://api.userwise.io/api/v1/segments

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
name No string The display name for the segment
events No hash[] Array of hash maps containing groups of event targeting logic. Checkout the guides section Targeting Events for an in-depth guide on how to properly target based on events and event attributes.
attributes No hash[] Array of hash maps containing groups of attribute targeting logic. Checkout the guides section Targeting Attributes for an in-depth guide on how to properly target based on events and event attributes.

Delete a Segment

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :delete,
  url: 'https://api.userwise.io/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}"
  -X DELETE
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.delete(url, headers=headers)
const https = require('https');

const options = {
  "method": "DELETE",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/segments/{{ segment_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{ "data": "Successfully deleted Segment." }

Deletes a segment from the UserWise system.

HTTP Request

DELETE https://api.userwise.io/api/v1/segments/{{ segment_id }}

Products

Get All Products

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_products?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/app_products?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_products?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_products?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_products?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_products?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": [
    {
      "id": "f2244c44-d7c1-4cf0-b115-a0c928f680f3",
      "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
      "name": "My Product",
      "cost": 0.99,
      "android_id": "my-playstore-product-id",
      "ios_id": "my-appstore-product-id"
    },
    ...
  ]
}

Retrieves a list of product resources you have created within our system.

HTTP Request

GET https://api.userwise.io/api/v1/app_products

Query Parameters

Parameter Required Default Description
query No None Filter products that have any of the following that case-insentive match the query string: name, cost, android_id, and ios_id.
app_id No None Filter products by the provided app_id. By default UserWise will return products for all of your apps.
sort_by No None The field to sort by.
sort_direction No None Direction to order the sorted results by. (asc or desc)
enc Yes None Generated request hash

Get Product

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "f2244c44-d7c1-4cf0-b115-a0c928f680f3",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "My Product",
    "cost": 0.99,
    "android_id": "my-playstore-product-id",
    "ios_id": "my-appstore-product-id"
  }
}

Retrieves a single product resource from our system.

HTTP Request

GET https://api.userwise.io/api/v1/app_products/{{ product_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Create a Product

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_products?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"My Product", :cost=>0.99, :android_id=>"my-playstore-product-id", :ios_id=>"my-appstore-product-id"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/app_products?enc={{ generated_request_hash }}',
  payload: {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"My Product", :cost=>0.99, :android_id=>"my-playstore-product-id", :ios_id=>"my-appstore-product-id"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_products?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Product","cost":0.99,"android_id":"my-playstore-product-id","ios_id":"my-appstore-product-id"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_products?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Product","cost":0.99,"android_id":"my-playstore-product-id","ios_id":"my-appstore-product-id"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_products?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Product","cost":0.99,"android_id":"my-playstore-product-id","ios_id":"my-appstore-product-id"}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_products?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Product","cost":0.99,"android_id":"my-playstore-product-id","ios_id":"my-appstore-product-id"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "f2244c44-d7c1-4cf0-b115-a0c928f680f3",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "My Product",
    "cost": 0.99,
    "android_id": "my-playstore-product-id",
    "ios_id": "my-appstore-product-id"
  },
}

Creates a new product resource with the provided data.

HTTP Request

POST https://api.userwise.io/api/v1/app_products

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
app_id Yes string The app's id that should be associated with the product
name Yes string The display name for the new product
cost Yes float The cost for the product (should be the same as the android and ios store products).
android_id No string The Android App Store product id
ios_id No string The iOS App Store product id

Update a Product

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Put.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:name=>"My Product", :cost=>0.99, :android_id=>"my-playstore-product-id", :ios_id=>"my-appstore-product-id"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :put,
  url: 'https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}',
  payload: {:name=>"My Product", :cost=>0.99, :android_id=>"my-playstore-product-id", :ios_id=>"my-appstore-product-id"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}"
  -X PUT
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"name":"My Product","cost":0.99,"android_id":"my-playstore-product-id","ios_id":"my-appstore-product-id"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => '{"name":"My Product","cost":0.99,"android_id":"my-playstore-product-id","ios_id":"my-appstore-product-id"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"name":"My Product","cost":0.99,"android_id":"my-playstore-product-id","ios_id":"my-appstore-product-id"}
requests.put(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "PUT",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"name":"My Product","cost":0.99,"android_id":"my-playstore-product-id","ios_id":"my-appstore-product-id"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "f2244c44-d7c1-4cf0-b115-a0c928f680f3",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "My Product",
    "cost": 0.99,
    "android_id": "my-playstore-product-id",
    "ios_id": "my-appstore-product-id"
  }
}

Updates an existing product resource in our system with the provided data.

HTTP Request

PUT https://api.userwise.io/api/v1/app_products/{{ product_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
name No string The display name for the new product
cost No float The cost for the product (should be the same as the android and ios store products).
android_id No string The Android Play Store product id
ios_id No string The iOS App Store product id

Delete a Product

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :delete,
  url: 'https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}"
  -X DELETE
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.delete(url, headers=headers)
const https = require('https');

const options = {
  "method": "DELETE",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_products/{{ product_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200

{ "data": "Successfully deleted the app product." }

Deletes the product resource in our system.

HTTP Request

DELETE https://api.userwise.io/api/v1/app_products/{{ product_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Currencies

Get All Currencies

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_currencies?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/app_currencies?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_currencies?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_currencies?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_currencies?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_currencies?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 No Content

{
  "data": [
    {
      "id": "9d369483-96e3-48a2-b6b1-dbcb313f2d63",
      "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
      "name_singular": "Diamond",
      "name_plural": "Diamonds",
      "external_currency_id": "your-internal-currency-id",
      "icon_attachment_id": "e7cf0f4b-3a89-4b41-ba79-2cf7790545d4"
    },
    ...
  ]
}

Retrieves a list of currency resources you have created within our system.

HTTP Request

GET https://api.userwise.io/api/v1/app_currencies

Query Parameters

Parameter Required Default Description
query No None Filter currencies that have any of the following that case-insentive match the query string: name_singular and name_plural
app_id No None Filter currencies by the provided app_id. By default UserWise will return currencies for all of your apps.
sort_by No None The field to sort by.
sort_direction No None Direction to order the sorted results by. (asc or desc)
enc Yes None Generated request hash

Get Currency

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "9d369483-96e3-48a2-b6b1-dbcb313f2d63",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name_singular": "Diamond",
    "name_plural": "Diamonds",
    "external_currency_id": "your-internal-currency-id",
    "icon_attachment_id": "e7cf0f4b-3a89-4b41-ba79-2cf7790545d4"
  }
}

Retrieves a single currency resource from our system.

HTTP Request

GET https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Create a Currency

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_currencies?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name_singular=>"Diamond", :name_plural=>"Diamonds", :external_currency_id=>"your-internal-currency-id", :icon_attachment_id=>"No Example Provided"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/app_currencies?enc={{ generated_request_hash }}',
  payload: {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name_singular=>"Diamond", :name_plural=>"Diamonds", :external_currency_id=>"your-internal-currency-id", :icon_attachment_id=>"No Example Provided"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_currencies?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name_singular":"Diamond","name_plural":"Diamonds","external_currency_id":"your-internal-currency-id","icon_attachment_id":"No Example Provided"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_currencies?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name_singular":"Diamond","name_plural":"Diamonds","external_currency_id":"your-internal-currency-id","icon_attachment_id":"No Example Provided"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_currencies?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name_singular":"Diamond","name_plural":"Diamonds","external_currency_id":"your-internal-currency-id","icon_attachment_id":"No Example Provided"}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_currencies?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name_singular":"Diamond","name_plural":"Diamonds","external_currency_id":"your-internal-currency-id","icon_attachment_id":"No Example Provided"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "9d369483-96e3-48a2-b6b1-dbcb313f2d63",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name_singular": "Diamond",
    "name_plural": "Diamonds",
    "external_currency_id": "your-internal-currency-id",
    "icon_attachment_id": "e7cf0f4b-3a89-4b41-ba79-2cf7790545d4"
  },
}

Creates a new currency resource with the provided data.

HTTP Request

POST https://api.userwise.io/api/v1/app_currencies

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
app_id Yes string The app's id that should be associated with the currency
name_singular Yes string The display name for the new currency
name_plural Yes string The cost for the currency (should be the same as the android and ios store currencies).
external_currency_id Yes string Your internal id for this specific currency.
icon_attachment_id Yes string The media library media used by this currency.

Update a Currency

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Put.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:name_singular=>"Diamond", :name_plural=>"Diamonds", :external_currency_id=>"your-internal-currency-id", :icon_id=>"No Example Provided"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :put,
  url: 'https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}',
  payload: {:name_singular=>"Diamond", :name_plural=>"Diamonds", :external_currency_id=>"your-internal-currency-id", :icon_id=>"No Example Provided"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}"
  -X PUT
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"name_singular":"Diamond","name_plural":"Diamonds","external_currency_id":"your-internal-currency-id","icon_id":"No Example Provided"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => '{"name_singular":"Diamond","name_plural":"Diamonds","external_currency_id":"your-internal-currency-id","icon_id":"No Example Provided"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"name_singular":"Diamond","name_plural":"Diamonds","external_currency_id":"your-internal-currency-id","icon_id":"No Example Provided"}
requests.put(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "PUT",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"name_singular":"Diamond","name_plural":"Diamonds","external_currency_id":"your-internal-currency-id","icon_id":"No Example Provided"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "9d369483-96e3-48a2-b6b1-dbcb313f2d63",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name_singular": "Diamond",
    "name_plural": "Diamonds",
    "external_currency_id": "your-internal-currency-id",
    "icon_attachment_id": "e7cf0f4b-3a89-4b41-ba79-2cf7790545d4"
  }
}

Updates an existing currency resource in our system with the provided data.

HTTP Request

PUT https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
name_singular No string Singular-form name for the currency
name_plural No string Plural-form name for the currency.
external_currency_id No string Your internal id for this specific currency.
icon_id No string The media library media used to attach to this currency.

Delete a Currency

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :delete,
  url: 'https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}"
  -X DELETE
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.delete(url, headers=headers)
const https = require('https');

const options = {
  "method": "DELETE",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_currencies/{{ currency_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200

{ "data": "Successfully deleted the app currency." }

Deletes the currency resource in our system.

HTTP Request

DELETE https://api.userwise.io/api/v1/app_currencies/{{ currency_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Items

Get All Items

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_items?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/app_items?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_items?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_items?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_items?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_items?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 No Content

{
  "data": [
    {
      "id": "36c8d71f-458c-452f-9d2d-22e65f6b385f",
      "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
      "name": "Sword of the Mountain Elder",
      "external_item_id": "your-internal-item-id",
      "icon_attachment_id": "da7ae110-cbc6-41f5-a371-8dddbd9faa8e"
    },
    ...
  ]
}

Retrieves a list of item resources you have created within our system.

HTTP Request

GET https://api.userwise.io/api/v1/app_items

Query Parameters

Parameter Required Default Description
query No None Filter items that have any of the following that case-insentive match the query string: name_singular and name_plural
app_id No None Filter items by the provided app_id. By default UserWise will return items for all of your apps.
sort_by No None The field to sort by.
sort_direction No None Direction to order the sorted results by. (asc or desc)
enc Yes None Generated request hash

Get Item

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "36c8d71f-458c-452f-9d2d-22e65f6b385f",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "Sword of the Mountain Elder",
    "external_item_id": "your-internal-item-id",
    "icon_attachment_id": "da7ae110-cbc6-41f5-a371-8dddbd9faa8e"
  }
}

Retrieves a single item resource from our system.

HTTP Request

GET https://api.userwise.io/api/v1/app_items/{{ item_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Create a Item

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_items?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"No Example Provided", :external_item_id=>"your-internal-item-id", :icon_attachment_id=>"No Example Provided"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/app_items?enc={{ generated_request_hash }}',
  payload: {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"No Example Provided", :external_item_id=>"your-internal-item-id", :icon_attachment_id=>"No Example Provided"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_items?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"No Example Provided","external_item_id":"your-internal-item-id","icon_attachment_id":"No Example Provided"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_items?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"No Example Provided","external_item_id":"your-internal-item-id","icon_attachment_id":"No Example Provided"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_items?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"No Example Provided","external_item_id":"your-internal-item-id","icon_attachment_id":"No Example Provided"}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_items?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"No Example Provided","external_item_id":"your-internal-item-id","icon_attachment_id":"No Example Provided"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "36c8d71f-458c-452f-9d2d-22e65f6b385f",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "Sword of the Mountain Elder",
    "external_item_id": "your-internal-item-id",
    "icon_attachment_id": "da7ae110-cbc6-41f5-a371-8dddbd9faa8e"
  },
}

Creates a new item resource with the provided data.

HTTP Request

POST https://api.userwise.io/api/v1/app_items

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
app_id Yes string The app's id that should be associated with the item
name Yes string The name of the item.
external_item_id Yes string Your internal id for this specific item.
icon_attachment_id Yes string The media library media used by this item.

Update a Item

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Put.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:name=>"No Example Provided", :external_item_id=>"your-internal-item-id", :icon_attachment_id=>"No Example Provided"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :put,
  url: 'https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}',
  payload: {:name=>"No Example Provided", :external_item_id=>"your-internal-item-id", :icon_attachment_id=>"No Example Provided"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}"
  -X PUT
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"name":"No Example Provided","external_item_id":"your-internal-item-id","icon_attachment_id":"No Example Provided"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => '{"name":"No Example Provided","external_item_id":"your-internal-item-id","icon_attachment_id":"No Example Provided"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"name":"No Example Provided","external_item_id":"your-internal-item-id","icon_attachment_id":"No Example Provided"}
requests.put(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "PUT",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"name":"No Example Provided","external_item_id":"your-internal-item-id","icon_attachment_id":"No Example Provided"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "36c8d71f-458c-452f-9d2d-22e65f6b385f",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "Sword of the Mountain Elder",
    "external_item_id": "your-internal-item-id",
    "icon_attachment_id": "da7ae110-cbc6-41f5-a371-8dddbd9faa8e"
  }
}

Updates an existing item resource in our system with the provided data.

HTTP Request

PUT https://api.userwise.io/api/v1/app_items/{{ item_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
name No string Singular-form name for the item
external_item_id No string Your internal id for this specific item.
icon_attachment_id No string The media library media used by this item.

Delete a Item

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :delete,
  url: 'https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}"
  -X DELETE
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.delete(url, headers=headers)
const https = require('https');

const options = {
  "method": "DELETE",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_items/{{ item_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200

{ "data": "Successfully deleted the app item." }

Deletes the item resource in our system.

HTTP Request

DELETE https://api.userwise.io/api/v1/app_items/{{ item_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Bundles

Get All Bundles

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_bundles?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/app_bundles?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_bundles?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_bundles?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_bundles?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_bundles?query={{ query }}&app_id={{ app_id }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 No Content

{
  "data": [
    {
      "id": "8f796f96-53d5-4e86-83fc-75c1300bb052",
      "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
      "name": "My Special Bundle",
      "app_product_id": "6696e5c6-055a-46e1-b959-0ff9e653ae0b",
      "app_currency_ids": [
        "95ba0a55-cba2-4666-8081-4da0f1eebeab",
        "92213787-2fda-4e5b-9a3c-681ebea3a5cb",
        "1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"
      ],
      "app_item_ids": [
        "1dbad82c-2b81-4986-975b-7f45b0ffad4d",
        "f3281142-6824-48ca-9b5e-f933566da42d",
        "c869c994-d917-4252-aa48-3ec26cf2b945"
      ]
    },
    ...
  ]
}

Retrieves a list of bundle resources you have created within our system.

HTTP Request

GET https://api.userwise.io/api/v1/app_bundles

Query Parameters

Parameter Required Default Description
query No None Filter bundles that have any of the following that case-insentive match the query string: name.
app_id No None Filter bundles by the provided app_id. By default UserWise will return bundles for all of your apps.
sort_by No None The field to sort by.
sort_direction No None Direction to order the sorted results by. (asc or desc)
enc Yes None Generated request hash

Get Bundle

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "8f796f96-53d5-4e86-83fc-75c1300bb052",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "My Special Bundle",
    "app_product_id": "6696e5c6-055a-46e1-b959-0ff9e653ae0b",
    "app_currency_ids": [
      "95ba0a55-cba2-4666-8081-4da0f1eebeab",
      "92213787-2fda-4e5b-9a3c-681ebea3a5cb",
      "1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"
    ],
    "app_item_ids": [
      "1dbad82c-2b81-4986-975b-7f45b0ffad4d",
      "f3281142-6824-48ca-9b5e-f933566da42d",
      "c869c994-d917-4252-aa48-3ec26cf2b945"
    ]
  }
}

Retrieves a single bundle resource from our system.

HTTP Request

GET https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Create a Bundle

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_bundles?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"My Special Bundle", :product_id=>"6696e5c6-055a-46e1-b959-0ff9e653ae0b", :currency_ids=>["95ba0a55-cba2-4666-8081-4da0f1eebeab", "92213787-2fda-4e5b-9a3c-681ebea3a5cb", "1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"], :item_ids=>["1dbad82c-2b81-4986-975b-7f45b0ffad4d", "f3281142-6824-48ca-9b5e-f933566da42d", "c869c994-d917-4252-aa48-3ec26cf2b945"]}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/app_bundles?enc={{ generated_request_hash }}',
  payload: {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"My Special Bundle", :product_id=>"6696e5c6-055a-46e1-b959-0ff9e653ae0b", :currency_ids=>["95ba0a55-cba2-4666-8081-4da0f1eebeab", "92213787-2fda-4e5b-9a3c-681ebea3a5cb", "1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"], :item_ids=>["1dbad82c-2b81-4986-975b-7f45b0ffad4d", "f3281142-6824-48ca-9b5e-f933566da42d", "c869c994-d917-4252-aa48-3ec26cf2b945"]},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_bundles?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Special Bundle","product_id":"6696e5c6-055a-46e1-b959-0ff9e653ae0b","currency_ids":["95ba0a55-cba2-4666-8081-4da0f1eebeab","92213787-2fda-4e5b-9a3c-681ebea3a5cb","1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"],"item_ids":["1dbad82c-2b81-4986-975b-7f45b0ffad4d","f3281142-6824-48ca-9b5e-f933566da42d","c869c994-d917-4252-aa48-3ec26cf2b945"]}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_bundles?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Special Bundle","product_id":"6696e5c6-055a-46e1-b959-0ff9e653ae0b","currency_ids":["95ba0a55-cba2-4666-8081-4da0f1eebeab","92213787-2fda-4e5b-9a3c-681ebea3a5cb","1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"],"item_ids":["1dbad82c-2b81-4986-975b-7f45b0ffad4d","f3281142-6824-48ca-9b5e-f933566da42d","c869c994-d917-4252-aa48-3ec26cf2b945"]}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_bundles?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Special Bundle","product_id":"6696e5c6-055a-46e1-b959-0ff9e653ae0b","currency_ids":["95ba0a55-cba2-4666-8081-4da0f1eebeab","92213787-2fda-4e5b-9a3c-681ebea3a5cb","1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"],"item_ids":["1dbad82c-2b81-4986-975b-7f45b0ffad4d","f3281142-6824-48ca-9b5e-f933566da42d","c869c994-d917-4252-aa48-3ec26cf2b945"]}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_bundles?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Special Bundle","product_id":"6696e5c6-055a-46e1-b959-0ff9e653ae0b","currency_ids":["95ba0a55-cba2-4666-8081-4da0f1eebeab","92213787-2fda-4e5b-9a3c-681ebea3a5cb","1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"],"item_ids":["1dbad82c-2b81-4986-975b-7f45b0ffad4d","f3281142-6824-48ca-9b5e-f933566da42d","c869c994-d917-4252-aa48-3ec26cf2b945"]};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "8f796f96-53d5-4e86-83fc-75c1300bb052",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "My Special Bundle",
    "app_product_id": "6696e5c6-055a-46e1-b959-0ff9e653ae0b",
    "app_currency_ids": [
      "95ba0a55-cba2-4666-8081-4da0f1eebeab",
      "92213787-2fda-4e5b-9a3c-681ebea3a5cb",
      "1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"
    ],
    "app_item_ids": [
      "1dbad82c-2b81-4986-975b-7f45b0ffad4d",
      "f3281142-6824-48ca-9b5e-f933566da42d",
      "c869c994-d917-4252-aa48-3ec26cf2b945"
    ]
  },
}

Creates a new bundle resource with the provided data.

HTTP Request

POST https://api.userwise.io/api/v1/app_bundles

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
app_id Yes string The app's id that should be associated with the bundle
name Yes string The display name for the new bundle
product_id Yes float An app product id that is used to define the pricepoint for the bundle
currency_ids Yes string[] An array of currency ids
item_ids Yes string[] An array of item ids

Update a Bundle

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Put.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"My Special Bundle", :app_product_id=>"6696e5c6-055a-46e1-b959-0ff9e653ae0b", :app_currency_ids=>["95ba0a55-cba2-4666-8081-4da0f1eebeab", "92213787-2fda-4e5b-9a3c-681ebea3a5cb", "1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"]}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :put,
  url: 'https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}',
  payload: {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"My Special Bundle", :app_product_id=>"6696e5c6-055a-46e1-b959-0ff9e653ae0b", :app_currency_ids=>["95ba0a55-cba2-4666-8081-4da0f1eebeab", "92213787-2fda-4e5b-9a3c-681ebea3a5cb", "1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"]},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}"
  -X PUT
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Special Bundle","app_product_id":"6696e5c6-055a-46e1-b959-0ff9e653ae0b","app_currency_ids":["95ba0a55-cba2-4666-8081-4da0f1eebeab","92213787-2fda-4e5b-9a3c-681ebea3a5cb","1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"]}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Special Bundle","app_product_id":"6696e5c6-055a-46e1-b959-0ff9e653ae0b","app_currency_ids":["95ba0a55-cba2-4666-8081-4da0f1eebeab","92213787-2fda-4e5b-9a3c-681ebea3a5cb","1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"]}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Special Bundle","app_product_id":"6696e5c6-055a-46e1-b959-0ff9e653ae0b","app_currency_ids":["95ba0a55-cba2-4666-8081-4da0f1eebeab","92213787-2fda-4e5b-9a3c-681ebea3a5cb","1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"]}
requests.put(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "PUT",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"My Special Bundle","app_product_id":"6696e5c6-055a-46e1-b959-0ff9e653ae0b","app_currency_ids":["95ba0a55-cba2-4666-8081-4da0f1eebeab","92213787-2fda-4e5b-9a3c-681ebea3a5cb","1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"]};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "8f796f96-53d5-4e86-83fc-75c1300bb052",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "My Special Bundle",
    "app_product_id": "6696e5c6-055a-46e1-b959-0ff9e653ae0b",
    "app_currency_ids": [
      "95ba0a55-cba2-4666-8081-4da0f1eebeab",
      "92213787-2fda-4e5b-9a3c-681ebea3a5cb",
      "1fa7a2cd-90b6-413e-9843-4c5c375ef7a6"
    ],
    "app_item_ids": [
      "1dbad82c-2b81-4986-975b-7f45b0ffad4d",
      "f3281142-6824-48ca-9b5e-f933566da42d",
      "c869c994-d917-4252-aa48-3ec26cf2b945"
    ]
  }
}

Updates an existing bundle resource in our system with the provided data.

HTTP Request

PUT https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
app_id No string The app's id that should be associated with the bundle
name No string The display name for the new bundle
app_product_id No string An app product id that is used to define the pricepoint for the bundle
app_currency_ids No string[] An array of app currency ids

Delete a Bundle

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :delete,
  url: 'https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}"
  -X DELETE
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.delete(url, headers=headers)
const https = require('https');

const options = {
  "method": "DELETE",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_bundles/{{ bundle_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200

{ "data": "Successfully deleted the app bundle." }

Deletes the bundle resource in our system.

HTTP Request

DELETE https://api.userwise.io/api/v1/app_bundles/{{ bundle_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Categories

Get All Categories

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_categories?app_id={{ app_id }}&categoryable_type={{ categoryable_type }}&enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/app_categories?app_id={{ app_id }}&categoryable_type={{ categoryable_type }}&enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_categories?app_id={{ app_id }}&categoryable_type={{ categoryable_type }}&enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_categories?app_id={{ app_id }}&categoryable_type={{ categoryable_type }}&enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_categories?app_id={{ app_id }}&categoryable_type={{ categoryable_type }}&enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_categories?app_id={{ app_id }}&categoryable_type={{ categoryable_type }}&enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": [
    {
      "id": "fdcfddc2-b007-47a0-bfa7-2c5b73719d0f",
      "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
      "name": "Weekend Events",
      "categoryable_type": "scheduled_campaign",
      "color": "#F0F0F0"
    },
    ...
  ]
}

Retrieves a list of campaign resources you have created within our system.

HTTP Request

GET https://api.userwise.io/api/v1/app_categories

Query Parameters

Parameter Required Default Description
app_id No None Filter categories by the provided app_id.
categoryable_type No None The type of content to receive categories for. (scheduled_campaign, triggered_campaign, or campaign_content)
enc Yes None Generated request hash

Create a Category

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_categories?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :categoryable_type=>"scheduled_campaign", :name=>"Weekend Events", :color=>"#F0F0F0"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/app_categories?enc={{ generated_request_hash }}',
  payload: {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :categoryable_type=>"scheduled_campaign", :name=>"Weekend Events", :color=>"#F0F0F0"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_categories?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","categoryable_type":"scheduled_campaign","name":"Weekend Events","color":"#F0F0F0"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_categories?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","categoryable_type":"scheduled_campaign","name":"Weekend Events","color":"#F0F0F0"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_categories?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","categoryable_type":"scheduled_campaign","name":"Weekend Events","color":"#F0F0F0"}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_categories?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","categoryable_type":"scheduled_campaign","name":"Weekend Events","color":"#F0F0F0"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "fdcfddc2-b007-47a0-bfa7-2c5b73719d0f",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "Weekend Events",
    "categoryable_type": "scheduled_campaign",
    "color": "#F0F0F0"
  },
}

Creates a new campaign with the provided details.

HTTP Request

POST https://api.userwise.io/api/v1/app_categories

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
app_id Yes string App ID for the category
categoryable_type Yes string Must be "scheduled_campaign" or "triggered_campaign"
name Yes string The display name for the category
color Yes string The color to be used as a representation of this category in the UserWise UI

Update a Category

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Put.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:name=>"Weekend Events", :color=>"#F0F0F0"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :put,
  url: 'https://api.userwise.io/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}',
  payload: {:name=>"Weekend Events", :color=>"#F0F0F0"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}"
  -X PUT
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"name":"Weekend Events","color":"#F0F0F0"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => '{"name":"Weekend Events","color":"#F0F0F0"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"name":"Weekend Events","color":"#F0F0F0"}
requests.put(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "PUT",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"name":"Weekend Events","color":"#F0F0F0"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "fdcfddc2-b007-47a0-bfa7-2c5b73719d0f",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "Weekend Events",
    "categoryable_type": "scheduled_campaign",
    "color": "#F0F0F0"
  },
}

Updates the campaign with the provided details.

HTTP Request

PUT https://api.userwise.io/api/v1/app_categories/{{ category_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
name Yes string The display name for the category
color Yes string The color to be used as a representation of this category in the UserWise UI

Delete a Category

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :delete,
  url: 'https://api.userwise.io/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}"
  -X DELETE
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.delete(url, headers=headers)
const https = require('https');

const options = {
  "method": "DELETE",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/app_categories/{{ category_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{ "data": "Successfully deleted the app category." }

Soft-deletes the category resource in our system.

You can not delete categories with the categoryable_type of campaign_content.

HTTP Request

DELETE https://api.userwise.io/api/v1/app_categories/{{ category_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Campaigns

Get All Campaigns

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns?query={{ query }}&app_id={{ app_id }}&delivery_type={{ delivery_type }}&state={{ state }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page={{ page }}&page_size={{ page_size }}&enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/campaigns?query={{ query }}&app_id={{ app_id }}&delivery_type={{ delivery_type }}&state={{ state }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page={{ page }}&page_size={{ page_size }}&enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns?query={{ query }}&app_id={{ app_id }}&delivery_type={{ delivery_type }}&state={{ state }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page={{ page }}&page_size={{ page_size }}&enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns?query={{ query }}&app_id={{ app_id }}&delivery_type={{ delivery_type }}&state={{ state }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page={{ page }}&page_size={{ page_size }}&enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns?query={{ query }}&app_id={{ app_id }}&delivery_type={{ delivery_type }}&state={{ state }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page={{ page }}&page_size={{ page_size }}&enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns?query={{ query }}&app_id={{ app_id }}&delivery_type={{ delivery_type }}&state={{ state }}&sort_by={{ sort_by }}&sort_direction={{ sort_direction }}&page={{ page }}&page_size={{ page_size }}&enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": [
    {
      "id": "ee8d7407-2452-4c11-9f48-f024bdafd3cc",
      "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
      "name": "Christmas 2021 Campaign",
      "description": "Campaign for all users in 2021",
      "category_id": "fd5a8ca3-6506-492c-9263-e16658810a36",
      "delivery_type": "scheduled",
      "start_at": "2021-12-10T00:00:00Z",
      "start_at_tz": "utc",
      "end_at": "2021-12-31T00:00:00Z",
      "end_at_tz": "utc",
      "tags": [
        "one_tag",
        "another_tag"
      ],
      "segment_ids": [

      ]
    },
    ...
  ]
}

Retrieves a list of campaign resources you have created within our system.

HTTP Request

GET https://api.userwise.io/api/v1/campaigns

Query Parameters

Parameter Required Default Description
query No None Filter campaigns that have any of the following that case-insentive match the query string: name & tags.
app_id No None Filter campaigns by the provided app_id. By default UserWise will return campaigns for all of your apps.
delivery_type No None 'scheduled' or 'triggered'
state No None Query for campaigns in a specific state. (draft, running, paused, attention_required, completed)
sort_by No None The field to sort by.
sort_direction No None Direction to order the sorted results by. (asc or desc)
page No None The pagination page.
page_size No None Number of records to return in each page. Used for pagination.
enc Yes None Generated request hash

Get Campaign

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "0f2dcdfc-e389-4790-ab0c-5245d4335960",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "Christmas 2021 Campaign",
    "description": "Campaign for all users in 2021",
    "category_id": "af5d7a68-d5f2-493a-a394-5a8bda96050c",
    "delivery_type": "triggered",
    "start_at": "2021-12-10T00:00:00Z",
    "start_at_tz": "utc",
    "end_at": "2021-12-31T00:00:00Z",
    "end_at_tz": "utc",
    "tags": [
      "one_tag",
      "another_tag"
    ],
    "segment_ids": [

    ],
    "contents": [

    ]
  }
}

Retrieves a single campaign resource from our system.

HTTP Request

GET https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Create a Campaign

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"Christmas 2021 Campaign", :delivery_type=>"triggered", :description=>"No Example Provided", :category_id=>"No Example Provided", :start_at=>"No Example Provided", :start_at_tz=>"No Example Provided", :end_at=>"No Example Provided", :end_at_tz=>"No Example Provided", :tags=>"No Example Provided", :segment_ids=>"No Example Provided"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/campaigns?enc={{ generated_request_hash }}',
  payload: {:app_id=>"a29c2d51-b096-47ed-a68b-12aa94c33f65", :name=>"Christmas 2021 Campaign", :delivery_type=>"triggered", :description=>"No Example Provided", :category_id=>"No Example Provided", :start_at=>"No Example Provided", :start_at_tz=>"No Example Provided", :end_at=>"No Example Provided", :end_at_tz=>"No Example Provided", :tags=>"No Example Provided", :segment_ids=>"No Example Provided"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"Christmas 2021 Campaign","delivery_type":"triggered","description":"No Example Provided","category_id":"No Example Provided","start_at":"No Example Provided","start_at_tz":"No Example Provided","end_at":"No Example Provided","end_at_tz":"No Example Provided","tags":"No Example Provided","segment_ids":"No Example Provided"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"Christmas 2021 Campaign","delivery_type":"triggered","description":"No Example Provided","category_id":"No Example Provided","start_at":"No Example Provided","start_at_tz":"No Example Provided","end_at":"No Example Provided","end_at_tz":"No Example Provided","tags":"No Example Provided","segment_ids":"No Example Provided"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"Christmas 2021 Campaign","delivery_type":"triggered","description":"No Example Provided","category_id":"No Example Provided","start_at":"No Example Provided","start_at_tz":"No Example Provided","end_at":"No Example Provided","end_at_tz":"No Example Provided","tags":"No Example Provided","segment_ids":"No Example Provided"}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"app_id":"a29c2d51-b096-47ed-a68b-12aa94c33f65","name":"Christmas 2021 Campaign","delivery_type":"triggered","description":"No Example Provided","category_id":"No Example Provided","start_at":"No Example Provided","start_at_tz":"No Example Provided","end_at":"No Example Provided","end_at_tz":"No Example Provided","tags":"No Example Provided","segment_ids":"No Example Provided"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "0f2dcdfc-e389-4790-ab0c-5245d4335960",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "Christmas 2021 Campaign",
    "description": "Campaign for all users in 2021",
    "category_id": "af5d7a68-d5f2-493a-a394-5a8bda96050c",
    "delivery_type": "triggered",
    "start_at": "2021-12-10T00:00:00Z",
    "start_at_tz": "utc",
    "end_at": "2021-12-31T00:00:00Z",
    "end_at_tz": "utc",
    "tags": [
      "one_tag",
      "another_tag"
    ],
    "segment_ids": [

    ],
    "contents": [

    ]
  },
}

Creates a new campaign with the provided details.

HTTP Request

POST https://api.userwise.io/api/v1/campaigns

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
app_id Yes string App ID for the campaign
name No string The display name for the campaign
delivery_type No string 'scheduled' or 'triggered'
description No string A description of this campaign
category_id No string The id of the category for this campaign
start_at No datetime Start DateTime in ISO8601 format
start_at_tz No string (enum) "utc" or "player_local"
end_at No datetime End DateTime in ISO8601 format
end_at_tz No string (enum) "utc" or "player_local"
tags No string[] Array of tags for this campaign
segment_ids No string[] Array of segment ids for this campaign. A user must be in one of these segments to receive the campaign

Update a Campaign

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Put.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:name=>"No Example Provided", :description=>"No Example Provided", :category_id=>"No Example Provided", :start_at=>"No Example Provided", :start_at_tz=>"No Example Provided", :end_at=>"No Example Provided", :end_at_tz=>"No Example Provided", :tags=>"No Example Provided", :segment_ids=>"No Example Provided"}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :put,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}',
  payload: {:name=>"No Example Provided", :description=>"No Example Provided", :category_id=>"No Example Provided", :start_at=>"No Example Provided", :start_at_tz=>"No Example Provided", :end_at=>"No Example Provided", :end_at_tz=>"No Example Provided", :tags=>"No Example Provided", :segment_ids=>"No Example Provided"},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}"
  -X PUT
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"name":"No Example Provided","description":"No Example Provided","category_id":"No Example Provided","start_at":"No Example Provided","start_at_tz":"No Example Provided","end_at":"No Example Provided","end_at_tz":"No Example Provided","tags":"No Example Provided","segment_ids":"No Example Provided"}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => '{"name":"No Example Provided","description":"No Example Provided","category_id":"No Example Provided","start_at":"No Example Provided","start_at_tz":"No Example Provided","end_at":"No Example Provided","end_at_tz":"No Example Provided","tags":"No Example Provided","segment_ids":"No Example Provided"}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"name":"No Example Provided","description":"No Example Provided","category_id":"No Example Provided","start_at":"No Example Provided","start_at_tz":"No Example Provided","end_at":"No Example Provided","end_at_tz":"No Example Provided","tags":"No Example Provided","segment_ids":"No Example Provided"}
requests.put(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "PUT",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"name":"No Example Provided","description":"No Example Provided","category_id":"No Example Provided","start_at":"No Example Provided","start_at_tz":"No Example Provided","end_at":"No Example Provided","end_at_tz":"No Example Provided","tags":"No Example Provided","segment_ids":"No Example Provided"};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "0f2dcdfc-e389-4790-ab0c-5245d4335960",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "Christmas 2021 Campaign",
    "description": "Campaign for all users in 2021",
    "category_id": "af5d7a68-d5f2-493a-a394-5a8bda96050c",
    "delivery_type": "triggered",
    "start_at": "2021-12-10T00:00:00Z",
    "start_at_tz": "utc",
    "end_at": "2021-12-31T00:00:00Z",
    "end_at_tz": "utc",
    "tags": [
      "one_tag",
      "another_tag"
    ],
    "segment_ids": [

    ],
    "contents": [

    ]
  },
}

Updates a campaign with the provided details.

HTTP Request

PUT https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
name No string The display name for the campaign
description No string A description of this campaign
category_id No string The id of the category for this campaign
start_at No datetime Start DateTime in ISO8601 format
start_at_tz No string (enum) "utc" or "player_local"
end_at No datetime End DateTime in ISO8601 format
end_at_tz No string (enum) "utc" or "player_local"
tags No string[] Array of tags for this campaign
segment_ids No string[] Array of segment ids for this campaign. A user must be in one of these segments to receive the campaign

Delete a Campaign

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :delete,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}"
  -X DELETE
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.delete(url, headers=headers)
const https = require('https');

const options = {
  "method": "DELETE",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200

{ "data": "Successfully deleted the app campaign." }

Deletes the campaign resource in our system.

HTTP Request

DELETE https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Duplicate a Campaign

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/duplicate?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/duplicate?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/duplicate?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/duplicate?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/duplicate?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}/duplicate?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "4971518d-5577-4e7c-b258-5b83ce0ec488",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "Christmas 2021 Campaign (Duplicate)",
    "description": "Campaign for all users in 2021",
    "category_id": "af5d7a68-d5f2-493a-a394-5a8bda96050c",
    "delivery_type": "triggered",
    "start_at": "2021-12-10T00:00:00Z",
    "start_at_tz": "utc",
    "end_at": "2021-12-31T00:00:00Z",
    "end_at_tz": "utc",
    "tags": [
      "one_tag",
      "another_tag"
    ],
    "segment_ids": [

    ],
    "contents": [

    ]
  },
}

Creates a new campaign resource by duplicate the provided campaign resource. Copies all contents and settings.

HTTP Request

POST https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/duplicate

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Pause a Campaign

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/pause?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/pause?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/pause?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/pause?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/pause?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}/pause?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": "#<Middleman::CoreExtensions::Data::DataStore:0x00007fcf92658da8>",
}

Pauses the campaign making the campaign unnable to be started or entered by a player. To reverse this, call the start endpoint.

HTTP Request

POST https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/pause

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Unpause a Campaign

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/start?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/start?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/start?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/start?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/start?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}/start?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "4971518d-5577-4e7c-b258-5b83ce0ec488",
    "app_id": "a29c2d51-b096-47ed-a68b-12aa94c33f65",
    "name": "Christmas 2021 Campaign (Duplicate)",
    "description": "Campaign for all users in 2021",
    "category_id": "af5d7a68-d5f2-493a-a394-5a8bda96050c",
    "delivery_type": "triggered",
    "start_at": "2021-12-10T00:00:00Z",
    "start_at_tz": "utc",
    "end_at": "2021-12-31T00:00:00Z",
    "end_at_tz": "utc",
    "tags": [
      "one_tag",
      "another_tag"
    ],
    "segment_ids": [

    ],
    "contents": [

    ]
  },
}

Unpauses the campaign making the campaign.

HTTP Request

POST https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/start

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Campaign Contents

Get Content

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "a5d9c9d9-80c9-45e8-bbb5-e01fa832b849",
    "type": "offer",
    "delivery": {
      "start_at_type": "concrete",
      "start_at_time": "2021-12-10T00:00:00Z",
      "start_at_tz": "utc",
      "end_at_type": "concrete",
      "end_at_time": "2021-12-10T00:00:00Z",
      "segment_ids": [
        "86ce48a1-034d-4118-b6a9-051ac106bb8e",
        "..."
      ]
    },
    "content": {
      "name": "My Offer",
      "title": "Upgrade Your Hero!",
      "body": "Buy this offer to upgrade your hero.",
      "portrait_image_id": "0f695046-76fe-438f-af1b-677a7957600b",
      "landscape_image_id": "b409862a-11c0-4a40-a830-10d3bd1853e4",
      "app_bundle_id": "7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"
    }
  }
}

Retrieves the data for the provided campaign content.

HTTP Request

GET https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Create new Content

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:type=>"offer", :"delivery.start_at_type"=>"concrete", :"delivery.start_at_time"=>"2021-12-10T00:00:00Z", :"delivery.start_at_tz"=>"utc", :"delivery.end_at_type"=>"concrete", :"delivery.end_at_time"=>"2021-12-10T00:00:00Z", :"delivery.segment_ids"=>["86ce48a1-034d-4118-b6a9-051ac106bb8e", "..."], :content=>{:name=>"My Offer", :title=>"Upgrade Your Hero!", :body=>"Buy this offer to upgrade your hero.", :portrait_image_id=>"0f695046-76fe-438f-af1b-677a7957600b", :landscape_image_id=>"b409862a-11c0-4a40-a830-10d3bd1853e4", :app_bundle_id=>"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content?enc={{ generated_request_hash }}',
  payload: {:type=>"offer", :"delivery.start_at_type"=>"concrete", :"delivery.start_at_time"=>"2021-12-10T00:00:00Z", :"delivery.start_at_tz"=>"utc", :"delivery.end_at_type"=>"concrete", :"delivery.end_at_time"=>"2021-12-10T00:00:00Z", :"delivery.segment_ids"=>["86ce48a1-034d-4118-b6a9-051ac106bb8e", "..."], :content=>{:name=>"My Offer", :title=>"Upgrade Your Hero!", :body=>"Buy this offer to upgrade your hero.", :portrait_image_id=>"0f695046-76fe-438f-af1b-677a7957600b", :landscape_image_id=>"b409862a-11c0-4a40-a830-10d3bd1853e4", :app_bundle_id=>"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"type":"offer","delivery.start_at_type":"concrete","delivery.start_at_time":"2021-12-10T00:00:00Z","delivery.start_at_tz":"utc","delivery.end_at_type":"concrete","delivery.end_at_time":"2021-12-10T00:00:00Z","delivery.segment_ids":["86ce48a1-034d-4118-b6a9-051ac106bb8e","..."],"content":{"name":"My Offer","title":"Upgrade Your Hero!","body":"Buy this offer to upgrade your hero.","portrait_image_id":"0f695046-76fe-438f-af1b-677a7957600b","landscape_image_id":"b409862a-11c0-4a40-a830-10d3bd1853e4","app_bundle_id":"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"type":"offer","delivery.start_at_type":"concrete","delivery.start_at_time":"2021-12-10T00:00:00Z","delivery.start_at_tz":"utc","delivery.end_at_type":"concrete","delivery.end_at_time":"2021-12-10T00:00:00Z","delivery.segment_ids":["86ce48a1-034d-4118-b6a9-051ac106bb8e","..."],"content":{"name":"My Offer","title":"Upgrade Your Hero!","body":"Buy this offer to upgrade your hero.","portrait_image_id":"0f695046-76fe-438f-af1b-677a7957600b","landscape_image_id":"b409862a-11c0-4a40-a830-10d3bd1853e4","app_bundle_id":"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"type":"offer","delivery.start_at_type":"concrete","delivery.start_at_time":"2021-12-10T00:00:00Z","delivery.start_at_tz":"utc","delivery.end_at_type":"concrete","delivery.end_at_time":"2021-12-10T00:00:00Z","delivery.segment_ids":["86ce48a1-034d-4118-b6a9-051ac106bb8e","..."],"content":{"name":"My Offer","title":"Upgrade Your Hero!","body":"Buy this offer to upgrade your hero.","portrait_image_id":"0f695046-76fe-438f-af1b-677a7957600b","landscape_image_id":"b409862a-11c0-4a40-a830-10d3bd1853e4","app_bundle_id":"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}/content?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"type":"offer","delivery.start_at_type":"concrete","delivery.start_at_time":"2021-12-10T00:00:00Z","delivery.start_at_tz":"utc","delivery.end_at_type":"concrete","delivery.end_at_time":"2021-12-10T00:00:00Z","delivery.segment_ids":["86ce48a1-034d-4118-b6a9-051ac106bb8e","..."],"content":{"name":"My Offer","title":"Upgrade Your Hero!","body":"Buy this offer to upgrade your hero.","portrait_image_id":"0f695046-76fe-438f-af1b-677a7957600b","landscape_image_id":"b409862a-11c0-4a40-a830-10d3bd1853e4","app_bundle_id":"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "a5d9c9d9-80c9-45e8-bbb5-e01fa832b849",
    "type": "offer",
    "delivery": {
      "start_at_type": "concrete",
      "start_at_time": "2021-12-10T00:00:00Z",
      "start_at_tz": "utc",
      "end_at_type": "concrete",
      "end_at_time": "2021-12-10T00:00:00Z",
      "segment_ids": [
        "86ce48a1-034d-4118-b6a9-051ac106bb8e",
        "..."
      ]
    },
    "content": {
      "name": "My Offer",
      "title": "Upgrade Your Hero!",
      "body": "Buy this offer to upgrade your hero.",
      "portrait_image_id": "0f695046-76fe-438f-af1b-677a7957600b",
      "landscape_image_id": "b409862a-11c0-4a40-a830-10d3bd1853e4",
      "app_bundle_id": "7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"
    }
  },
}

Creates a new piece of campaign content with the provided details.

HTTP Request

POST https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
type Yes string (enum) The type of content to create. (survey, poll, offer, campaign_event, message, variables)
delivery.start_at_type No string (enum) parent Sets the start type for the content. ("parent" or "concrete")
delivery.start_at_time No datetime Sets the start at date time for the piece of content. Must be in ISO8601 format. Must be within the campaigns start and end.
delivery.start_at_tz No string (enum) Sets the timezone setting for the start of the content. ("utc" or "player_local")
delivery.end_at_type No string (enum) parent Sets the end type for the content. ("parent" or "concrete")
delivery.end_at_time No datetime Sets the end at date time for the piece of content. Must be in ISO8601 format. Must be within the campaigns start and end.
delivery.segment_ids No string[] Array of segment ids for this campaign content. A user must be in one of these segments to receive the campaign
content No object A dynamic object containing fields that are content-type dependent.

Polls/Surveys Content Fields

Field Required Type Description
content.name No string The name of the piece of content
content.questions[].text No string The text/label for the survey question
content.questions[].type No string The type of question (single_select, multi_select, rating, ranking, open_ended)
content.questions[].question_options[].value No string A question option value (if type is not open_ended)

Offers Content Fields

Field Required Type Description
content.name No string The name of the piece of content
content.title No string Title description used when displaying the offer in-game
content.body No string Body description used when displaying the offer in-game
content.portrait_image_id No string ID of a media library image, used when displaying the offer in portrait mode
content.landscape_image_id No string ID of a media library image, used when displaying the offer in landscape mode
content.app_bundle_id No string ID of the app bundle attached to the offer

Messages Content Fields

Field Required Type Description
content.name No string The name of the piece of content
content.title No string Title description used when displaying the message in-game
content.body No string Body description used when displaying the message in-game
content.portrait_image_id No string ID of a media library image, used when displaying the message in portrait mode
content.landscape_image_id No string ID of a media library image, used when displaying the message in landscape mode
content.message_type No string The type of message
content.additional_fields_schema No object The schema used to define the structure of the extra message content
content.additional_fields_data No object The data that which matches the provided schema

Campaign Events Content Fields

At this time, campaign events can only be created through the campaign events endpoint.

Variables Content Fields

At this time, variables can only be created through the variables endpoint.

Update Content

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Put.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:type=>"offer", :"delivery.start_at_type"=>"concrete", :"delivery.start_at_time"=>"2021-12-10T00:00:00Z", :"delivery.start_at_tz"=>"utc", :"delivery.end_at_type"=>"concrete", :"delivery.end_at_time"=>"2021-12-10T00:00:00Z", :"delivery.segment_ids"=>["86ce48a1-034d-4118-b6a9-051ac106bb8e", "..."], :content=>{:name=>"My Offer", :title=>"Upgrade Your Hero!", :body=>"Buy this offer to upgrade your hero.", :portrait_image_id=>"0f695046-76fe-438f-af1b-677a7957600b", :landscape_image_id=>"b409862a-11c0-4a40-a830-10d3bd1853e4", :app_bundle_id=>"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :put,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}',
  payload: {:type=>"offer", :"delivery.start_at_type"=>"concrete", :"delivery.start_at_time"=>"2021-12-10T00:00:00Z", :"delivery.start_at_tz"=>"utc", :"delivery.end_at_type"=>"concrete", :"delivery.end_at_time"=>"2021-12-10T00:00:00Z", :"delivery.segment_ids"=>["86ce48a1-034d-4118-b6a9-051ac106bb8e", "..."], :content=>{:name=>"My Offer", :title=>"Upgrade Your Hero!", :body=>"Buy this offer to upgrade your hero.", :portrait_image_id=>"0f695046-76fe-438f-af1b-677a7957600b", :landscape_image_id=>"b409862a-11c0-4a40-a830-10d3bd1853e4", :app_bundle_id=>"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}"
  -X PUT
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"type":"offer","delivery.start_at_type":"concrete","delivery.start_at_time":"2021-12-10T00:00:00Z","delivery.start_at_tz":"utc","delivery.end_at_type":"concrete","delivery.end_at_time":"2021-12-10T00:00:00Z","delivery.segment_ids":["86ce48a1-034d-4118-b6a9-051ac106bb8e","..."],"content":{"name":"My Offer","title":"Upgrade Your Hero!","body":"Buy this offer to upgrade your hero.","portrait_image_id":"0f695046-76fe-438f-af1b-677a7957600b","landscape_image_id":"b409862a-11c0-4a40-a830-10d3bd1853e4","app_bundle_id":"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => '{"type":"offer","delivery.start_at_type":"concrete","delivery.start_at_time":"2021-12-10T00:00:00Z","delivery.start_at_tz":"utc","delivery.end_at_type":"concrete","delivery.end_at_time":"2021-12-10T00:00:00Z","delivery.segment_ids":["86ce48a1-034d-4118-b6a9-051ac106bb8e","..."],"content":{"name":"My Offer","title":"Upgrade Your Hero!","body":"Buy this offer to upgrade your hero.","portrait_image_id":"0f695046-76fe-438f-af1b-677a7957600b","landscape_image_id":"b409862a-11c0-4a40-a830-10d3bd1853e4","app_bundle_id":"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"type":"offer","delivery.start_at_type":"concrete","delivery.start_at_time":"2021-12-10T00:00:00Z","delivery.start_at_tz":"utc","delivery.end_at_type":"concrete","delivery.end_at_time":"2021-12-10T00:00:00Z","delivery.segment_ids":["86ce48a1-034d-4118-b6a9-051ac106bb8e","..."],"content":{"name":"My Offer","title":"Upgrade Your Hero!","body":"Buy this offer to upgrade your hero.","portrait_image_id":"0f695046-76fe-438f-af1b-677a7957600b","landscape_image_id":"b409862a-11c0-4a40-a830-10d3bd1853e4","app_bundle_id":"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}}
requests.put(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "PUT",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"type":"offer","delivery.start_at_type":"concrete","delivery.start_at_time":"2021-12-10T00:00:00Z","delivery.start_at_tz":"utc","delivery.end_at_type":"concrete","delivery.end_at_time":"2021-12-10T00:00:00Z","delivery.segment_ids":["86ce48a1-034d-4118-b6a9-051ac106bb8e","..."],"content":{"name":"My Offer","title":"Upgrade Your Hero!","body":"Buy this offer to upgrade your hero.","portrait_image_id":"0f695046-76fe-438f-af1b-677a7957600b","landscape_image_id":"b409862a-11c0-4a40-a830-10d3bd1853e4","app_bundle_id":"7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"}};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "a5d9c9d9-80c9-45e8-bbb5-e01fa832b849",
    "type": "offer",
    "delivery": {
      "start_at_type": "concrete",
      "start_at_time": "2021-12-10T00:00:00Z",
      "start_at_tz": "utc",
      "end_at_type": "concrete",
      "end_at_time": "2021-12-10T00:00:00Z",
      "segment_ids": [
        "86ce48a1-034d-4118-b6a9-051ac106bb8e",
        "..."
      ]
    },
    "content": {
      "name": "My Offer",
      "title": "Upgrade Your Hero!",
      "body": "Buy this offer to upgrade your hero.",
      "portrait_image_id": "0f695046-76fe-438f-af1b-677a7957600b",
      "landscape_image_id": "b409862a-11c0-4a40-a830-10d3bd1853e4",
      "app_bundle_id": "7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"
    }
  },
}

Creates a new piece of campaign content with the provided details.

HTTP Request

PUT https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
type Yes string (enum) The type of content to create. (survey, poll, offer, campaign_event, message, variables)
delivery.start_at_type No string (enum) parent Sets the start type for the content. ("parent" or "concrete")
delivery.start_at_time No datetime Sets the start at date time for the piece of content. Must be in ISO8601 format. Must be within the campaigns start and end.
delivery.start_at_tz No string (enum) Sets the timezone setting for the start of the content. ("utc" or "player_local")
delivery.end_at_type No string (enum) parent Sets the end type for the content. ("parent" or "concrete")
delivery.end_at_time No datetime Sets the end at date time for the piece of content. Must be in ISO8601 format. Must be within the campaigns start and end.
delivery.segment_ids No string[] Array of segment ids for this campaign content. A user must be in one of these segments to receive the campaign
content No object A dynamic object containing fields that are content-type dependent.

Polls/Surveys Content Fields

Field Required Type Description
content.name No string The name of the piece of content
content.questions[].text No string The text/label for the survey question
content.questions[].type No string The type of question (single_select, multi_select, rating, ranking, open_ended)
content.questions[].question_options[].value No string A question option value (if type is not open_ended)

Offers Content Fields

Field Required Type Description
content.name No string The name of the piece of content
content.title No string Title description used when displaying the offer in-game
content.body No string Body description used when displaying the offer in-game
content.portrait_image_id No string ID of a media library image, used when displaying the offer in portrait mode
content.landscape_image_id No string ID of a media library image, used when displaying the offer in landscape mode
content.app_bundle_id No string ID of the app bundle attached to the offer

Messages Content Fields

Field Required Type Description
content.name No string The name of the piece of content
content.title No string Title description used when displaying the message in-game
content.body No string Body description used when displaying the message in-game
content.portrait_image_id No string ID of a media library image, used when displaying the message in portrait mode
content.landscape_image_id No string ID of a media library image, used when displaying the message in landscape mode
content.message_type No string The type of message
content.additional_fields_schema No object The schema used to define the structure of the extra message content
content.additional_fields_data No object The data that which matches the provided schema

Campaign Events Content Fields

At this time, campaign events can only be created through the campaign events endpoint.

Variables Content Fields

At this time, variables can only be created through the variables endpoint.

Delete a Content

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :delete,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}"
  -X DELETE
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.delete(url, headers=headers)
const https = require('https');

const options = {
  "method": "DELETE",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200

{ "data": "Successfully deleted the content." }

Deletes the campaign content resource in our system.

HTTP Request

DELETE https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Duplicate Content

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}/duplicate?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}/duplicate?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}/duplicate?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}/duplicate?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}/duplicate?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}/duplicate?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "ae4d038d-1fe9-48e9-a7f6-31a176f572fa",
    "type": "offer",
    "delivery": {
      "start_at_type": "concrete",
      "start_at_time": "2021-12-10T00:00:00Z",
      "start_at_tz": "utc",
      "end_at_type": "concrete",
      "end_at_time": "2021-12-10T00:00:00Z",
      "segment_ids": [
        "86ce48a1-034d-4118-b6a9-051ac106bb8e",
        "..."
      ]
    },
    "content": {
      "name": "My Offer (Duplicate)",
      "title": "Upgrade Your Hero!",
      "body": "Buy this offer to upgrade your hero.",
      "portrait_image_id": "0f695046-76fe-438f-af1b-677a7957600b",
      "landscape_image_id": "b409862a-11c0-4a40-a830-10d3bd1853e4",
      "app_bundle_id": "7755a0cb-cf57-4b7f-aaa3-d3b8b36548b4"
    }
  },
}

Creates a new campaign content resource by duplicating the original campaign content resource.

HTTP Request

POST https://api.userwise.io/api/v1/campaigns/{{ campaign_id }}/content/{{ content_id }}/duplicate

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Campaign Event Lists

Get Lists

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists?query={{ query }}&page={{ page }}&per_page={{ per_page }}&enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists?query={{ query }}&page={{ page }}&per_page={{ per_page }}&enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists?query={{ query }}&page={{ page }}&per_page={{ per_page }}&enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists?query={{ query }}&page={{ page }}&per_page={{ per_page }}&enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists?query={{ query }}&page={{ page }}&per_page={{ per_page }}&enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1//apps/{{ app_id }}/campaign_event_lists?query={{ query }}&page={{ page }}&per_page={{ per_page }}&enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": [
    {
      "id": "2880468d-1333-402f-84f4-650ec9600fb0",
      "name": "My List",
      "key": "myList",
      "list": [
        "One Item",
        "Two Item",
        "Three Item",
        "Four Item"
      ]
    },
    ...
  ]
}

Retrieves a list of campaign event list resources you have created within our system.

HTTP Request

GET https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists

Query Parameters

Parameter Required Default Description
query No None Filter campaign event lists; searches for key and name.
page No None Curren page. Used with pagination
per_page No None Number of records per page. Used with pagination
enc Yes None Generated request hash

Get a List

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1//apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": [
    {
      "id": "2880468d-1333-402f-84f4-650ec9600fb0",
      "name": "My List",
      "key": "myList",
      "list": [
        "One Item",
        "Two Item",
        "Three Item",
        "Four Item"
      ]
    },
    ...
  ]
}

Retrieves a list of campaign event list resources you have created within our system.

HTTP Request

GET https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Create a List

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/apps/{{ app_id }}/campaign_event_lists?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 201 Created

{
  "data": {
    "id": "2880468d-1333-402f-84f4-650ec9600fb0",
    "name": "My List",
    "key": "myList",
    "list": [
      "One Item",
      "Two Item",
      "Three Item",
      "Four Item"
    ]
  },
}

Creates a new campaign event list.

These lists are referenced within Campaign Event Template schemas.

HTTP Request

POST https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Update a List

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Put.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:name=>"My List", :key=>"myList", :list=>["One Item", "Two Item", "Three Item", "Four Item"]}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :put,
  url: 'https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}',
  payload: {:name=>"My List", :key=>"myList", :list=>["One Item", "Two Item", "Three Item", "Four Item"]},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}"
  -X PUT
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"name":"My List","key":"myList","list":["One Item","Two Item","Three Item","Four Item"]}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => '{"name":"My List","key":"myList","list":["One Item","Two Item","Three Item","Four Item"]}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"name":"My List","key":"myList","list":["One Item","Two Item","Three Item","Four Item"]}
requests.put(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "PUT",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"name":"My List","key":"myList","list":["One Item","Two Item","Three Item","Four Item"]};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": {
    "id": "2880468d-1333-402f-84f4-650ec9600fb0",
    "name": "My List",
    "key": "myList",
    "list": [
      "One Item",
      "Two Item",
      "Three Item",
      "Four Item"
    ]
  }
}

Updates an existing product resource in our system with the provided data.

HTTP Request

PUT https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

JSON Request Body Fields

Field Required Type Default Description
name No string The display name of the list
key No string The key used to reference this list in campaign event templates
list No array The array of data to return set

Delete a List

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :delete,
  url: 'https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}"
  -X DELETE
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.delete(url, headers=headers)
const https = require('https');

const options = {
  "method": "DELETE",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200

{ "data": "Successfully deleted the campaign event list." }

Deletes the campaign event list resource in our system.

HTTP Request

DELETE https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_lists/{{ campaign_event_list_id }}

Query Parameters

Parameter Required Default Description
enc Yes None Generated request hash

Campaign Event Templates

Get Templates

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_templates?query={{ query }}&enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :get,
  url: 'https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_templates?query={{ query }}&enc={{ generated_request_hash }}',
  payload: {},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_templates?query={{ query }}&enc={{ generated_request_hash }}"
  -X GET
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_templates?query={{ query }}&enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",

));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_templates?query={{ query }}&enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}

requests.get(url, headers=headers)
const https = require('https');

const options = {
  "method": "GET",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1//apps/{{ app_id }}/campaign_event_templates?query={{ query }}&enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {};
const params = JSON.stringify(json);

const request = https.request(options, (response) => {
  let chunks = [];

  response.on("data", (chunk) => {
    chunks.push(chunk);
  });
});

request.write(params);
request.end();

Successful Response: HTTP Status 200 OK

{
  "data": [
    {
      "id": "4d7a2662-1d03-4746-8964-ff21006a7de6",
      "name": "My Event Template",
      "json": {
        "name": {
          "type": "string",
          "title": "name",
          "default": "Clan Games"
        },
        "total_points": {
          "type": "integer",
          "default": 75000,
          "title": "Total Points"
        },
        "rewards": {
          "type": "array",
          "items": {
            "type": "object",
            "title": "Rewards",
            "properties": {
              "item": {
                "type": "string",
                "required": true
              },
              "amount": {
                "type": "integer",
                "required": true
              }
            }
          }
        }
      },
      "external_event_type": "my_event_type"
    },
    ...
  ]
}

Retrieves a list of campaign event template resources you have created within our system.

HTTP Request

GET https://api.userwise.io/api/v1//apps/{{ app_id }}/campaign_event_templates

Query Parameters

Parameter Required Default Description
query No None Filter campaign event templates; searches for key and name.
enc Yes None Generated request hash

Create a Template

Request:

# Using net/http
require 'net/http'
require 'json'
require 'base64'

uri = URI('https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_templates?enc={{ generated_request_hash }}')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, initheader: {'Content-Type' => 'application/json'})
request['X-Api-Key'] = Base64.encode64('{{ your_app_api_key }}')
request.body = {:name=>"My Event Template", :external_event_type=>"my_event_type", :json=>{:name=>{:type=>"string", :title=>"name", :default=>"Clan Games"}, :total_points=>{:type=>"integer", :default=>75000, :title=>"Total Points"}, :rewards=>{:type=>"array", :items=>{:type=>"object", :title=>"Rewards", :properties=>{:item=>{:type=>"string", :required=>true}, :amount=>{:type=>"integer", :required=>true}}}}}}.to_json

http.request(request)



# Using the 'rest-client' gem
require 'rest-client'
require 'base64'

RestClient::Request.execute(
  method: :post,
  url: 'https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_templates?enc={{ generated_request_hash }}',
  payload: {:name=>"My Event Template", :external_event_type=>"my_event_type", :json=>{:name=>{:type=>"string", :title=>"name", :default=>"Clan Games"}, :total_points=>{:type=>"integer", :default=>75000, :title=>"Total Points"}, :rewards=>{:type=>"array", :items=>{:type=>"object", :title=>"Rewards", :properties=>{:item=>{:type=>"string", :required=>true}, :amount=>{:type=>"integer", :required=>true}}}}}},
  content_type: 'application/json',
  headers: {
    'X-Api-Key': Base64.encode64('{{ your_app_api_key }}')
  }
)
curl "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_templates?enc={{ generated_request_hash }}"
  -X POST
  -H "X-Api-Key: {{ your_app_api_key_base64_encoded }}"
  -H "Content-Type: application/json"
  --data '{"name":"My Event Template","external_event_type":"my_event_type","json":{"name":{"type":"string","title":"name","default":"Clan Games"},"total_points":{"type":"integer","default":75000,"title":"Total Points"},"rewards":{"type":"array","items":{"type":"object","title":"Rewards","properties":{"item":{"type":"string","required":true},"amount":{"type":"integer","required":true}}}}}}'

<?php

/** Using cURL **/
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_templates?enc={{ generated_request_hash }}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-Api-Key: ' . base64_encode('{{ your_app_api_key }}')
  ),
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{"name":"My Event Template","external_event_type":"my_event_type","json":{"name":{"type":"string","title":"name","default":"Clan Games"},"total_points":{"type":"integer","default":75000,"title":"Total Points"},"rewards":{"type":"array","items":{"type":"object","title":"Rewards","properties":{"item":{"type":"string","required":true},"amount":{"type":"integer","required":true}}}}}}'
));

$response = curl_exec($curl);

curl_close($curl);
import requests

url = "https://api.userwise.io/api/v1/apps/{{ app_id }}/campaign_event_templates?enc={{ generated_request_hash }}"
headers = {
  "Content-Type": "application/json",
  "X-Api-Key": base64.b64encode("{{ your_app_api_key }}")
}
body = {"name":"My Event Template","external_event_type":"my_event_type","json":{"name":{"type":"string","title":"name","default":"Clan Games"},"total_points":{"type":"integer","default":75000,"title":"Total Points"},"rewards":{"type":"array","items":{"type":"object","title":"Rewards","properties":{"item":{"type":"string","required":true},"amount":{"type":"integer","required":true}}}}}}
requests.post(url, headers=headers, data=body)
const https = require('https');

const options = {
  "method": "POST",
  "hostname": "api.userwise.io",
  "port": 443,
  "path": "/api/v1/apps/{{ app_id }}/campaign_event_templates?enc={{ generated_request_hash }}",
  "headers": {
    "Content-Type": "application/json",
    "X-Api-Key": Buffer.from("{{ your_app_api_key }}").toString('base64')
  }
};

const json = {"name":"My Event Template","external_event_type":"my_event_type","json":{"name":{"type":"string","title":"name","default":"Clan Games"},"total_points":{"type":"integer","default":75000,"title":"Total Points"},"rewards":{"type":"array","items"