# API Setup Guide

## API Endpoint

This endpoint allows you to access reporting parameters. Passing the [request parameters](#api-request-parameters) will return a response with the requested data.

<https://reports.hyprmx.com/mediation_reporting/v2?end_date=DESIRED_END_DATE&start_date=DESIRED_START_DATE&api_key=YOUR_API_KEY&app_id=YOUR_APP_ID>

## API Request Parameters

| Param Name  | Required | Description                                                                                                                                           |
| ----------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| start\_date | Yes      | The first date of your reporting request                                                                                                              |
| end\_date   | Yes      | The last date of your reporting request                                                                                                               |
| api\_key    | Yes      | API key provided by HyprMX                                                                                                                            |
| app\_id     | No       | Distributor ID provided by HyprMX                                                                                                                     |
| group\_by   | No       | Fields to group results by. We currently support country and placement. If specifying both, separate with a comma, i.e. *group\_by=country,placement* |

## API Response Fields

| Field Name      | Field Type        | Description                                                                                                         |
| --------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------- |
| app\_id         | String            | Numeric identifier for your app                                                                                     |
| app\_name       | String            | Name of your app                                                                                                    |
| app\_platform   | String            | Platform for your app (e.g. “iOS”, “Android”)                                                                       |
| completions     | String            | Total number of completions                                                                                         |
| country         | String (optional) | Lower case ISO Alpha-2 country code (e.g. “us”). Only included if group\_by=country is present in request.          |
| date            | String            | The date in the format YYYY-MM-DD                                                                                   |
| impressions     | String            | Total number of impressions                                                                                         |
| placement\_name | String (optional) | Name of your placement. Only included if group\_by=placement is present in request.                                 |
| placement\_type | String (optional) | Type of placement (“rewarded” or “interstitial”). Only included if group\_by=placement param is present in request. |
| revenue ($)     | String            | Total revenue earned                                                                                                |

## Request and Response Example

For example, if you were requesting data for 9/1/2021 through 9/2/2021 for a publisher with an API key of FFFAAAZZZZ, you would make the following request:

<https://reports.hyprmx.com/mediation_reporting/v2?end_date=2021-09-02&start_date=2021-09-01&api_key=FFFAAAZZZZ&app_id=1&group_by=country,placement>

HyprMX will respond with a JSON response with revenue data by date, distributor, and country.

```
{
        "currency": "usd",
        "results": [
        {
            "date": "2021-09-01",
            "app_id": "1",
            “app_name”: “my app”,
            “app_platform”: “iOS”,
            “placement_name”: “my placement”,
            “placement_type”: “rewarded”,
            "revenue": "0.11",
            "impressions": "16",
            "completions": "12",
            "country": "us"
        },
        {
            "date": "2021-09-02",
            "app_id": "1",
            “app_name”: “my app”,
            “app_platform”: “iOS”,
            “placement_name”: “my placement”,
            “placement_type”: “rewarded”,
            "revenue": "0.01",
            "impressions": "3",
            "completions": "1",
            "country": "us"
        }
}

```
