Buyers

The SupplyChain object (schain) explained

By Stoqlab team · Updated · 6 min read

The SupplyChain object, usually called schain, is the part of an OpenRTB bid request that lists every seller that handled the request, in order, from the publisher's own account to whoever sent it to the buyer. app-ads.txt and sellers.json describe who may sell an app's inventory; the schain records who did sell one particular impression.

The IAB Tech Lab publishes it as the SupplyChain object specification, part of OpenRTB. In OpenRTB 2.5 it sits at source.ext.schain; from 2.6 it is a regular field, source.schain.

An example

An app sells through its own SSP account, and a reseller passes the request on to a second exchange:

"source": {
  "schain": {
    "ver": "1.0",
    "complete": 1,
    "nodes": [
      { "asi": "ssp.example",      "sid": "4821", "rid": "req-1", "hp": 1 },
      { "asi": "exchange.example", "sid": "7730", "rid": "req-2", "hp": 1 }
    ]
  }
}

The fields

FieldMeaning
verRequired. Specification version, "1.0".
completeRequired. 1 if the chain contains every node back to the owner of the app; 0 if some seller did not add itself (or the chain was started by someone who did not support it).
nodesRequired. One object per seller, in order: the first is the app's own account in a complete chain, the last is whoever sent this request.
asiRequired, per node. The ad system's canonical domain, the same as field #1 in app-ads.txt.
sidRequired, per node. The seller account on that system: field #2 in app-ads.txt, seller_id in its sellers.json.
hpRequired, per node. 1 when the node is in the payment flow. Version 1.0 says it must always be 1.
ridOptional. The request ID as issued by that seller.
name, domainOptional, and meant to be left out when the system's sellers.json already has them.

How sellers are supposed to build it

The seller that originates the request creates the object with complete: 1 and itself as the only node. Each reseller copies the object, keeps complete as it was and appends its own node. A reseller that received no schain starts one with complete: 0. Passing the object on without adding yourself is not allowed: a seller that will not add its node has to drop the object.

How buyers validate it

Every node is looked up in its asi's sellers.json, where the sid has to be listed. In a complete chain the first node should be the app owner's own account: a DIRECT line in the app's app-ads.txt and a PUBLISHER in sellers.json whose domain matches the app's OWNERDOMAIN. Every later node is someone reselling, so it should be an INTERMEDIARY there and appear as a RESELLER line in the app's file, because the publisher has to authorise each account that sells its inventory.

Passing all of that makes a node authorised. It does not make it honest: the chain is self-reported by the sellers in it, and a complete: 0 chain leaves its start unknown. Paste a schain into the schain validator to run these checks against the files we hold; the verification guide puts them next to the other checks a DSP runs.

Version 1.1 and hp = 0

The IAB Tech Lab has proposed a version 1.1 that allows hp: 0 nodes for companies that handle a request (SDKs, server-side ad insertion, wrappers) without being in the payment flow. Such nodes are not expected in app-ads.txt, so a validator written for 1.0 flags them wrongly. Check which version a chain declares before you treat a missing node as an error.