# API Documentation v1.1
## API Endpoint Responses
Every API endponts has standard API response looks like this:
```json
{
"data": {}, // Response data
"message": "Success" // Response message
}
```
This documentation only focus on the response data
### Initialize SDK
#### Endpoint
```
POST /initialize
```
#### Response (in `data` field)
| Field | Type | Nullable | Description |
| ----------------- | ----------------------------- | -------- | ---------------------------------------------- |
| publisherApp | [PublisherApp](#publisherapp) | No | Publisher app information |
| user | [User](#user) | No | User information |
| newRegisteredUser | Boolean | No | Indicates if the user is a new registered user |
| newDevice | Boolean | No | Indicates if the device is a new device |
### Create Publisher User
#### Endpoint
```
POST /publisher-user
```
#### Response (in `data` field)
| Field | Type | Nullable | Description |
| --------------- | ------ | -------- | ------------------------ |
| publisherUserId | String | No | The ID of publisher user |
### Update User
#### Endpoint
```
PUT /update-user
```
#### Response (in `data` field)
| Field | Type | Nullable | Description |
| ----- | ------------- | -------- | ---------------- |
| user | [User](#user) | No | User information |
### Targeted Campaigns
#### Endpoint
```
GET /campaigns
```
#### Response
| Field | Type | Nullable | Description |
| ----- | ----------------------- | -------- | -------------------------- |
| data | [Campaign[]](#campaign) | No | List of targeted campaigns |
### Targeted Campaign Detail
#### Endpoint
```
GET /campaigns/:campaignId
```
#### Response
| Field | Type | Nullable | Description |
| ----- | --------------------------------- | -------- | -------------------- |
| data | [CampaignDetail](#campaigndetail) | No | Campaign detail data |
### Activa A Campaign
#### Endpoint
```
POST /campaigns/active/:campaignId
```
### Response (in `data` field)
| Field | Type | Nullable | Description |
| ------------------- | ------- | -------- | -------------------------------------- |
| isCampaignActivated | Boolean | No | Indicates if the campaign is activated |
### Activated Campaigns
#### Endpoint
```
GET /activated-campaigns
```
#### Response
| Field | Type | Nullable | Description |
| ----- | ----------------------- | -------- | --------------------------- |
| data | [Campaign[]](#campaign) | No | List of activated campaigns |
### Campaign Support Ticket
#### Endpoint
```
GET /campaigns/:campaignId/tickets
```
#### Response
| Field | Type | Nullable | Description |
| ----- | ----------------------------------------------------- | -------- | -------------------------- |
| data | [SupportTicketCategories[]](#supportticketcategories) | No | The list of support ticket |
### Submit Support Ticket
#### Endpoint
```
GET /campaigns/:campaignId/tickets
```
#### Response (in `data` field)
| Field | Type | Nullable | Description |
| ----------------- | ------- | -------- | ------------------------------------ |
| isTicketSubmitted | boolean | No | Indicates if the ticket is submitted |
## API References
### User
| Field | Type | Nullable | Description |
| --------------- | -------- | -------- | ---------------------------------------------------- |
| id | Int | No | ID |
| publisherUserId | String | Yes | Publisher user ID |
| publisherAppId | Int | No | PublisherApp ID |
| adUnitId | Int | No | AdUnit ID |
| email | String | Yes | Email address of the user |
| phoneNumber | String | Yes | Phone number of the user |
| platform | String | Yes | Platform used by the user. Enum: `Android`,`iOS` |
| country | String | Yes | Country of the user |
| age | Int | Yes | Age of the user |
| gender | Int | Yes | Gender of the user |
| highRisk | Boolean | Yes | Indicates if the user is high risk. Default: `false` |
| createdAt | DateTime | No | Timestamp of when the record was created |
| modifiedAt | DateTime | Yes | Timestamp of when the record was last modified |
### PublisherApp
| Field | Type | Nullable | Description |
| ------------------ | ------------------------------------- | -------- | ----------- |
| id | Int | No | |
| publisherId | Int | No | |
| platform | String | No | |
| packageName | String | No | |
| baseUrl | String | No | |
| title | String | Yes | |
| summary | String | Yes | |
| thumbnail | String | Yes | |
| rating | Float | Yes | |
| downloadsMin | Int | Yes | |
| downloadsMax | Int | Yes | |
| website | String | Yes | |
| size | Int | Yes | |
| containsAds | Boolean | Yes | |
| developer | String | Yes | |
| userRatingsCount | Int | Yes | |
| iapMin | Float | Yes | |
| iapMax | Float | Yes | |
| privacyPolicyUrl | String | Yes | |
| contentRating | String | Yes | |
| releaseDate | DateTime | Yes | |
| r1 | Int | Yes | |
| r2 | Int | Yes | |
| r3 | Int | Yes | |
| r4 | Int | Yes | |
| r5 | Int | Yes | |
| catKeys | String | Yes | |
| description | String | Yes | |
| similar | String | Yes | |
| screenshots | String | Yes | |
| promoVideo | String | Yes | |
| availableIn | String | Yes | |
| appStoreCategoryId | Int | Yes | |
| addUnits | [AdUnit[]](#adunit) | No | |
| appStoreCategory | [AppStoreCategory](#appstorecategory) | No | |
| headerColor | string | No | Publisher app header color |
| mainColor | string | No | Publisher app main color |
### AppStoreCategory
| Field | Type | Nullable | Description |
| ----- | ------ | -------- | ------------------------------------------------ |
| id | Int | No | ID |
| name | String | No | Name of the app store category |
| store | String | No | Associated app store. Enum: `googlePlay`,`apple` |
### AdUnit
| Field | Type | Nullable | Description |
| ------------------ | ------------------------- | -------- | ------------------------------ |
| id | Int | No | ID |
| publisherId | Int | No | Publisher's ID |
| publisherAppId | Int | No | Publisher's application ID |
| identifier | String | No | Identifier for the ad unit |
| name | String | No | Name of the ad unit |
| adUnitTypeId | Int | No | Ad unit type ID |
| currencyIcon | String | Yes | Icon representing the currency |
| currencyName | String | Yes | Name of the currency |
| currencyConversion | Decimal | No | Currency conversion rate |
| adUnitType | [AdUnitType](#adunittype) | No | Ad unit type information |
### AdUnitType
| Field | Type | Nullable | Description |
| ----- | ------ | -------- | ------------------------ |
| id | Int | No | ID |
| name | String | No | Name of the ad unit type |
### Campaign
| Field | Type | Nullable | Description |
| ------------------- | --------------------------------------- | -------- | ----------------------------------------------------------- |
| campaignId | Int | No | ID |
| campaignName | String | No | Name of the campaign |
| campaignDescription | String | Yes | Description of the campaign
| createdOn | Datetime | Yes | Datetime when the campaign created |
| sortingScore | Decimal | Yes | Score to sorting the campaigns |
| status | String | No | Status of the campaign. Enum: `active`,`paused`,`suspended` |
| app | [CampaignApp](#campaignapp) | No | App associated with the campaign |
| currency | [CampaignCurrency](#campaigncurrency) | No | Currency associated with the campaign |
| campaignPayout | [CampaignPayout](#campaignpayout) | No | Payout of the campaign |
| tracking | [CampaignTracking](#campaigntracking) | No | Tracking information of the campaign |
| targeting | [CampaignTargeting](#campaigntargeting) | No | Targeting information of the campaign |
| creative | [CampaignCreative](#campaigncreative) | No | Creative information of the campaign |
### CampaignDetail
| Field | Type | Nullable | Description |
| ------------------- | --------------------------------------- | -------- | ----------------------------------------------------------- |
| campaignId | Int | No | ID |
| campaignName | String | No | Name of the campaign |
| campaignDescription | String | Yes | Description of the campaign |
| createdOn | Datetime | Yes | Datetime when the campaign created |
| sortingScore | Decimal | Yes | Score to sorting the campaigns |
| status | String | No | Status of the campaign. Enum: `active`,`paused`,`suspended` |
| app | [CampaignApp](#campaignapp) | No | App associated with the campaign |
| currency | [CampaignCurrency](#campaigncurrency) | No | Currency associated with the campaign |
| campaignPayout | [CampaignPayout](#campaignpayout) | No | Payout of the campaign |
| tracking | [CampaignTracking](#campaigntracking) | No | Tracking information of the campaign |
| targeting | [CampaignTargeting](#campaigntargeting) | No | Targeting information of the campaign |
| creative | [CampaignCreative](#campaigncreative) | No | Creative information of the campaign |
| payoutEvents | [PayoutEvent[]](#payoutevent) | No | List of payout events of the campaign |
| microCharge | [MicroCharge](#microcharge) | No | Microcharge information of the campaign |
| microChargeEvents | [MicroChargeEvent[]](#microchargeevent) | No | List of microcharge events of the campaign |
| playtimeEvents | [PlaytimeEvent[]](#playtimeevent) | No | List of playtime events of the campaign |
| isInstalled | Boolean | No | Indicates if the app is installed |
#### CampaignApp
| Field | Type | Nullable | Description |
| ---------------- | ------ | -------- | ------------------------------------------------ |
| id | Int | No | ID |
| title | String | Yes | Title of the app |
| packageName | String | No | Package name of the app |
| rating | Float | Yes | Rating of the app |
| shortDescription | String | Yes | Short description of the app |
| store | String | Yes | Associated app store. Enum: `googlePlay`,`apple` |
| storeCategory | String | Yes | Category of the app on store |
| previewUrl | String | No | Preview URL of the app |
| thumbnail | String | Yes | Thumbnail of the app |
### CampaignCurrency
| Field | Type | Nullable | Description |
| ------------------------ | ------- | -------- | -------------------------------- |
| name | String | No | Name of the currency |
| symbol | String | No | Symbol of the currency |
| adUnitName | String | No | Ad unit name |
| adUnitCurrencyName | String | No | Ad unit currency name |
| adUnitCurrencyIcon | String | No | Ad unit currency icon |
| adUnitCurrencyConversion | Decimal | No | Ad unit currency conversion rate |
### CampaignPayout
| Field | Type | Nullable | Description |
| -------------------- | ---- | -------- | --------------------------------------------------------------- |
| totalEvents | Int | No | Total count of campaign events |
| totalPayout | Int | No | Total payout amount of the campaign |
| totalPayoutConverted | Int | No | `totalPayout` \* `adUnitCurrencyConversion` of CampaignCurrency |
### CampaignTracking
| Field | Type | Nullable | Description |
| --------------- | ------ | -------- | ------------------------------------- |
| attributionTool | String | No | Attribution tool used by the campaign |
| clickUrl | String | No | Click URL of the campaign |
| impressionUrl | String | No | Impression URL of the campaign |
### CampaignTargeting
| Field | Type | Nullable | Description |
| ------------- | --------------------------------------------------- | -------- | -------------------------------------------------------------------- |
| os | String | Yes | Platform of the campaign. Enum: `Android`,`iOS` |
| targetingType | String | Yes | Targeting type of the campaign. Enum: `incent`, `non-incent`, `both` |
| reward | [CampaignTargetingReward](#campaigntargetingreward) | Yes | Reward of the campaign |
### CampaignTargetingReward
| Field | Type | Nullable | Description |
| ----------------------- | ------ | -------- | ------------------------- |
| rewardDifficulty | String | No | Difficulty of the reward |
| incentRewardDescription | String | Yes | Description of the reward |
### CampaignCreative
| Field | Type | Nullable | Description |
| ------------- | --------------------------------------- | -------- | ------------------------------- |
| creativeUrl | String | Yes | Cloud drive URL of the creative |
| creativePacks | [CampaignCreativePack[]](#creativepack) | Yes | Creative packs of the campaign |
### CreativePack
| Field | Type | Nullable | Description |
| ---------------- | ----------------------- | -------- | ------------------------- |
| creativePackName | String | No | Name of the creative pack |
| languageName | String | Yes | Name of the language |
| languageCode | String | Yes | Code of the language |
| creatives | [Creative[]](#creative) | No | Creatives of the pack |
### Creative
| Field | Type | Nullable | Description |
| ------------ | ----------------------------- | -------- | -------------------------------------------------------- |
| creativeName | String | No | Creative name |
| callToAction | String | Yes | The text of the ad button for the Call to Action (CTA) |
| text | String | Yes | Creative text |
| byteSize | String | Yes | The size of the creative file in bytes |
| fileUrl | String | Yes | Creative file URL |
| duration | String | Yes | The duration of the ad (mainly used for video creatives) |
| creativeType | [CreativeType](#creativetype) | No | The type of the creative |
### CreativeType
| Field | Type | Nullable | Description |
| -------------------- | ------ | -------- | ------------------------------------------------ |
| name | String | No | The creative type name |
| type | String | Yes | The creative file type. Enum: `images`, `videos` |
| width | String | Yes | The width of the creative |
| height | String | Yes | The height of the creative |
| creativeCategoryType | String | No | The category type of the creative |
### PayoutEvent
| Field | Type | Nullable | Description |
| ------------------------ | ------- | -------- | --------------------------------------------------------------------------------------------------- |
| id | Int | No | ID |
| conversionStatus | String | Yes | Conversion status. Enum: `approved`, `rejected`, `pending` |
| identifier | String | No | The identifier of event |
| eventName | String | Yes | The name of the event |
| eventDescription | String | Yes | The description of the event |
| eventCategory | String | Yes | The category of the event |
| payoutAmount | Decimal | No | The payout amount of event |
| payoutAmountConverted | Decimal | No | The converted payout amount. Calc: `payoutAmount` \* `adUnitCurrencyConversion` of CampaignCurrency |
| payoutTypeId | Int | No | The payout type ID of event |
| payoutType | String | Yes | The payout type of event |
| allowDuplicateEvents | Boolean | Yes | If `true` the duplicate event will count |
| maxTime | String | Yes | The maximum time amount of the event to be count |
| maxTimeMetric | String | Yes | The maximum time metric. Enum: `seconds`, `minutes`, `hours`, or `days` |
| maxTimeRemainSeconds | String | No | The remaining time of the event to be count in seconds |
| enforceMaxTimeCompletion | Boolean | No | If `true` the event need to follow the `maxTime` and `maxTimeMetric` to be count |
### MicroCharge
| Field | Type | Nullable | Description |
| ---------------- | ---- | -------- | -------------------------------------------------------------------------- |
| earned | Decimal | No | Total payout of user's earn from microcharge events |
| earnedConversion | Decimal | No | Total converted payout of user's earn from microcharge events |
| total | Decimal | No | Complete total payout that user can earn from microcharge events |
| totalConversion | Decimal | No | Complete total converted payout that user can earn from microcharge events |
### MicroChargeEvent
| Field | Type | Nullable | Description |
| ------------------------ | ------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
| id | Int | No | ID |
| conversionStatus | String | Yes | Conversion status. Enum: `approved`, `rejected`, `pending` |
| identifier | String | No | The identifier of event |
| eventName | String | Yes | The name of the event |
| eventDescription | String | Yes | The description of the event |
| eventCategory | String | Yes | The category of the event |
| payoutAmount | Decimal | No | The payout amount of event |
| payoutAmountConverted | Decimal | No | The converted payout amount. Calc: `payoutAmount` \* `adUnitCurrencyConversion` of CampaignCurrency |
| payoutTypeId | Int | No | The payout type ID of event |
| payoutType | String | Yes | The payout type of event |
| allowDuplicateEvents | Boolean | Yes | If `true` the duplicate event will count |
| maxTime | String | Yes | The maximum time amount of the event to be count |
| maxTimeMetric | String | Yes | The maximum time metric. Enum: `seconds`, `minutes`, `hours`, or `days` |
| maxTimeRemainSeconds | String | No | The remaining time of the event to be count in seconds |
| enforceMaxTimeCompletion | Boolean | No | If `true` the event need to follow the `maxTime` and `maxTimeMetric` to be count |
| dailyCount | Int | No | The completed mirocharge event count of the user in a day |
| dailyLimit | Int | Yes | The maximum completed microcharge event count of the user in a day. If the value is `null`, the event is unlimited |
| count | Int | No | The completed mirocharge event count of the user (all time) |
| limit | Int | Yes | The maximum completed microcharge event count of the user (all time). If the value is `null`, the event unlimited |
### PlaytimeEvent
| Field | Type | Nullable | Description |
| --------------------- | ------- | -------- | --------------------------------------------------------------------------------------------------- |
| id | Int | No | Playtime milestone ID |
| conversionStatus | String | Yes | Conversion status. Enum: `approved`, `rejected`, `pending` |
| payoutAmount | Decimal | No | The payout amount of event |
| payoutAmountConverted | Decimal | No | The converted payout amount. Calc: `payoutAmount` \* `adUnitCurrencyConversion` of CampaignCurrency |
| timePlayedSeconds | Int | No | The time played in seconds to complete to playtime event |
### SupportTicketCategories
| Field | Type | Nullable | Description |
| ------ | ------------------------------------------- | -------- | ---------------------------------- |
| name | String | No | The name of the category |
| events | [SupportTicketEvent[]](#supportticketevent) | No | The list of events of the category |
### SupportTicketEvent
| Field | Type | Nullable | Description |
| --------------------- | ------- | -------- | ------------------------------------------------------------------------- |
| id | Int | No | ID |
| identifier | String | Yes | The identifier of event |
| eventName | String | Yes | The name of the event |
| eventDescription | String | Yes | The description of the event |
| currencyName | String | No | The name of the currency |
| currencyIcon | String | No | The icon of the currency |
| currencyConversion | Decimal | No | The conversion rate of the currency |
| payoutTypeId | Int | No | The payout type ID of event |
| payoutType | String | No | The payout type name of event |
| payoutAmount | Decimal | No | The payout amount of event |
| payoutAmountConverted | Decimal | No | The converted payout amount. Calc: `payoutAmount` \* `currencyConversion` |
| isTicketSubmitted | Boolean | No | The status of the ticket. If `true` the ticket is submitted |