Skip to content

APS TAM Bid

The /e/dtb/bid endpoint accepts Amazon Publisher Services (APS) Transparent Ad Marketplace bid requests and returns bids in APS format.

Endpoint

POST /e/dtb/bid
Content-Type: application/json

Request Format

json
{
  "pubId": "1234",
  "slots": [
    {
      "slotID": "header-banner",
      "slotName": "header-banner",
      "sizes": [
        [728, 90],
        [970, 250]
      ]
    }
  ],
  "pageUrl": "https://example.com/article",
  "ua": "Mozilla/5.0...",
  "timeout": 800
}

Request Fields

FieldTypeRequiredDescription
pubIdstringYesPublisher ID
slotsarrayYesArray of ad slots (min 1)
slots[].slotIDstringYesUnique slot identifier
slots[].slotNamestringNoSlot name
slots[].sizesarrayYesArray of [width, height] pairs
pageUrlstringNoPage URL
uastringNoUser agent
timeoutintegerNoRequest timeout in ms

Response Format

The response matches the real Amazon APS API format with a contextual wrapper:

json
{
  "contextual": {
    "slots": [
      {
        "slotID": "header-banner",
        "size": "970x250",
        "crid": "019b7f82e8de7e13-mocktioneer",
        "mediaType": "d",
        "fif": "1",
        "targeting": ["amzniid", "amznp", "amznsz", "amznbid", "amznactt"],
        "meta": ["slotID", "mediaType", "size"],
        "amzniid": "019b7f82e8de7e139d6d6a593171e7a0",
        "amznbid": "NC4yMA==",
        "amznp": "NC4yMA==",
        "amznsz": "970x250",
        "amznactt": "OPEN"
      }
    ],
    "host": "https://mocktioneer.edgecompute.app",
    "status": "ok",
    "cfe": true,
    "ev": true,
    "cfn": "bao-csm/direct/csm_othersv6.js",
    "cb": "6"
  }
}

Response Fields

FieldTypeDescription
contextualobjectWrapper object (matches real APS)
contextual.slotsarrayArray of bid responses
contextual.slots[].slotIDstringSlot identifier
contextual.slots[].sizestringSelected size (e.g., "970x250")
contextual.slots[].cridstringCreative ID
contextual.slots[].mediaTypestringMedia type ("d" = display)
contextual.slots[].fifstringFill indicator ("1" = filled)
contextual.slots[].targetingarrayTargeting key names
contextual.slots[].metaarrayMetadata field names
contextual.slots[].amzniidstringAmazon impression ID
contextual.slots[].amznbidstringBase64-encoded bid price
contextual.slots[].amznpstringBase64-encoded price
contextual.slots[].amznszstringSize string
contextual.slots[].amznacttstringAccount type ("OPEN")
contextual.hoststringService host
contextual.statusstringStatus ("ok")

Size Selection

When multiple sizes are provided, Mocktioneer selects the size with the highest CPM. See the complete pricing table for all supported sizes and their CPM values.

Non-standard sizes are skipped (no bid returned for that slot).

Price Encoding

Important

The price encoding differs between real APS and Mocktioneer:

  • Real Amazon APS: Uses proprietary encoding that only Amazon and trusted partners can decode
  • Mocktioneer: Uses Base64 encoding for testing purposes

Decode Mocktioneer prices:

bash
echo "Mi41MA==" | base64 -d
# Output: 2.50

Examples

cURL

bash
curl -X POST http://127.0.0.1:8787/e/dtb/bid \
  -H 'Content-Type: application/json' \
  -d '{
    "pubId": "1234",
    "slots": [{
      "slotID": "header",
      "slotName": "header",
      "sizes": [[728, 90], [970, 250]]
    }]
  }' | jq .

Multiple Slots

bash
curl -X POST http://127.0.0.1:8787/e/dtb/bid \
  -H 'Content-Type: application/json' \
  -d '{
    "pubId": "5555",
    "slots": [
      {
        "slotID": "header-banner",
        "slotName": "header-banner",
        "sizes": [[728, 90], [970, 250]]
      },
      {
        "slotID": "sidebar",
        "slotName": "sidebar",
        "sizes": [[300, 250], [300, 600]]
      },
      {
        "slotID": "mobile-banner",
        "slotName": "mobile-banner",
        "sizes": [[320, 50], [320, 100]]
      }
    ],
    "pageUrl": "https://example.com/article",
    "timeout": 800
  }' | jq .

Using Example Script

bash
./examples/aps_request.sh

Error Responses

Empty Slots (422)

json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "slots: must have at least 1 item"
  }
}

Invalid JSON (400)

json
{
  "error": {
    "code": "PARSE_ERROR",
    "message": "expected value at line 1 column 1"
  }
}

Differences from Real APS

FeatureReal APSMocktioneer
Price encodingProprietaryBase64
Creative renderingClient-side with targetingClient-side with targeting
Fill rateVariable100% for standard sizes
Response timeNetwork latencyInstant
adm fieldNot providedNot provided

Creative Rendering

Unlike OpenRTB responses, APS does not return an adm field with creative markup. Instead, creatives are rendered client-side using the targeting keys. For testing with Mocktioneer, you can render creatives directly using the static asset endpoints:

javascript
// After receiving APS bid response
const slot = response.contextual.slots[0]
const size = slot.amznsz // e.g., "300x250"
const [width, height] = size.split('x')

// Render Mocktioneer creative directly (for testing)
const iframe = document.createElement('iframe')
iframe.src = `${response.contextual.host}/static/creatives/${size}.html`
iframe.width = width
iframe.height = height
iframe.frameBorder = '0'
document.getElementById('ad-container').appendChild(iframe)

Integration with GAM

APS targeting keys can be passed to Google Ad Manager:

javascript
googletag.pubads().setTargeting('amzniid', slot.amzniid)
googletag.pubads().setTargeting('amznbid', slot.amznbid)
googletag.pubads().setTargeting('amznsz', slot.amznsz)

In production, GAM line items configured with APS targeting will serve the Amazon creative. For Mocktioneer testing, configure GAM line items to redirect to Mocktioneer's creative endpoints based on the amznsz targeting key.

See the APS Win Notification endpoint for reporting wins.

Built with EdgeZero