Bid responses

Unity supports JSON formats for bid response data. The MIME type for the standard JSON representation is application/json and specified in an HTTP header field as:

Copy
contentType: application/json

After your application receives the bid request to its dedicated endpoint, it must return a bid response or indicate a no-bid within a maximum of 200 milliseconds. Unity sends Accept-Encoding GZIP compression in the request, and highly recommends compressing the response. For more information, see section 2.4 of the OpenRTB specification.

Important: We strongly recommend that DSP servers, including load balancers, enable HTTP Persistent Connections, also known as Keep-Alive, and prevent automatic IdleConnTimeout for at least 90 seconds. This has a profound impact on overall performance by reducing connection management overhead as well as CPU utilization on both sides of the interface.

Response objects and their attributes are detailed in the following section. The description field denotes required attributes, however, we recommend including all attributes.

response objects

An object class describing the bidder’s response to the bid request.

Attribute Type Example Description
id string "id":"7jrUifdKuw3HDIR9dbqDVJ"

A Unity-generated ID passed with the bid request and returned with the bid response.

Important: This attribute is required in the response.

cur string "cur": "USD"

The currency type, using ISO currency codes. Unity supports U.S. dollars (USD), as well as other currencies such as CNY. Make sure this field matches the currency field defined in the adsource configuration, and exchange_rate is not empty, or else Unity will ignore the bid response.

Important: This attribute is required in the response.

bidid string "bidid": “CHYr9b0ODI8OGLpedtfCpuCH” Bidder-generated response ID to assist with logging and tracking.
nbr int "nbr": 6 Reason for declining to bid. For a complete list of supported values, see table 5.24 in the OpenRTB API guide. Also see the section on No-bid responses.
seatbid object array For more information, see the section on seatbid objects.

Unity Exchange allows multiple seatbid objects in a response, however it currently only uses one seatbid object array. The seatbid object chosen contains a bid.id equal to the impression.id. If multiple seatbid objects meet this criterion, Unity Auction selects one randomly.

Important: This attribute is required in the response.

seatbid objects

An object class containing a bid object array that allows the partner to bid on behalf of multiple accounts.

Attribute Type Example Description
bid object array For more information, see section on bid objects.

One or more bids. When making multiple bids, include your highest offer to maximize chances of winning the auction.

Important: This attribute is required in the response.

seat string "seat": "1234"

ID of the buyer seat, or the advertiser or agency on whose behalf you are making the bid.

Important: This attribute is required in the response.

bid objects

An object class containing information about the buyer’s bid.

Attribute Type Example Description
id string "bidid": "1234567890123456789"

Bidder-generated bid ID to assist with logging and tracking.

Important: This attribute is required in the response.

impid string "impid": "1"

ID of the impression associated with this bid. This value matches the impression ID provided in the bid request.

Important: This attribute is required in the response.

price float "price": 0.78

Bid price in cost per thousand impressions (CPM). Unity Auction ignores values equal to or less than zero, or encrypted values.

Important: This attribute is required in the response.

Note: Unity accepts a maximum of three decimal places, but prefers two.

adid string "adid": "12345678" Bidder-generated ID of a pre-loaded ad to be served if the bid wins.
nurl string “nurl”:"https://bidder.com/win?${AUCTION_PRICE}"

The win notice URL that Unity pings when an ad is rendered to the user. This attribute also serves as the billable impression counter.

Note: Unity fires the nURL at the time of delivery and replaces the bid price macro (${AUCTION_PRICE}) with the actual price that the bid cleared.

Important: This attribute is a unique Unity Exchange requirement when there is no bURL in the response.

burl string "burl": "https://fake-test.com/imp?${AUCTION_PRICE}"

Billing notice URL called by Unity Exchange when a winning bid becomes billable. This is based on exchange-specific business policy. Substitution macros can be included.

Important: This attribute is a unique Unity Exchange requirement when there is no imptrackers attribute in the response.

Note: Unity pings the bURL at the time of delivery and replaces the bid price macro (${AUCTION_PRICE}) with the actual price that the bid cleared.

imptrackers string array ["https://ad.doubleclick.net/ddm/trackimp",
"https://dsp.com/amet?et=show&id=60e47b64b59Q"]
Array of impression trackers (first- and third-party) to be consistently tracked as Unity records the billable impression event. Can be used in place of a bid bURL.

Important: This attribute is a unique Unity Exchange requirement when there is no burl attribute in the response.

iurl string "iurl": "https://secure-datacenter.dsp.com/cr?id=12345678" URL without cache-busting to an image that is representative of the content of the campaign (for ad quality and safety checks).
cid string "cid": "1234" Bidder-generated campaign ID, to assist with ad quality checks. The iURL image should be representative of this collection of content.
crid string "crid": "12345678" Creative ID provided by the partner, to assist with ad quality checks.
dealid string "dealid": "Unity-MM-0034" A unique identifier for the direct deal (if applicable).

Note: This ID must match the deal ID sent in the bid request.

cat string array "cat": ["IAB3-12", "IAB21-2", "IAB10-9" "NEX3-102"]

IAB content categories that apply to the creative. For a complete list of supported values, see table 5.1 in the OpenRTB API guide.

Important: This attribute is required in the response.

adm string For more examples, see the Example bid responses section.

Means of conveying ad markup in case the bid wins.

Important: This attribute is required in the response.

adomain string array

Correct:

  • "adomain": ["yourgame.com"]
  • "adomain": ["studio.yourgame.com"]

Incorrect:

  • "adomain": ["yourgame.com/something"]
  • "adomain": ["www.yourgame.com"]

Advertiser domain for block-list checks. Creatives cannot be rotated, and only one domain is allowed. The format must be the root domain only, with no protocol (note that you can include subdomains if they are not "www"; see example).

Important: This attribute is required in the response.

bundle string

Google example:

  • "bundle": "com.unityexample.game"

Apple example:

  • "1198634425"

A platform-specific application identifier (store ID for the Apple App Store or Google Play) that is unique to the advertised app and independent of the exchange. This feature can also be used for ad quality.

Important: This attribute is a unique Unity Exchange requirement for app advertisements.

attr int array "attr": [1, 13] An array of attributes describing the creative. For a complete list of supported values, see table 5.3 in the OpenRTB API guide.
w int "h": 568

Width of the creative in device-independent pixels (DIPS).

Important: This attribute is required for banner ads, and recommended for all formats.

h int "w": 320

Height of the creative in device independent-pixels (DIPS).

Important: This attribute is required for banner ads, and recommended for all formats.

api int "api":7 The API framework supported for this impression. A value of 7 signifies Open Measurement (OM) support. For more information, see documentation on OM extensions.

bid.ext objects

An object subclass extending the bid object.

Important: You must add the ext attribute as an object to support the SKAdNetwork with iOS14.

Attribute Type Example Description
appid string "appid": "1234567890123" App store ID for the app being advertised, if applicable. For more information on locating the App store ID, see Unity’s dashboard documentation on Store IDs.
appname string "appname": "Example Game" App name of the app being advertised, if applicable.
storeurl string "storeurl": "https://itunes.apple.com/us/app/trash-dash/id1198634425?mt=8" App store URL of the app being advertised, if applicable.

Important: This attribute is a unique Unity Exchange requirement for app advertisements.

length int "length": 15 Length of the video in seconds, if applicable.
crtype string "crtype": "VAST 3.0" The creative type of the ad asset. The following types are valid:
  • VAST
  • VAST 2.0
  • VAST 3.0
  • VAST 4.0
  • VAST VPAID
  • MRAID playable
  • MRAID 2.0
  • BANNER
  • HTML
  • HTML5
  • JS

Important: These values are case-insensitive. This attribute is required in the response.

Example bid responses

Playable response

Copy


    "id": "7jrUifdKuw3HDIR9dbqDVJ",
    "seatbid": [{
        "bid": [{
            "id": "1234567890123456789",
            "impid": "1",
            "price": 0.78,
            "adid": "12345678",
            "nurl": "https://secure-datacenter.dsp.com/ab?e=wqT_3FL5gUgASotCQAAAQZjkxNjQ.\\u0026referrer=play.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.any.game\\u0026pp=${AUCTION_PRICE}\\u0026label=nurl",
            "burl": "https://secure-datacenter.dsp.com/ab?e=wqT_3FL5gUgASotCQAAAQZjkxNjQ.\\u0026referrer=play.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.any.game\\u0026pp=${AUCTION_PRICE}\\u0026pplabel=burl",
            "adm": "<img src=\"https://my.impression.com/custom/pixel?1234%3D\" style=\"display: none;\">\n <a href=\"https:/my.custom.click/event?&partner=myDSP\"><div style=\"position: fixed; top:0; left:0; width: 100vw; height: 100vh; background-position: center center; background-image: url('https://ex_assets.com/ad_assets/files/000/897/403/original/.jpg?c=1595511733'); background-size: contain;\"></div></a>\n<script type=\"application/javascript\"> bmTrackViewableChange=function(e){mraid.addEventListener(\"viewableChange\",function(){console.log(\"empty viewableChange.....event\")}),e&&bmSendImpression()},bmSubscribeViewableEvent=function(){bmSendFill(),bmSubscribeClickEvent(),mraid.addEventListener(\"ready\",function(){console.log(\"empty ready event\")}),mraid.isViewable()?bmSendImpression():(mraid.addEventListener(\"viewableChange\",function(){}),mraid.addEventListener(\"viewableChange\",bmTrackViewableChange))},bmSubscribeClickEvent=function(){window.addEventListener(\"click\",function(e){bmSendClick()},!1)};bmAddContextToUrl(),\"loading\"===mraid.getState()?(mraid.addEventListener(\"ready\",function(){}),mraid.addEventListener(\"ready\",bmSubscribeViewableEvent)):bmSubscribeViewableEvent();\n</script>",
            "adomain": ["viaplay.fi"],
            "bundle": "com.unityexample.game",
            "iurl": "https://secure-datacenter.dsp.com/cr?id=12345678",
            "cid": "1234",
            "crid": "12345678",
            "cat": ["IAB3-12", "IAB3-8", "IAB21-2", "IAB10-9", "IAB3", "NEX3-101", "IAB3-11", "IAB3-10", "NEX3-102", "IAB3-5", "IAB3-6"],
            "attr": [],
            "h": 320,
            "w": 480,
            "appcategory": ["Games"],
            "appsubcategory": ["Adventure", "Action"],
            "ext": {
                "appname": "Example Game",
                "storeurl": "https://play.google.com/store/apps/details?id=com.unityexample.game",
                "crtype": "PLAYABLE"
            }
        }],
        "seat": "1234"
    }],
    "bidid": "CHYr9b0ODI8OGLpedtfCpuCH",
    "cur": "USD",

            

VAST response

Copy
    

    "id": "7jrUifdKuw3HDIR9dbqDVJ", 
    "bidid": "CHYr9b0ODI8OGLpedtfCpuCH", 
    "cur": "USD", 
    "seatbid": [{ 
        "seat": "Example Partner", 
      "bid": [{ 
          "impid": "1", 
          "adomain": ["examplegame.com"], 
          "iurl": "https://secure-datacenter.dsp.com/cr?id=12345678", 
          "crid": "12345678", 
          "cid": "1234", 
          "adid": "87654321", 
          "cat": ["IAB9-25", "IAB9-25"], 
          "bundle": "com.unityexample.game", 
          "attr": [], 
      "h": 568
      "w": 320
      "id": "unrtb-com.unityexample.game-320x568-1ADJE5D8721B3-453S-9DYA-B0AVD69AA1A1", 
      "price": 15.04,
      "nurl": "https://secure-datacenter.dsp.com/ab?e=wqT_3FL5gUgASotCQAAAQZjkxNjQ.\\u0026referrer=play.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.any.game\\u0026pp=${AUCTION_PRICE}\\u0026label=nurl",
            "burl": "https://secure-datacenter.dsp.com/ab?e=wqT_3FL5gUgASotCQAAAQZjkxNjQ.\\u0026referrer=play.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.any.game\\u0026pp=${AUCTION_PRICE}\\u0026pplabel=burl",
"adm": "<?xml version=\"1.0\"?><VAST version=\"2.0\"><Ad id=\"179e7ee9\"><InLine><AdSystem>yourdsp</AdSystem><Error><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123184311&adgroupID=180968&ra=&code=err]]></Error><Impression><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=1234567890&adgroupID=180968&ra=&code=impression]]></Impression><Creatives><Creative AdID=\"179e7ee9\"><Linear><Duration>00:00:15</Duration><TrackingEvents><Tracking event=\"skip\"><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123456789&adgroupID=180968&ra=&code=skip&s=]]></Tracking><Tracking event=\"engagedView\"><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123456789&adgroupID=180968&ra=&code=engagedView&s=]]></Tracking><Tracking event=\"creativeView\"><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123184311&adgroupID=180968&ra=&code=creativeView&s=]]></Tracking><Tracking event=\"start\"><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123184311&adgroupID=180968&ra=&code=start&s=]]></Tracking><Tracking event=\"firstQuartile\"><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123184311&adgroupID=180968&ra=&code=firstQuartile&s=]]></Tracking><Tracking event=\"midpoint\"><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123184311&adgroupID=180968&ra=&code=midpoint&s=]]></Tracking><Tracking event=\"thirdQuartile\"><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123184311&adgroupID=180968&ra=&code=thirdQuartile&s=]]></Tracking><Tracking event=\"complete\"><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123184311&adgroupID=180968&ra=&code=complete&s=]]></Tracking></TrackingEvents><VideoClicks><ClickThrough><![CDATA[https://c.yourdsp.com/ads/c.php?a=unrtb&b=unrtb-com.catchall.game-320x568&c=179e7ee9&d=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&ct=0&nb=0&its=1499375139&gf=https%3A%2F%2Fcdngs.yourdsp.com%2F1028%2F768x1024_Unsub_NewGame_Video_All_ZHCN_MZCA02xbqA4.ipad_20170629_09_44_11_.mp4&f=&ra=&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&campaignID=123184311&adgroupID=180968&adgroup=NewGame_iOS_NL&defcpa=0&defcpc=0&appid=1186994231&creativeID=329c8ef3&adType=5&countrycode=NL&ccimpid=X96142d9408c8a40179e7ee907061405&accountid=1028&siteaccountid=4917655231945&pubappid=&sg=&it=&inf=0&price=0.04800847457627119&cg=New,Set&creativeID=329c8ef3]]></ClickThrough><ClickTracking><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123184311&adgroupID=180968&ra=&code=click]]></ClickTracking></VideoClicks><MediaFiles><MediaFile delivery=\"progressive\" type=\"video/mp4\" bitrate=\"500\" width=\"768\" height=\"1024\" scalable=\"true\" maintainAspectRatio=\"true\"><![CDATA[https://cdngs.yourdsp.com/1028/768x1024_Unsub_NewGame_Video_All_ZHCN_MZCA02xbqA4.ipad_20170629_09_44_11_.mp4]]></MediaFile></MediaFiles></Linear></Creative><Creative AdID=\"179e7ee9\"><CompanionAds><Companion width=\"768\" height=\"1024\"><StaticResource creativeType=\"image/jpeg\"><![CDATA[]]></StaticResource><TrackingEvents><Tracking event=\"creativeView\"><![CDATA[https://ads.yourdsp.com/ads/vast.php?appkey=unrtb-com.catchall.game-320x568&adid=179e7ee9&appid=1139609950&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&partnerkey=unrtb&campaignID=123184311&adgroupID=180968&ra=&code=engagedView]]></Tracking></TrackingEvents><CompanionClickThrough><![CDATA[https://c.yourdsp.com/ads/c.php?a=unrtb&b=unrtb-com.catchall.game-320x568&c=179e7ee9&d=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&ct=0&nb=0&its=1499375139&gf=https%3A%2F%2Fcdngs.yourdsp.com%2F1028%2F768x1024_Unsub_NewGame_Video_All_ZHCN_MZCA02xbqA4.ipad_20170629_09_44_11_.mp4&f=&ra=&aid=1ABAE8D8-21B3-453D-9DEA-B9ABD69AA1A1&campaignID=123184311&adgroupID=180968&adgroup=NewGame_iOS_NL&defcpa=0&defcpc=0&appid=1186994231&creativeID=329c8ef3&adType=5&countrycode=NL&ccimpid=X96142d9408c8a40179e7ee907061405&accountid=1028&siteaccountid=4917655231945&pubappid=&sg=&it=&inf=0&price=0.04800847457627119&cg=New,Set&creativeID=329c8ef3]]></CompanionClickThrough></Companion></CompanionAds></Creative></Creatives></InLine></Ad></VAST>", 
      "ext": { 
      "advertisername": "One Cool Advertiser", 
      "appid": "1234567890123", 
      "appname": "Example Game", 
      "storeurl": "https://itunes.apple.com/us/app/trash-dash/id1198634425?mt=8", 
      "length": 15
      "crtype": "VAST" 
      } 
  }] 
  }] 
 } 
            

No bid responses (NBRs)

Unified Auction supports multiple response types for a no-bid. It is important to use one of these responses to explicitly signal your wish to not bid on the impression, otherwise the response might be interpreted as a timeout error.

Response Example
No content HTTP 204 No Content
Empty JSON object {}
Well-formed bid response (with or without a reason code) {"id": “1234567890”, “seatbid”: {}, “nbr”: 2}
Other
  • 200 OK
  • 302 Redirect

For more information, see section 7.1 of the OpenRTB specification.

NBR reason codes

Value Description
0 Unknown Error
1 Technical Error
2 Invalid Request
3 Known Web Spider
4 Suspected Non-Human Traffic
5 Cloud, Data center, or Proxy IP
6 Unsupported Device
7 Blocked Publisher or Site
8 Unmatched User

Price obfuscation

When sending the nURL, Unity recommends implementing obfuscation for the ${AUCTION_PRICE:BF} value in order to keep sensitive price information secure on the client side. This is an optional feature.

Methodology

To obfuscate data, Unity uses Blowfish in ECB mode, with PKCS5 padding (PKCS7 padding with 8 byte block sizes) applied to the input data. The data is then base64 URL-encoded so that the binary data is valid in URLs. Source code is available upon request for troubleshooting.

Copy

Example pseudo-code

base64_URLEncode(blowfish_ecb_encrypt_pkcs5_padding(plaintext))
Parameter Example value
key "encryption_key"
plaintext "10.20"
encrypted, base64 URL encoded "z5eznndAkpE="

Note: Unity uses a different encryption key in live production.

Decryption

To decrypt data, the input string is base64 URL-decoded. PKCS5 Padding is then removed from the encrypted data, then the blowfish ECB encryption is reversed.

Copy

Example pseudo-code

blowfish_ecb_decrypt_pkcs5_padding(base64_URLDecode(encodedtext))