CAS.AI Reporting API

This guide is for developers who want to use the CAS.AI API to programmatically get information about their CAS.AI account.

The CAS.AI API is built on HTTP and JSON, so any standard HTTP client can send requests to it and parse the responses.

Authorization

Every request your application sends to the CAS.AI API must include an authorization token.

https://b2b.cas.ai/api/login

POST Request: multipart/form-data

{ "email": "examapl@host.com", "password": "account password" }

Response: JSON

{ "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.

Mediation report

https://b2b.cas.ai/api/mediation/data

POST Request body: application/json

Request object structure:

FieldTypeDescription
filterarray of objectsMandatory filter options for report. See table of filter below.
columnsarray of objectsList of columns for report. See table of columns below.
calcTotalbooleanAppend total row for report. (true or false)
currencystringCurrency of revenue, euro or usd supported only.

Filters

The filter options have the following structure:

"filter": [
    { "type": "app", "value": 1 },
    { "type": "app", "value": 2 }
]
Filter typeDescriptionValue 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" }
appReport for selected application(s) id. Use id from Applications Ids list response."value": 1
countryReport for selected country(s) id. Use id from Countries Ids list response."value": 4
formatReport for selected format(s) id. See table of ad format ids below."value": 2
ad_sourceReport 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.

Columns

The filter options have the following structure:

"columns": [
    { "id": "app" },
    { "type": "date" }
]
Column idDescription
ad_sourceAd source id column. Use id from Ad Sources Ids list response.
appApplication id column. Use id from Applications Ids list response.
date or week or monthDate, Week or Month column
countryCountry id column. Use id from Countries Ids list response.
formatAd Format id column. See table of ad format ids below.
platformApplication name platform column
impressionsNumber of impressions shown
observed_ecpmObserved ECPM column
est_earningsEstimated earnings column
dauDAU column. Available only if ad_source and format columns not requested.
arpuARPU column. Available only if ad_source and format columns not requested.

Ad Format ids

IdName
1Banner Ad
2Interstitial Ad
3Rewarded Ad
4Native Ad
5AppOpen Ad
6In Game Ad

Ad Sources Ids list

https://b2b.cas.ai/api/mediation/adsources

GET Request:

NO Parameters

Response: JSON

[
    {
        "Id ": 2,
        "AdSource_Name": "AdMob"
    },
    {
        "Id ": 3,
        "AdSource_Name": "Mintegral"
    }
]

Array of objects with structure

FieldTypeDescription
IdintegerAd source database id
AdSource_NamestringName of the Ad Source

Countries Ids list

https://b2b.cas.ai/api/mediation/country

GET Request:

NO Parameters

Response: JSON

[
    {
        "Id": 4,
        "Country_Name": "Azerbaijan"
    },
    {
        "Id": 5,
        "Country_Name": "Bangladesh"
    },
    {
        "Id": 6,
        "Country_Name": "Belgium"
    }
]

Array of objects with structure

FieldTypeDescription
IdintegerCountry database id
Country_NamestringName of the Country

Applications Ids list

https://b2b.cas.ai/api/mediation/apps

GET Request:

NO Parameters

Response: JSON

[
    {
        "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

FieldTypeDescription
App_IDintegerDatabase id
Bundle_IDstringAndroid bundle name or iTunes Id
NamestringName of the application.
StatusstringStatus: active or test or inactive

Mediation report POST Request example

{
    "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
}

Mediation report response example

{
    "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
    }
}