Skip to content
Get Help

Conversion Value Mapping Partner API

Last updated

Overview ​

If you have opted-in to use SKAdNetwork with Branch, the Branch SDK will call the two necessary Apple methods for SKAdNetwork to enable postbacks to ad partners on your behalf. Conversion values are mapped with your highest value conversion events sent to Branch via the SDK. These mappings are accessed by ad networks for reporting through Branch's SKAdNetwork Partner API.

For this, we will utilize a JSON Web Token (JWT), an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object.

Before you begin ​

In order to start using Branch's SKAdNetwork Partner API, you need the following:

  1. IT/Developer resources for generating access tokens and making API calls.

  2. Enabled SKAdNetwork via Branch SDK.

  3. Ad Partner that is fetching the conversion value mappings using Partner API is enabled for your Branch account.

    1. Contact Branch Support.

Share client credentials with ad partner ​

1. Generate and share your public key ​

Create a public key that Branch will use to share the encrypted API credentials for the Ad Partner.

  1. Generate a public key using GPG:

    bash
    gpg --gen-key
  2. Export the public key:

    bash
    gpg --armor --output file-enc-pubkey.txt --export '{{key_uid}}'
  3. Send the file-enc-pubkey.txt and key_uid to Branch Support.

2. Decrypt Credentials ​

After providing the Public Key to Branch support, they will create and encrypt an API Credentials file that will be sent to you. Once you have the credentials, decrypt it using gpg:

bash
gpg --output api-creds.txt --decrypt api-creds.txt.gpg

3. Generate JWT Access Token ​

Using the client_id and client_secret from your decrypted credentials file, request an access token from Branch's auth server. Tokens are valid for 24 hours (expires_in: 86400), so request a new one before the current one expires.

curl
curl --request POST \
  --url https://branch-prod.us.auth0.com/oauth/token \
  --header 'content-type: application/json' \
  --data '{
    "client_id": "<YOUR_CLIENT_ID>",
    "client_secret": "<YOUR_CLIENT_SECRET>",
    "audience": "https://auth.branch.io/services/partners-api",
    "grant_type": "client_credentials"
  }'

Example response:

json
{
  "access_token": "<ACCESS_TOKEN>",
  "expires_in": 86400,
  "token_type": "Bearer"
}

4. Call the Branch Conversion Value Mapping Partner API ​

Now you can call the Branch Conversion Value Mappings API with the provided access token:

curl
curl -X GET \
  'https://api2.branch.io/v3/partners/<partner_3P>/conversion-value-mappings?app_id=<iTunesId>' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}'

Please note that the /v3/partners/ endpoint will work for SKAN 4.0 as well as SKAN 3.0 and below.