RTB API

Using merchenta.io for real-time bidding

Campaign creative from URL 

This RTB API example shows an alternative method of uploading an ad creative for a campaign. Instead of uploading the ad creative from your local filestore, this example shows how to pull the ad creative from a 3rd party URL. At a API level, the main difference is the use of /upload/pull POST, as shown below.

Please note that all ad creatives (including 3rd party ad tags) are required to be non-rotating and reviewed for creative standards compliance by our creative approvals team prior to launch.

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 creative using pull method 

/v3/creatives/upload/pull
  • Curl
  • Copy
    curl -i \ -X POST \ -H 'Authorization: Bearer {YOUR_TOKEN_HERE}' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'url=http%3A%2F%2Florempixel.com%2F400%2F200%2Fbusiness%2F' \ https://sandbox.rtbapi.io/v3/creatives/upload/pull
  • Request
  • Headers
    Authorization: Bearer {YOUR_TOKEN_HERE}
    Content-Type: application/x-www-form-urlencoded
    Example body
    url=http%3A%2F%2Florempixel.com%2F400%2F200%2Fbusiness%2F
  • Response  200
  • Headers
    Content-Type: application/json
    Example body
    {
            "status": "success",
            "data": {
                "id": "MERCHENTA-b021a5e27751d90f56803375d4329d9a33e72bad.jpg",
                "location": "https://cdn3.merchenta.com/static/assets/MERCHENTA-b021a5e27751d90f56803375d4329d9a33e72bad.jpg"
            }
        }

Create campaign 

/v3/campaigns/{ADVERTISER_CODE}-pull

Display campaign with creative coming from a URL with:

  • transparent inventory
  • daily budget $100
  • all placement types: ATF/BTF/UNKNOWN
  • contextual categories
    • Music (110005)
    • Health & Fitness (117700)
  • Curl
  • Copy
    curl -i \ -X PUT \ -H 'Authorization: Bearer {YOUR_TOKEN_HERE}' \ -H 'Content-Type: application/json' \ -d '{ "creatives":[ { "code":"{ADVERTISER_CODE}-pull-1", "creativeId":"[UPLOADED_CREATIVE_ID]", "dimensions":{ "width":300, "height":250 }, "clickthroughUrl":"http://merchenta.com", "type":"IMAGE" } ], "inventorySettings":{ "inventoryType":"TRANSPARENT", "placementType":[ "ATF", "BTF", "UNKNOWN" ], "exchangeBlockList": ["GD", "BS"] }, "biddingSettings":{ "frequencyCap" : 12, "biddingStrategy":{ "strategy":"CPMCappedBiddingStrategy", "maxBid":2 }, "budget":{ "daily":100 }, "pacingType":"ACCELERATED" }, "targetingSettings" : { "contextualSettings" : { "iabCategories" : [110005, 117700] } } }' \ https://sandbox.rtbapi.io/v3/campaigns/{ADVERTISER_CODE}-pull
  • Request
  • Headers
    Authorization: Bearer {YOUR_TOKEN_HERE}
    Content-Type: application/json
    Example body
    {
        "creatives":[
            {
                "code":"{ADVERTISER_CODE}-pull-1",
                "creativeId":"[UPLOADED_CREATIVE_ID]",
                "dimensions":{
                    "width":300,
                    "height":250
                },
                "clickthroughUrl":"http://merchenta.com",
                "type":"IMAGE"
            }
        ],
        "inventorySettings":{
            "inventoryType":"TRANSPARENT",
            "placementType":[
                "ATF",
                "BTF",
                "UNKNOWN"
            ],
            "exchangeBlockList": ["GD", "BS"]
        },
        "biddingSettings":{
            "frequencyCap" : 12,
            "biddingStrategy":{
                "strategy":"CPMCappedBiddingStrategy",
                "maxBid":2
            },
            "budget":{
                "daily":100
            },
            "pacingType":"ACCELERATED"
        },
        "targetingSettings" : {
            "contextualSettings" : {
                "iabCategories" : [110005, 117700]
            }
        }
    }
  • Response  200
  • Headers
    Content-Type: application/json
    Example body
    {
            "status": "success"
        }
Next page  Previous page