# Basic Reporting API

This article relates to the DT Exchange Rest API. This API allows you to receive a breakdown of performance data by Apps, Placements and other dimensions.

## Authentication <a href="#authentication-0-0" id="authentication-0-0"></a>

Set out below are the details of how to obtain the required credentials for authentication for the DT Exchange Rest API.

### Obtaining OAuth Credentials <a href="#obtaining-oauth-credentials-0-1" id="obtaining-oauth-credentials-0-1"></a>

To secure your information, Digital Turbine uses the OAuth 1.0 authentication protocol and two-legged OAuth. Using two-legged OAuth, there is no need for an access token. Instead, just add the consumer key and consumer secret to your OAuth client and execute your request. For more information, click [here](http://oauth.net/core/1.0/).

### Obtaining the Reporting API Keys <a href="#obtaining-the-reporting-api-keys-0-2" id="obtaining-the-reporting-api-keys-0-2"></a>

To obtain the Publisher ID, Consumer Key and Consumer Secret:

1. Click the login details on the top-left of the screen and click **User Profile**.\
   The User Profile window appears.

<div align="left" data-with-frame="true"><img src="/files/oVgB78hmC7TP8IYGqHIs" alt="" width="209"></div>

2. Copy the **Publisher ID**, **Consumer Key**, and **Consumer Secret** as needed.

<div align="left" data-with-frame="true"><img src="/files/wqW3PnX9q60i58PlAf7h" alt=""></div>

### Sample API Request <a href="#sample-api-request-0-3" id="sample-api-request-0-3"></a>

The following parameters must be included in the API Request.

| Parameter            | Description                                                                         |
| -------------------- | ----------------------------------------------------------------------------------- |
| publisherId          | Publisher ID from the Console                                                       |
| startDateEpoch       | Start date of the report in [epoch](https://www.unixtimestamp.com/index.php) format |
| endDateEpoch         | End date of the report in [epoch](https://www.unixtimestamp.com/index.php) format   |
| oauth\_consumer\_key | Consumer Key from the Console                                                       |
| oauth\_signature     | Computed OAuth 1.0 OAuth signature                                                  |

### Endpoint <a href="#enpoint-0-4" id="enpoint-0-4"></a>

```
https://revenuedesk.fyber.com/iamp/services/performance/{{publisherId}}/vamp/{{startDateEpoch}}/{{endDateEpoch}}?
```

### Required Headers <a href="#required-headers-0-5" id="required-headers-0-5"></a>

```
Content-type=application/json
Accept=application/json
```

### Response <a href="#response-0-6" id="response-0-6"></a>

The data returned is per Placement.

The response itself is first broken down to Apps and Placements, with the various response parameters.

A publisher can have a certain number of apps and each app with a different number of Placements.

The API Response is structured so that each parameter is placed under its parent. The top level information is the Publisher ID. Under the Publisher ID is App ID followed by the Placement ID for each App.

The 'Units' object contains all the requested parameters for each placement such as Country, Content Name, Clicks and CTR etc.

| Parameter          | Type            | Default | Description                                                 |
| ------------------ | --------------- | ------- | ----------------------------------------------------------- |
| spotId             | Number          | Null    | The ID of the Placement                                     |
| date               | Unix timestamp  | Null    | Representing a day in the date range                        |
| country            | 2-letter string | Null    | 2 letter country code                                       |
| publisherId        | Number          | Null    | Your DT Publisher ID                                        |
| applicationName    | String          | Null    | Human-readable app name as entered in the Create App form   |
| \[LEGACY]contentId | Number          | Null    | Numeric ID of the Ad Unit (aka Ad Unit ID)                  |
| contentName        | String          | Null    | The AppID from the Console                                  |
| distributorName    | String          | Null    | Platform like “iOS” or “Android”                            |
| contentCategories  | List            | Null    | List of category Name & ID                                  |
| adRequests         | Number          | Null    | Number of ad requests                                       |
| impressions        | Number          | Null    | Number of impressions                                       |
| fillRate           | Number          | Null    | The fill rate calculated by Impressions/AdRequests \* 100   |
| clicks             | Number          | Null    | Number of clicks                                            |
| ctr                | Number          | Null    | Click through rate – calculated by click/impressions \* 100 |
| ecpm               | Number          | Null    | Effective CPM Calculated by Revenue/Impressions \* 1000     |
| revenue            | Number          | Null    | Amount of revenue                                           |

The API returns the requested data, as follows:

{% code title="JSON" overflow="wrap" %}

```json
{
    "publisherId": 1,
    "apps": [
        {
            "appId": "1",
            "spots": [
                {
                    "spotId": "1",
                    "units": [
                        {
                            "date": 1500940800,
                            "country": "US",
                            "contentId": 1,
                            "spotId": "",
                            "contentName": "Content Name",
                            "applicationName": "Application Name",
                            "distributorName": "iPhone",
                            "contentCategories": [],
                            "adRequests": 2611,
                            "impressions": 1,
                            "fillRate": 0.00038299502106472615,
                            "clicks": 0,
                            "ctr": 0,
                            "ecpm": 0.7,
                            "revenue": 0.0007
                        }
                    ]
                },
                {
                    "spotId": "2",
                    "units": [
                        {
                            "date": 1500854400,
                            "country": "RU",
                            "contentId": 2,
                            "spotId": "",
                            "contentName": "Content Name 2",
                            "applicationName": "Application Name 2",
                            "distributorName": "iPhone",
                            "contentCategories": [],
                            "adRequests": 5,
                            "impressions": 0,
                            "fillRate": 0,
                            "clicks": 0,
                            "ctr": 0,
                            "ecpm": 0,
                            "revenue": 0
                        }
                    ]
                }
            ]
        }
    ]
}
```

{% endcode %}

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalturbine.com/dt-exchange/publishers/reporting/reporting-api/basic-reporting-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
