The CAS.AI API is built on HTTP and JSON, so any standard HTTP client can send requests to it and parse the responses.
Every request your application sends to the CAS.AI API must include an authorization token.
https://b2b.cas.ai/api/login{ "email": "examapl@host.com", "password": "account password" }{ "access_token": "Authorization token" }Use token for Authorization every API request using the Bearer scheme. For example in request header:
Authorization: Bearer <access_token>Token lifetime: 15 minutes.
https://b2b.cas.ai/api/mediation/dataRequest object structure:
| Field | Type | Description |
|---|---|---|
| filter | array of objects | Mandatory filter options for report. See table of filter below. |
| columns | array of objects | List of columns for report. See table of columns below. |
| calcTotal | boolean | Append total row for report. (true or false) |
| currency | string | Currency of revenue, euro or usd supported only. |
The filter options have the following structure:
"filter": [
{ "type": "app", "value": 1 },
{ "type": "app", "value": 2 }
]| Filter type | Description | Value Example |
|---|---|---|
date | (Required) The first and last days you want in the report, in «YYYY»-«MM»-«DD» format. | "value": { "beginDate": "YYYY-MM-DD", "endDate": "YYYY-MM-DD" } |
app | Report for selected application(s) id. Use id from Applications Ids list response. | "value": 1 |
country | Report for selected country(s) id. Use id from Countries Ids list response. | "value": 4 |
format | Report for selected format(s) id. See table of ad format ids below. | "value": 2 |
ad_source | Report for selected ad source(s) id. Use id from Ad Sources Ids list response. | "value": 3 |
You must add date filter for each report request.
The filter options have the following structure:
"columns": [
{ "id": "app" },
{ "type": "date" }
]| Column id | Description |
|---|---|
ad_source | Ad source id column. Use id from Ad Sources Ids list response. |
app | Application id column. Use id from Applications Ids list response. |
date or week or month | Date, Week or Month column |
country | Country id column. Use id from Countries Ids list response. |
format | Ad Format id column. See table of ad format ids below. |
platform | Application name platform column |
impressions | Number of impressions shown |
observed_ecpm | Observed ECPM column |
est_earnings | Estimated earnings column |
dau | DAU column. Available only if ad_source and format columns not requested. |
arpu | ARPU column. Available only if ad_source and format columns not requested. |
| Id | Name |
|---|---|
| 1 | Banner Ad |
| 2 | Interstitial Ad |
| 3 | Rewarded Ad |
| 4 | Native Ad |
| 5 | AppOpen Ad |
| 6 | In Game Ad |
https://b2b.cas.ai/api/mediation/adsourcesNO Parameters
[
{
"Id ": 2,
"AdSource_Name": "AdMob"
},
{
"Id ": 3,
"AdSource_Name": "Mintegral"
}
]Array of objects with structure
| Field | Type | Description |
|---|---|---|
| Id | integer | Ad source database id |
| AdSource_Name | string | Name of the Ad Source |
https://b2b.cas.ai/api/mediation/countryNO Parameters
[
{
"Id": 4,
"Country_Name": "Azerbaijan"
},
{
"Id": 5,
"Country_Name": "Bangladesh"
},
{
"Id": 6,
"Country_Name": "Belgium"
}
]Array of objects with structure
| Field | Type | Description |
|---|---|---|
| Id | integer | Country database id |
| Country_Name | string | Name of the Country |
https://b2b.cas.ai/api/mediation/appsNO Parameters
[
{
"App_ID": 998,
"Bundle_ID": "com.psv.ladybug.color_by_number",
"Name": "Miraculous Ladybug: Coloring",
"Status": "active"
},
{
"App_ID": 999,
"Bundle_ID": "com.hyppo.goodnight",
"Name": "Good Night Hippo",
"Status": "active"
}
]Array of objects with structure
| Field | Type | Description |
|---|---|---|
| App_ID | integer | Database id |
| Bundle_ID | string | Android bundle name or iTunes Id |
| Name | string | Name of the application. |
| Status | string | Status: active or test or inactive |
{
"filter": [
{
"type": "date",
"value": {
"beginDate": "2021-12-09",
"endDate": "2021-12-15"
}
},
{ "type": "app", "value": 1 },
{ "type": "country", "value": 4 }
],
"columns": [
{ "id": "ad_source" },
{ "id": "week" },
{ "id": "format" },
{ "id": "impressions" },
{ "id": "observed_ecpm" },
{ "id": "est_earnings" }
],
"calcTotal": true
}{
"list": [
{
"impressions": "219",
"observed_ecpm": 0.5342465693547845,
"est_earnings": 0.11699999868869781,
"week": "2021-0",
"ad_source": 2,
"format": 2
},
{
"impressions": "141",
"observed_ecpm": 0.19148935345893212,
"est_earnings": 0.026999998837709427,
"week": "2021-0",
"ad_source": 2,
"format": 3
}
],
"totals": {
"impressions": "6820",
"observed_ecpm": 0.31428592090250496,
"est_earnings": 2.1434299805550836
}
}