RTB API

Using merchenta.io for real-time bidding

Video (VAST/VPAID) campaign 

Our RTB API supports video campaigns with VAST or VPAID media ads.

This example combines VAST ad with a site whitelist targeting strategy for illustrative purposes.

Generate authentication token 

/v3/oauth/accessToken?username={username}&password={password}&advertiser={advertiser}
  • Parameters
  • username
    string (required) Example: username

    username

    password
    string (required) Example: password

    password

    advertiser
    string (required) Example: MERCHENTA

    advertiser code

  • Curl
  • Copy
    curl -i \ -X GET \ https://sandbox.rtbapi.io/v3/oauth/accessToken?username=username&password=password&advertiser=MERCHENTA
  • Response  200
  • Headers
    Content-Type: application/json
    Example body
    {
            "status": "success",
            "data": {
                "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZHYiOiJNRVJDSEVOVEEiLCJleHAiOiIyMDE0LTEwLTA3VDEwOjIwOjEyLjQ4OSIsInJsbSI6IkFETUlOIiwidXNyIjoidGVzdEBtZXJjaGVudGEuY29tIiwiaWF0IjoiMjAxNC0xMC0wN1QwOToyMDoxMi40NTAifQ.7fb8007c49abb7e083f4aca024512ef3c9d32ea1ab0502d2603f4c2c92545b80"
            }
        }

Upload mp4 video file 

/v3/creatives/upload/push
  • Curl
  • Copy
    curl -i \ -X POST \ -H 'Authorization: Bearer {YOUR_TOKEN_HERE}' \ -F creative=@[YOUR_FILENAME_HERE] \ https://sandbox.rtbapi.io/v3/creatives/upload/push
  • Request
  • Headers
    Authorization: Bearer {YOUR_TOKEN_HERE}
    Content-Type: multipart/form-data
    Content-Disposition: form-data; name="creative"; filename="[YOUR_FILENAME_HERE]"
  • Response  200
  • Headers
    Content-Type: application/json
    Example body
    {
            "status": "success",
            "data": {
                "id": "6499fb837359a81904d4e350f678991b1bfdd343.mp4",
                "location": "https://cdn3.merchenta.com/static/assets/6499fb837359a81904d4e350f678991b1bfdd343.mp4"
            }
        }

Upload webm video file 

/v3/creatives/upload/push
  • Curl
  • Copy
    curl -i \ -X POST \ -H 'Authorization: Bearer {YOUR_TOKEN_HERE}' \ -F creative=@[YOUR_FILENAME_HERE] \ https://sandbox.rtbapi.io/v3/creatives/upload/push
  • Request
  • Headers
    Authorization: Bearer {YOUR_TOKEN_HERE}
    Content-Type: multipart/form-data
    Content-Disposition: form-data; name="creative"; filename="[YOUR_FILENAME_HERE]"
  • Response  200
  • Headers
    Content-Type: application/json
    Example body
    {
            "status": "success",
            "data": {
                "id": "95a6269596382f7e4c5b9ba3e2876fdf3599473f.webm",
                "location": "https://cdn3.merchenta.com/static/assets/95a6269596382f7e4c5b9ba3e2876fdf3599473f.webm"
            }
        }

Create VAST campaign 

/v3/campaigns/{ADVERTISER_CODE}-vast

Creating a video campaign with VAST:

  • transparent inventory
  • daily budget $100
  • all placement location - ATF/BTF/UNKNOWN
  • site whitelist targeting on youtube
      - youtube.com
    
  • all the exchanges are forbidden except google

Notes:

  • both creativeId and webmCreativeId are mandatory
  • for video campaigns (VAST or VPAID) pls set also videoDuration and videoBitrate

VPAID ad campaign can be created the same as VAST campaign with these changes:

  • type of creative is set to VAST
  • include in creative also vpaidJsLocation and vpaidJsParameters parameters
  • Curl
  • Copy
    curl -i \ -X PUT \ -H 'Authorization: Bearer {YOUR_TOKEN_HERE}' \ -H 'Content-Type: application/json' \ -d '{ "creatives":[ { "code":"{ADVERTISER_CODE}-html-script-1", "creativeId":"6499fb837359a81904d4e350f678991b1bfdd343.mp4", "webmCreativeId": "95a6269596382f7e4c5b9ba3e2876fdf3599473f.webm", "dimensions":{ "width":300, "height":250 }, "videoDuration": "00:00:30", "videoBitrate": 256, "clickthroughUrl":"http://merchenta.com", "type":"VAST" } ], "inventorySettings":{ "inventoryType":"TRANSPARENT", "placementType":[ "ATF", "BTF", "UNKNOWN" ], "publisherWhiteList": [ "youtube.com" ], "exchangeBlockList": ["OX","CT","RB","CL","AN","IM","RX","AD","FB","BS","AM","NX","TS","SM"] }, "biddingSettings":{ "frequencyCap" : 12, "biddingStrategy":{ "strategy":"CPMCappedBiddingStrategy", "maxBid":2 }, "budget":{ "daily":100 }, "pacingType":"ACCELERATED" } }' \ https://sandbox.rtbapi.io/v3/campaigns/{ADVERTISER_CODE}-vast
  • Request
  • Headers
    Authorization: Bearer {YOUR_TOKEN_HERE}
    Content-Type: application/json
    Example body
    {
        "creatives":[
            {
                "code":"{ADVERTISER_CODE}-html-script-1",
                "creativeId":"6499fb837359a81904d4e350f678991b1bfdd343.mp4",
                "webmCreativeId": "95a6269596382f7e4c5b9ba3e2876fdf3599473f.webm",
                "dimensions":{
                    "width":300,
                    "height":250
                },
                "videoDuration": "00:00:30",
                "videoBitrate": 256,
                "clickthroughUrl":"http://merchenta.com",
                "type":"VAST"
            }
        ],
        "inventorySettings":{
            "inventoryType":"TRANSPARENT",
            "placementType":[
                "ATF",
                "BTF",
                "UNKNOWN"
            ],
            "publisherWhiteList": [
                "youtube.com"
            ],
            "exchangeBlockList": ["OX","CT","RB","CL","AN","IM","RX","AD","FB","BS","AM","NX","TS","SM"]
        },
        "biddingSettings":{
            "frequencyCap" : 12,
            "biddingStrategy":{
                "strategy":"CPMCappedBiddingStrategy",
                "maxBid":2
            },
            "budget":{
                "daily":100
            },
            "pacingType":"ACCELERATED"
        }
    }
  • Response  200
  • Headers
    Content-Type: application/json
    Example body
    {
            "status": "success"
        }
Next page  Previous page