iAd Publisher API Guide

Overview

If you are an iOS app publisher who uses iAd to generate advertising revenue, you can use the iAd Publisher API to efficently track the performance and revenue generated from the advertising in your apps. The iAd Publisher API provides programmatic access to your iAd account data, allowing you to pull reporting data from iAd for integration into your own systems for analysis. The API also allows you to report on revenue by device class and revenue by ad format, which are not available through the web portal.

The iAd Publisher API is available to all iAd publishers with admin access who have enabled iAd integration in their apps.

The iAd Publisher API uses the same authentication system as the iAd Workbench API. To request and download the API keys, tokens, and certificates required to access iAd, you will need an iAd Workbench account. If you do not not already have an iAd Workbench account:

  1. Go to iadworkbench.apple.com and log in with your Apple ID.

  2. Provide your contact information and create your Workbench account.

To request and download the API keys, tokens, and certificates required to access the iAd server:

  1. Log in to iAd Workbench.

  2. Click on the dropdown arrow next to your account name near the top right.

  3. Choose API from the popup menu.

  4. Enter the displayed security code.

  5. Press the Download New Keys button.

  6. Save the Zip file in an approprate location.

Implement your utilization of the iAd Publisher API by following the details proved in “API Concepts” and following sections of this document and use this end point URL:

This document describes the v1 URL of iAd Publisher. For more details, see “Versioning of the API” below.

API Basics

Authentication and Authorization

Versioning of the API

iAd Publisher API v1 is read-only. It allows you to generate reports on the performance and revenue generated by your iAd-enabled apps. The API version is specified in the URL, e.g., https://iadapi.apple.com/publisher/v1 is the URL for the v1 version.

If new features are added to the iAd Publisher API, as long as they are backward compatible, the URL will remain the same. If new features are ever added that are not backward compatible, a new URL will be introduced that supports those features.

Invoking the API

API Concepts

Session Management

The InitSession method returns a Session ID to use with other API method calls.

Obtaining Report Metrics

The GetAppMetrics method provides iAd performance metrics for your iOS apps.

Session Management

InitSession

The InitSession method authenticates your account, establishes a secure connection, and provides the session ID required to make other API calls. Call InitSession before doing anything else with the API.

The InitSession method requires your access token and returns a SessionID string. Use this SessionID string to authenticate all other API operations. A SessionID expires after one hour of inactivity.

Input

Parameter

Type

Required/Optional

Comments

accessToken

String

Required

accessToken is one of the keys given to a user along with client side certificate to initiate session.

Listing 1-1  InitSession Sample Input

{
   "method":"InitSession",
   "id": "RequestNo-001",
   "params":{
      "accessToken":"1234567890"
   },
   "jsonrpc":"2.0"
}

Output

Parameter

Type

Comments

SessionId

String

SessionId to be used for all other API operations.

Listing 1-2  InitSession Sample Output

{ "id": "RequestNo-001",
  "result": {
    "SessionId": "44e5b59211ae0da9c9739b0866936ca94301d444"
  },
  "jsonrpc": "2.0"
}

Obtaining Report Metrics

GetAppMetrics

Input

Parameter

Type

Required/Optional

Comments

SessionId

String (alphanumeric)

Required

SessionId obtained from InitSession call.

AppIds

List of Strings (numeric)

Required

Each AppId number is an iTunes Adam ID, the numerical portion of the URL of the app’s iTunes page.

You may not request information on apps that do not correspond to the accessToken you provided to InitSession.

StartTime

Date string

Required

The starting date of the period you want data for, in YYYY-MM-DD format, based on UTC time. The earliest date supported is 2015-03-05, March 5, 2015.

EndTime

Date string

Required

The ending date of the period you want data for, in YYYY-MM-DD format. A maximum of 7 days is allowed in a single request.

Listing 1-3  GetAppMetrics Sample Input

{
  "method": "GetAppMetrics",
  "id": "1001",
  "params": {
    "SessionId": "3ee7bb3fe686cae2415b99b63399bd20b4269bd0",
    "AppIds": [
      "456789123",
      "345678912"
    ],
    "StartTime": "2015-04-05"
    "EndTime": "2015-04-05",
  },
  "jsonrpc": "2.0"
}

Output

Parameter

Type

Comments

Metrics

Collection

Products element.

Metrics.AppId

String (numeric)

The ID of the app for which you requested information.

Metrics.AppName

String

The registered name of the app for which you requested information.

Metrics.Country

String

The country for which information is reported.

Metrics.CreativeType

String

The ad type for which information is reported. If your app supports more than one type of ad, you will get separate Metrics results for each type.

Metrics.DeviceClass

String

The device class for which information is reported. If your app supports more than one class of device, you will get separate Metrics results for each class.

Metrics.Date

Date and time string

The date for which information is reported, based on UTC time.

If you requested information about more than one day, you will get separate Metrics results for each day in the range requested.

Metrics.Taps

String (numeric)

Number of times a user tapped on an ad in your app.

Metrics.eCPM

String (numeric)

Effective cost per thousand impressions. This is the total revenue you have earned for every thousand times an ad is shown in your app.

Metrics.Impressions

String (numeric)

Total number of times users were shown ads in your app.

Metrics.TTR

String (numeric)

Tap-through rate, the ratio of taps to impressions (e.g., if 100 users are exposed to an ad banner, and the banner is tapped five times, the TTR is 5% or 0.05.).

Metrics.Revenue

String (numeric)

Ad revenue generated by this app.

Metrics.GlobalRequests

String (numeric)

The number of ad requests iAd has received from your app globally.

Metrics.iAdCountryRequests

String (numeric)

The number of ad requests iAd has received from your app in countries where iAd is supported.

Metrics.iAdFillRate

String (numeric)

Percentage of successful impressions served compared to ads requested, returned as a value between 0.00 and 100.00.

Success

Boolean

true or false depending on whether the call succeeded or not.

Listing 1-4  GetAppMetrics Sample Output

{
  "id": "1001",
  "result": {
    "Metrics": [
      {
        "AppId": "900000002",
        "AppName": "AnonApp",
        "Country": "US",
        "CreativeType": "Banner",
        "DeviceClass": "iPhone",
        "Date": "2015-03-05 00:00:00.0",
        "Taps": "0",
        "eCPM": "0.00",
        "Impressions": "0",
        "TTR": "0.00",
        "Revenue": "0.00",
        "GlobalRequests": "99999",
        "iAdCountryRequests": "99999",
        "iAdFillRate": "0.00"
      },
      {
        "AppId": "900000002",
        "AppName": "AnonApp",
        "Country": "US",
        "CreativeType": "Banner",
        "DeviceClass": "iPad",
        "Date": "2015-03-05 00:00:00.0",
        "Taps": "0",
        "eCPM": "0.00",
        "Impressions": "0",
        "TTR": "0.00",
        "Revenue": "0.00",
        "GlobalRequests": "88888",
        "iAdCountryRequests": "88888",
        "iAdFillRate": "0.00"
      },
      {
        "AppId": "900000001",
        "AppName": "LightRight",
        "Country": "US",
        "CreativeType": "Banner",
        "DeviceClass": "iPad",
        "Date": "2015-03-05 00:00:00.0",
        "Taps": "0",
        "eCPM": "0.00",
        "Impressions": "0",
        "TTR": "0.00",
        "Revenue": "0.00",
        "GlobalRequests": "77777",
        "iAdCountryRequests": "77777",
        "iAdFillRate": "0.00"
      }
    ],
    "Success": true
  },
  "jsonrpc": "2.0"
}