A bidder can purchase inventory for multiple buyers in a single bid
response. For example, a demand-side platform (DSP) might use its bidding
application to purchase inventory for several marketers or agencies who are
buyers. This guide explains how to code your bidder to process a single request
sent on behalf of multiple buyers.

## Background

In some scenarios, an ad network or agency trading desk may choose to work
with one or more DSPs. There are two options available for buyers who work
through a DSP:

- **The DSP purchases inventory for marketers or agencies that are
  *not* buyers**. In this case, the DSP receives one bid request and responds with one bid. Google bills the DSP directly.
- **The DSP purchases inventory for marketers or agencies that are
  buyers**. The DSP receives one bid request including multiple billing IDs associated with eligible buyers, and can place distinct bids for each buyer they intend to bid on behalf of. In this model, Google bills the buyer, not the DSP. The rest of this guide focuses on this scenario.

## Setup and pretargeting

Google will send a bid request containing one or more billing IDs associated
with buyers and pretargeting configurations that targeted the impression.
These can be found with the `BidRequest.imp.ext.billing_id`
field.

When responding to a `BidRequest` that contains billing IDs from
multiple buyers, `BidResponse.seatbid.bid.ext.billing_id` is
required so that Google knows which account to associate with the bid. Any
response that does not set the field is filtered. The field remains optional
for any `BidRequest` that only includes a single billing ID.

### Pretargeting example

A bidder bids on behalf of two buyers, one having a billing ID of 123, and
the other with billing ID 124. The bidder configures one pretargeting
configuration with billing ID 213 to target the English language, and another
with billing ID 231 to target personal computers. The following describes the
billing IDs that appear in bid requests for different kinds of impressions.

| Impression description | Billing IDs in bid request |
|---|---|
| Japanese language content on a personal computer. | 123, 124, 231 |
| English language content on a mobile phone. | 123, 124, 213 |
| English language content on a personal computer. | 123, 124, 213, 231 |

> [!IMPORTANT]
> **Important:** If these were your only active pretargeting configurations, you wouldn't receive bid requests for impressions that didn't originate from a personal computer and include non-English content.

## Example BidRequests

Below are examples of a `BidRequest`. You'll note that there are multiple billing IDs
in these requests because the requests are applicable to multiple accounts.

### OpenRTB Protobuf

#### Show me the example

[Serialized request](https://developers.google.com/authorized-buyers/rtb/data/request-response/openrtb_protobuf_bid_request_for_multiple_accounts_request.bin)  

```
id: "a7gs668pOD71593174WD18"
imp {
  id: "1"
  banner {
    w: 320
    h: 50
    pos: ABOVE_THE_FOLD
    battr: VIDEO_IN_BANNER_AUTO_PLAY
    battr: VIDEO_IN_BANNER_USER_INITIATED
    api: MRAID_1
    api: MRAID_2
    format {
      w: 320
      h: 50
    }
  }
  displaymanager: "GoogleMobileAds-iOS"
  displaymanagerver: "12.11.0"
  tagid: "1775995363"
  bidfloor: 10.0
  bidfloorcur: "JPY"
  pmp {
    deals {
      id: "28061984"
      bidfloor: 10.0
      bidfloorcur: "JPY"
      [com.google.doubleclick.deal] {
        deal_type: MARKETPLACE_PACKAGE
      }
    }
  }
  secure: true
  exp: 3600
  clickbrowser: true
  metric {
    type: "click_through_rate"
    value: 0.0007115462212823331
    vendor: "EXCHANGE"
  }
  metric {
    type: "viewability"
    value: 0.83
    vendor: "EXCHANGE"
  }
  [com.google.doubleclick.imp] {
    billing_id: 25077279506
    billing_id: 81842042446
    publisher_settings_list_id: 9245119909902343598
    publisher_settings_list_id: 7060632308909145426
    allowed_vendor_type: 0
    ampad: AMP_AD_NOT_ALLOWED
    buyer_generated_request_data {
      source_app {
        id: "com.google.ads.mediation.test.TestAdapter"
      }
      data: "Test Data"
    }
    excluded_creatives {
      buyer_creative_id: "EXCLUDED_BUYER_CREATIVE_ID"
    }
    excluded_creatives {
      buyer_creative_id: "EXCLUDED_BUYER_CREATIVE_ID"
    }
    skadn {
      sourceapp: "com.google.testapp"
      skadnetids: "3Y4W2r13"
      skadnetids: "D2b9v6eq"
      versions: "2.0"
      versions: "2.1"
      fidelities: STOREKIT_RENDERED_ADS
      fidelities: VIEW_THROUGH_ADS
    }
    creative_enforcement_settings {
      policy_enforcement: POLICY_ENFORCEMENT_NETWORK_AND_PLATFORM_POLICY
      publisher_blocks_enforcement: PUBLISHER_BLOCKS_ENFORCEMENT_APPLIES
    }
    billable_event_rate_bid_adjustment {
      bid_adjustment: 1.0
      creative_type: HTML_SNIPPET
    }
    jsver: "test-sdk_123456789"
  }
}
app {
  name: "Test App"
  cat: "IAB19-15"
  pagecat: "IAB19-15"
  ver: "26.39.0"
  bundle: "com.google.testapp"
  publisher {
    id: "pub-3006071972218254"
    [com.google.doubleclick.publisher] {
      country: "US"
    }
  }
  content {
    url: "https://www.google.com"
    language: "en"
    genre: "Business Banking & Finance,Financial Regulation,Automotive Industry,News and Politics,Government Business,Job Market,Personal Finance,Economy,Private Equity,Logistics and Transportation Industry,Crossover,Smart Home,Business and Finance,Celebrity Style,Minivan,Careers,Women\'s Fashion,Consumer Banking,Job Search,Apprenticeships"
    data {
      id: "0"
      segment {
        id: "OMITTED"
      }
      segment {
        id: "OMITTED"
      }
      [com.google.doubleclick.data] {
        segtax: 6
      }
    }
  }
  storeurl: "https://www.google.com"
  cattax: IAB_CONTENT_1_0
  [com.google.doubleclick.app] {
    installed_sdk {
      id: "com.google.ads.mediation.test.TestAdapter"
      sdk_version {
        major: 8
        minor: 16
        micro: 0
      }
      adapter_version {
        major: 8
        minor: 16
        micro: 0
      }
    }
  }
}
device {
  ua: "OMITTED"
  geo {
    lat: 0.0
    lon: 0.0
    country: "USA"
    region: "TX"
    metro: "623"
    city: "Grand Prairie"
    zip: "75052"
    type: IP
    utcoffset: -300
    accuracy: 4812
    [com.google.doubleclick.geo] {
      geo_criteria_id: 9026819
    }
  }
  ipv6: "2607:fb91:97c:3624:b9ba:48ef:bbc3:ea22"
  carrier: "70093"
  language: "en"
  make: "Apple"
  model: "iPhone13,4"
  os: "iOS"
  osv: "26.7.1"
  connectiontype: CELL_4G
  devicetype: HIGHEND_PHONE
  ifa: "d2ee7c9c-d000-4abb-9fe3-b6f9891f59af"
  hwv: "iPhone13,4"
  w: 428
  h: 926
  pxratio: 3.0
  sua {
    browsers {
      brand: "Mozilla"
      version: "5"
      version: "0"
    }
    browsers {
      brand: "AppleWebKit"
      version: "605"
      version: "1"
    }
    platform {
      brand: "iPhone"
      version: "26"
      version: "7"
    }
    mobile: true
    bitness: "64"
    model: "iPhone"
    source: USER_AGENT_STRING
  }
  [com.google.doubleclick.device] {
    atts: 3
    audioout: AUDIO_SPEAKER
    ifa_type: "idfa"
    scrollposx: 0
    scrollposy: 0
  }
}
user {
  [com.google.doubleclick.user] {
    eids {
      source: "OMITTED_SOURCE"
      uids {
        id: "OMITTED_ID"
      }
    }
    session {
      duration: 94
      depth: 8
      requestssinceappopen: 11
    }
  }
}
at: FIRST_PRICE
tmax: 700
cur: "AUD"
cur: "KRW"
bcat: "5"
bcat: "10"
regs {
  gpp: "OMITTED"
  gpp_sid: USNAT
}
source {
  schain {
    complete: true
    nodes {
      asi: "testssp.com"
      sid: "pub-1111111111111111"
      hp: true
    }
    ver: "1.0"
  }
  [com.google.doubleclick.source] {
    omidpn: "Google"
    omidpv: "afma-sdk-i-v12.11.0"
  }
}
cattax: GOOGLE_CATEGORIES
[com.google.doubleclick.bid_request] {
  google_query_id: "ANy-zL23dM-K888C926iz54pL02I4wa4sXX04N9233701g8h787afvX78G815DcjFi573537"
  fcap_scope: FREQUENCY_CAPPING_SCOPE_NONE
  privacy_treatments {
    ip: IP_FULL
    allow_user_data_collection: true
  }
}
```

### OpenRTB JSON

#### Show me the example

```
{
  "id": "a7gs668pOD71593174WD18",
  "imp": [
    {
      "id": "1",
      "banner": {
        "w": 320,
        "h": 50,
        "pos": 1,
        "battr": [
          6,
          7
        ],
        "api": [
          3,
          5
        ],
        "format": [
          {
            "w": 320,
            "h": 50
          }
        ]
      },
      "displaymanager": "GoogleMobileAds-iOS",
      "displaymanagerver": "12.11.0",
      "tagid": "1775995363",
      "bidfloor": 10.0,
      "bidfloorcur": "JPY",
      "pmp": {
        "deals": [
          {
            "id": "28061984",
            "bidfloor": 10.0,
            "bidfloorcur": "JPY",
            "ext": {
              "deal_type": 5
            }
          }
        ]
      },
      "secure": 1,
      "exp": 3600,
      "clickbrowser": 1,
      "metric": [
        {
          "type": "click_through_rate",
          "value": 0.0007115462212823331,
          "vendor": "EXCHANGE"
        },
        {
          "type": "viewability",
          "value": 0.83,
          "vendor": "EXCHANGE"
        }
      ],
      "ext": {
        "billing_id": [
          "25077279506",
          "81842042446"
        ],
        "publisher_settings_list_id": [
          "9245119909902343598",
          "7060632308909145426"
        ],
        "allowed_vendor_type": [
          0
        ],
        "ampad": 2,
        "buyer_generated_request_data": [
          {
            "source_app": {
              "id": "com.google.ads.mediation.test.TestAdapter"
            },
            "data": "Test Data"
          }
        ],
        "excluded_creatives": [
          {
            "buyer_creative_id": "EXCLUDED_BUYER_CREATIVE_ID"
          },
          {
            "buyer_creative_id": "EXCLUDED_BUYER_CREATIVE_ID"
          }
        ],
        "skadn": {
          "sourceapp": "com.google.testapp",
          "skadnetids": [
            "3Y4W2r13",
            "D2b9v6eq"
          ],
          "versions": [
            "2.0",
            "2.1"
          ],
          "fidelities": [
            1,
            0
          ]
        },
        "creative_enforcement_settings": {
          "policy_enforcement": 2,
          "publisher_blocks_enforcement": 1
        },
        "billable_event_rate_bid_adjustment": [
          {
            "bid_adjustment": 1.0,
            "creative_type": 1
          }
        ],
        "jsver": "test-sdk_123456789"
      }
    }
  ],
  "app": {
    "name": "Test App",
    "cat": [
      "IAB19-15"
    ],
    "pagecat": [
      "IAB19-15"
    ],
    "ver": "26.39.0",
    "bundle": "com.google.testapp",
    "publisher": {
      "id": "pub-3006071972218254",
      "ext": {
        "country": "US"
      }
    },
    "content": {
      "url": "https://www.google.com",
      "language": "en",
      "genre": "Business Banking & Finance,Financial Regulation,Automotive Industry,News and Politics,Government Business,Job Market,Personal Finance,Economy,Private Equity,Logistics and Transportation Industry,Crossover,Smart Home,Business and Finance,Celebrity Style,Minivan,Careers,Women's Fashion,Consumer Banking,Job Search,Apprenticeships",
      "data": [
        {
          "id": "0",
          "segment": [
            {
              "id": "OMITTED"
            },
            {
              "id": "OMITTED"
            }
          ],
          "ext": {
            "segtax": 6
          }
        }
      ]
    },
    "storeurl": "https://www.google.com",
    "cattax": 1,
    "ext": {
      "installed_sdk": [
        {
          "id": "com.google.ads.mediation.test.TestAdapter",
          "sdk_version": {
            "major": 8,
            "minor": 16,
            "micro": 0
          },
          "adapter_version": {
            "major": 8,
            "minor": 16,
            "micro": 0
          }
        }
      ]
    }
  },
  "device": {
    "ua": "OMITTED",
    "geo": {
      "lat": 0.0,
      "lon": 0.0,
      "country": "USA",
      "region": "TX",
      "metro": "623",
      "city": "Grand Prairie",
      "zip": "75052",
      "type": 2,
      "utcoffset": -300,
      "accuracy": 4812,
      "ext": {
        "geo_criteria_id": 9026819
      }
    },
    "ipv6": "2607:fb91:97c:3624:b9ba:48ef:bbc3:ea22",
    "carrier": "70093",
    "language": "en",
    "make": "Apple",
    "model": "iPhone13,4",
    "os": "iOS",
    "osv": "26.7.1",
    "connectiontype": 6,
    "devicetype": 4,
    "ifa": "d2ee7c9c-d000-4abb-9fe3-b6f9891f59af",
    "hwv": "iPhone13,4",
    "w": 428,
    "h": 926,
    "pxratio": 3.0,
    "sua": {
      "browsers": [
        {
          "brand": "Mozilla",
          "version": [
            "5",
            "0"
          ]
        },
        {
          "brand": "AppleWebKit",
          "version": [
            "605",
            "1"
          ]
        }
      ],
      "platform": {
        "brand": "iPhone",
        "version": [
          "26",
          "7"
        ]
      },
      "mobile": 1,
      "bitness": "64",
      "model": "iPhone",
      "source": 3
    },
    "ext": {
      "atts": 3,
      "audioout": 1,
      "ifa_type": "idfa",
      "scrollposx": 0,
      "scrollposy": 0
    }
  },
  "user": {
    "ext": {
      "eids": [
        {
          "source": "OMITTED_SOURCE",
          "uids": [
            {
              "id": "OMITTED_ID"
            }
          ]
        }
      ],
      "session": {
        "duration": 94,
        "depth": 8,
        "requestssinceappopen": 11
      }
    }
  },
  "at": 1,
  "tmax": 700,
  "cur": [
    "AUD",
    "KRW"
  ],
  "bcat": [
    "5",
    "10"
  ],
  "regs": {
    "gpp": "OMITTED",
    "gpp_sid": [
      7
    ]
  },
  "source": {
    "schain": {
      "complete": 1,
      "nodes": [
        {
          "asi": "testssp.com",
          "sid": "pub-1111111111111111",
          "hp": 1
        }
      ],
      "ver": "1.0"
    },
    "ext": {
      "omidpn": "Google",
      "omidpv": "afma-sdk-i-v12.11.0"
    }
  },
  "cattax": 500,
  "ext": {
    "google_query_id": "ANy-zL23dM-K888C926iz54pL02I4wa4sXX04N9233701g8h787afvX78G815DcjFi573537",
    "fcap_scope": 1,
    "privacy_treatments": {
      "ip": 1,
      "allow_user_data_collection": 1
    }
  }
}
```