Basics

Get Offers URL:

https://matchapi.peanutlabs.com/publisher/api/v1/allOffers

Protocol

HTTP/HTTPS

Method

POST

Content-Type

“application/json; charset=utf-8”

Response type

JSON

Auth

None

The Request Body

pub_id

your App ID (integer)

iv

a cryptographically random initialization vector for the encrypted payload (string)

payload

(string) see section “The Payload” below

The value is a JSON object, serialized to string/bytes, padded to 128 bit blocksize, encrypted with AES CBC mode, and finally base64 encoded. More details on the encryption in section Encrypting the Payload. Since the payload is sent as part of the POST body, it does not need to be URL encoded.

The Payload (Encrypted)

(string) The payload field in the request body is a JSON object, serialized to string/bytes, padded to 128 bit blocksize, encrypted with AES CBC mode, and finally base64 encoded. The JSON object has the following structure (description of fields following the example):

{
    
    "offers": True,
    "cpi": True
  
}

offers

(string) Set the field to True to include Offers.

cpi

(optional, string) only applicable if you want to include CPI for each Offers result. Set the field to True to include CPI. Otherwise, set the field to False or omit this key-value pair entirely.

Successful Response

{
    "offers": [
        {
            "id": "b0da5c041d30828e67edfa7260d383ad",
            "external_project_id": "Simply Cook - UK",
            "offer_filter_tag": {
                "credit_card_required": 1,
                "purchase": 1
            },
            "headline_text": "1st SimplyCook box for £3.",
            "requirement_text": "Purchase the SimplyCook plan to get #vc#.",
            "credit_card_required": true,
            "creative": {
                "120x60": "https://d1dawe8abjllt1.cloudfront.net/offer.images.60x120.2060881.1463595838857493.gif",
                "240x120": "https://d1dawe8abjllt1.cloudfront.net/offer.images.120x240.2060881.1463595844665220.gif"
            },
            "reward": "D",
            "reward_amount": 700,
            "gender": "all",
            "age": "any",
            "country": "GB",
            "cpi": "7",
            "link": "https://www.peanutlabs.com/direct_link/offers/?hash=#hash#&tid=#tid#&uid=#uid#&appid=#appid#&ltid=25637500"
        }]
}

offers

(array of objects) the list of offers matched for the user. Only included if the following is included in payload: “offers”: 1

Offers have the following parameters:

id

(string) the internal ID for each offer.

external_project_id

(string) the external ID for each offer.

offer_filter_tag

(array) the list of categories associated with the offer.

headline_text

(string) The title of the offer

requirements_text

(string) What the user must submit in order to complete the offer.

Free

(boolean) Indicates whether the user needs to pay money to complete the offer.

credit_card_required

(boolean) Indicates whether the user needs a credit card to complete the offer.

creative

(array) A list of creatives that can be used in your UI to market the offer.

reward

(string) The virtual currency for the reward payout.

reward_amount

(integer) The amount to be paid out for completing the offer using your virtual currency.

screenout_reward

(integer) The amount to be paid out for being dismissed from an offer.

gender

(string) Gender the offer is targeting

age

(string) Age range the offer is targeting

country

(string) Country the offer is targeting

cpi

(string) The cost-per-incidence (CPI) for the offer.

link

(string)

Below is the entry URL setup. The variables in between the ## should be replaced with appropriate values before entering a survey.

https://www.peanutlabs.com/direct_link/offers/?hash=#hash#&tid=#tid#&uid=#uid#&appid=#appid#&ltid=32501692
  1. hash => {hash-value}

    The {hash-value} will be a HMAC (Sha256) produced from a message and secret key. The message is {uid} + {lineItemID} + {appid}. The secret key is {TransactionKey}

  2. tid = Publisher’s tracking id (sub_id).

    This sub_id can be located in the supplier portal.

  3. uid = respondent ID

    The respondent ID is found in the Create Respondent API response; this is your user’s id.

  4. appid = application ID in supplier portal.

  5. ltid = Line Item ID.

    Provide the Quota Cell IDs for the Line Items a respondent qualifies for.

After all the parameters are inserted correctly into the Survey Entry URL, you’re ready to send the user into the link. However, you need to configure your redirect links so users can return to the right endpoint after existing the survey. Follow the instructions in Step 6.