# Reporting API

> import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Reporting API

## Work with statistics through API{#ReportAPI-WorkwithstatisticsthroughAPI}

It is possible to get the same statistics that you see on the Dashboard,
programmatically in JSON format.

We provide the same data and allow you to narrow the output in the same
way as on the Dashboard.

Getting started with our API is easy. Use your API key and User ID in
requests to the Appodeal system.

## Your access credentials{#ReportAPI-Youraccesscredentials}

Please use your API key and your User ID for every request. They are
available under the API Credentials
tab [in your Appodeal profile](https://www.appodeal.com/profile/api_credentials).

## Quick example{#ReportAPI-Quickexample}

Statistics for the week from May 13 to May 19 detailed by date can be
obtained using this request:
```
https://api-services.appodeal.com/api/v2/stats_api?api_key=<API key>&user_id=<User ID>&date_from=2019-05-13&date_to=2019-05-19&detalisation%5B%5D=date
```
## Request parameters{#ReportAPI-Requestparameters}

The API has several parameters that allow you to narrow your requests:

`date_from` - the first date to include statistics for. This parameter
is mandatory and should be in format 'YYYY-mm-dd'.

`date_to` - the last date to include statistics for. This parameter is
mandatory and should be in format 'YYYY-mm-dd'. It cannot be less
than `date_from`.

`app[]` - the application key to get statistics for or `ALL`. If
omitted, the statistics of all of your apps and apps shared with you are
calculated. You may use one per request.

`country[]` - the country ISO 2-characters code or `ALL`. The default
is `ALL` - includes the statistics for all countries. You may use one
per request.

`network[]` - the network you want to get statistics for. Possible
values are (you may use several per request):

-   `ALL` - All networks’ data will be included in the statistics
    output. This is the default value if the parameter is omitted
-   `adcolony` - narrows the resulting statistics to AdColony (Ad
    Network)
-   `admob` - narrows the resulting statistics to Admob (Ad Network)
-   `directoffer` - narrows the resulting statistics to Ad Server
    Campaigns
-   `amazon` - narrows the resulting statistics to Amazon Ads (Ad
    Network)
-   `applovin` - narrows the resulting statistics to Applovin (Ad
    Network)
-   `avocarrot` - narrows the resulting statistics to Avocarrot (Ad
    Exchange)
-   `backfill` - narrows the resulting statistics to Backfill
-   `chartboost` - narrows the resulting statistics to Chartboost (Ad
    Network)
-   `facebook` - narrows the resulting statistics to Facebook (Ad
    Network)
-   `flurry` - narrows the resulting statistics to Flurry (Ad Network)
-   `google_dfp` - narrows the resulting statistics to Google DFP (Ad
    Network)
-   `inmobi` - narrows the resulting statistics to InMobi (Ad Network)
-   `inneractive` - narrows the resulting statistics to Inneractive (Ad
    Exchange)
-   `iron_source` - narrows the resulting statistics to IronSource (Ad
    Network)
-   `mintegral` - narrows the resulting statistics to Mintegral (Ad
    Network)
-   `mopub` - narrows the resulting statistics to MoPub (Ad Exchange)
-   `my_target` - narrows the resulting statistics to MyTarget (Ad
    Network)
-   `ogury` - narrows the resulting statistics to Ogury (Ad Network)
-   `openx` - narrows the resulting statistics to OpenX (Ad Exchange)
-   `pubnative` - narrows the resulting statistics to PubNative (Ad
    Network)
-   `appodeal` - narrows the resulting statistics to Service Messages
-   `smaato` - narrows the resulting statistics to Smaato (Ad Exchange)
-   `smaato_sdk` - narrows the resulting statistics to Smaato SDK (Ad
    Exchange)
-   `startapp` - narrows the resulting statistics to StartApp (Ad
    Network)
-   `tapjoy` - narrows the resulting statistics to Tapjoy (Ad Network)
-   `testads` - narrows the resulting statistics to Test Ads
-   `unity` - narrows the resulting statistics to Unity Ads (Ad Network)
-   `vungle` - narrows the resulting statistics to Vungle (Ad Network)
-   `yandex` - narrows the resulting statistics to Yandex (Ad Network)
-   `AllInOneMedia` - narrows the resulting statistics to All in One
    Media (Ad Network)
-   `rocket10` - narrows the resulting statistics to Rocket 10 (Ad
    Network)
-   `tremor` - narrows the resulting statistics to Tremor (Ad Network)
-   `vdopia` - narrows the resulting statistics to Vdopia (Ad Network)
-   `vhub` - narrows the resulting statistics to Vihub (Ad Network)
-   `exchange_sdk_adtelligent` - narrows the resulting statistics to
    Adtelligent (DSP)
-   `exchange_sdk_altamob` - narrows the resulting statistics to Altamob
    (DSP)
-   `exchange_sdk_amadoad` - narrows the resulting statistics to Amadoad
    (DSP)
-   `exchange_sdk_app_growth` - narrows the resulting statistics to
    AppGrowth (DSP)
-   `exchange_sdk_applift` - narrows the resulting statistics to Applift
    (DSP)
-   `exchange_sdk_appnext` - narrows the resulting statistics to Appnext
    (DSP)
-   `exchange_sdk_appreciate` - narrows the resulting statistics to
    Appreciate (DSP)
-   `exchange_sdk_avazu` - narrows the resulting statistics to Avazu
    (DSP)
-   `exchange_sdk_axonix` - narrows the resulting statistics to Axonix
    (DSP)
-   `exchange_sdk_beeline_programmatic` - narrows the resulting
    statistics to Beeline Programmatic (DSP)
-   `exchange_sdk_bidease` - narrows the resulting statistics to BIDEASE
    (DSP)
-   `exchange_sdk_bucksense` - narrows the resulting statistics to
    Bucksense (DSP)
-   `exchange_sdk_criteo` - narrows the resulting statistics to Criteo
    (DSP)
-   `exchange_sdk_edge226` - narrows the resulting statistics to Edge226
    (DSP)
-   `exchange_sdk_engage_first_impression` - narrows the resulting
    statistics to Engage (DSP)
-   `exchange_sdk_epom` - narrows the resulting statistics to Epom (DSP)
-   `exchange_sdk_fractional_media` - narrows the resulting statistics
    to Fractional Media (DSP)
-   `exchange_sdk_getintent` - narrows the resulting statistics to
    Getintent (DSP)
-   `exchange_sdk_getloyal_dsp` - narrows the resulting statistics to
    Getloyal DSP (DSP)
-   `exchange_sdk_hybrid_dsp` - narrows the resulting statistics to
    Hybrid DSP (DSP)
-   `exchange_sdk_hyper_adx` - narrows the resulting statistics to
    HyperAdx (DSP)
-   `exchange_sdk_index_exchange` - narrows the resulting statistics to
    Index Exchange (DSP)
-   `exchange_sdk_jampp` - narrows the resulting statistics to Jampp
    (DSP)
-   `exchange_sdk_kayzen` - narrows the resulting statistics to Kayzen
-   `exchange_sdk_lead_bolt` - narrows the resulting statistics to
    LeadBolt (DSP)
-   `exchange_sdk_liftoff` - narrows the resulting statistics to Liftoff
    (DSP)
-   `exchange_sdk_liquid_m` - narrows the resulting statistics to
    LiquidM (DSP)
-   `exchange_sdk_manage_com` - narrows the resulting statistics to
    Manage.com (DSP)
-   `exchange_sdk_mobvista` - narrows the resulting statistics to
    Mintegral (DSP)
-   `exchange_sdk_oxonux_digital_media_pvt_ltd` - narrows the resulting
    statistics to Oxonux Digital Media Pvt Ltd (DSP)
-   `exchange_sdk_persona_ly` - narrows the resulting statistics to
    Persona.ly (DSP)
-   `exchange_sdk_pubnative` - narrows the resulting statistics to
    Pubnative (DSP)
-   `exchange_sdk_rubicon` - narrows the resulting statistics to Rubicon
    (DSP)
-   `exchange_sdk_solo_math` - narrows the resulting statistics to
    SoloMath (DSP)
-   `exchange_sdk_test_agency` - narrows the resulting statistics to
    TestAgency (DSP)
-   **`exchange_sdk_woobi` - narrows the resulting statistics to Woobi
    (DSP)
-   `exchange_sdk_x_ad` - narrows the resulting statistics to xAd (DSP)
-   `exchange_sdk_yeahmobi` - narrows the resulting statistics to
    Yeahmobi (DSP)
-   `exchange_sdk_zorka_mobi_1` - narrows the resulting statistics to
    Zorka Mobi (DSP)

`detalisation[]` - requires the detalisation of the data, available
options include (you may use several in one request):

-   `date` - splits the statistics by date.
-   `app` - splits the statistics by application. You'll have
    application keys in the output.
-   `country` - splits the statistics by country. You'll have country
    code in the output.
-   `network` - splits the statistics by network. You'll have network
    names in the output (the same as for `network` parameter).
-   `banner_type` - splits the statistics by ad type (e.g. interstitial,
    video, baner, native, mrec, rewarded video).
-   `segment` - splits the statistics by segment.
-   `placement` - splits the statistics by placement.
-   `include_shared_apps` - if non-zero value has been passed, the
    output will include the apps shared with you by other users
    (see [this page](https://www.appodeal.com/profile/sharing) for details)
-   `skip_direct` - do not include Ad Server campaigns into the result
    statistics . `1` - to skip direct campaigns, `0` - do not skip this
    statistics.

## More examples{#ReportAPI-Moreexamples}

Statistics for last week filtered by dates and applications:
```
https://api-services.appodeal.com/api/v2/stats_api?api_key=<API key>&user_id=<User ID>&date_from=2019-02-07&date_to=2019-02-14&detalisation[]=date&detalisation[]=app
```
Statistics for yesterday filtered by applications and ad networks:
```
https://api-services.appodeal.com/api/v2/stats_api?api_key=<API key>&user_id=<User ID>&date_from=2019-02-13&date_to=2019-02-13&detalisation[]=app&network[]=appodeal&network[]=admob
```
## Response{#ReportAPI-Response}

As statistical requests can be quite complex, it can take some time to
arrange all the data requested.

Therefore, we are using a delayed delivery approach in this part of our
API. This means that in response to your request, the API will provide
you with task_id parameter you can use to track the readiness of the
information.

To use this task_id, you need to put a get request to the  

```
https://api-services.appodeal.com/api/v2/check_status?api_key=\<API key\>&user_id=\<User ID\>&task_id=\<task_id\>
```

As soon as the information is prepared, you may take it using this
call: 
```
https://api-services.appodeal.com/api/v2/output_result?api_key=<API key>&user_id=<User ID>&task_id=<task_id>
```

Based on your request, the server will respond with .json file
containing requested statistics. It also contains the code "zero" for
success and "non-zero" for error followed by textual message describing
the status. The statistical data is contained in the `data` output
parameter. It is an array of output elements that always contains
`requests`, `fills`, `impressions`, `fillrate`, `clicks`, `ctr`, `revenue`, `ecpm` parameters,
also can
contain `app_key`, `app_name`, `country_code`, `network`, `date` in
accordance with the detalisation requested.

Sometimes the answer may be extensive, in this case you will receive an
error message: "The file is large. Please use the option
\`disposition=attachment\` in the query to download the file."

`{"code":0,"message":"success","url": "< link_for_download >"}`

## Applications manage API{#ReportAPI-ApplicationsmanageAPI}

We have a nice option for our users to allow them to work with
applications (find, create or update) through the API.

The main principles are really the same - you need to use your `api_key`
and `user_id` to authenticate and then pass parameters you need.

The applications API works only through POST requests.

You should send the POST requests to
[https://api-services.appodeal.com/api/v2/apps](https://www.appodeal.com/api/v2/apps). Be
sure to include all required parameters to the request.

## Creating the application{#ReportAPI-Creatingtheapplication}

In order to create new application using the API, pass the following
parameters:

`platform` - 1 for Google, 2 for Amazon, 4 for iOS.

`bundle_id` - the bundle_id (package name) of your application.

`name` - the name of your application. If it is absent, the bundle_id is
used.

`is_game` - 1 if your application is a game, any other value or no value
if not. Default is 0.

`orientation` - one of the 'both', 'landscape', 'portrait'.

`is_for_kids` - 1 - if the application is aimed for kids, 0 (or just
skip) if not.

`coppa` - 1 - if the application is COPPA complaint, 0 (or just skip) if
not.

`filter_mature_content` - 1 - filter ads with mature content, 0 (or just
skip) if not.

:::info **Please note:**

Do not pass `app_key` parameter! If you do, the API will search for
the application, not create it.
:::
## Editing the application{#ReportAPI-Editingtheapplication}

Users are allowed to change application name and application orientation
only. Pass the `app_key` and one or both
of `name` and `orientation` parameters to update them.
