Request Format
Complete specification of the OpenRTB 2.6 bid request format supported by the Affinity AI Bid API.
Request Structure
{
"id": "unique-request-id",
"imp": [...],
"site": {...},
"app": {...},
"device": {...},
"user": {...},
"regs": {...},
"ext": {...}
}
Top-Level Objects
BidRequest Object
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique ID for this bid request |
imp | object[] | Yes | Array of impression objects (at least one) |
site | object | No* | Site object (for web traffic) |
app | object | No* | App object (for app traffic) |
device | object | No | Device object |
user | object | No | User object |
regs | object | No | Regulations object (GDPR, CCPA, etc.) |
ext | object | No | Extensions object |
*Either site or app should be provided for better targeting.
Example Minimal Request
{
"id": "req-001",
"imp": [
{
"id": "imp-1",
"native": {
"request": "{\"native\":{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":80}}]}}"
}
}
]
}
Impression Object
The imp array contains one or more impression objects representing ad
placements.
Imp Object Fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique ID for this impression within request |
native | object | Yes | Native object |
ext | object | No | Extensions object |
Example Impression
{
"id": "imp-1",
"native": {
"request": "{\"native\":{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":80}}]}}"
},
"ext": {
"aura": {
"adcpFormats": [
{
"agent_url": "https://creative.adcontextprotocol.org",
"id": "display_300x250"
}
]
}
}
}
Native Object
For native ad placements.
Native Object Fields
| Field | Type | Required | Description |
|---|---|---|---|
request | string | Yes | JSON-encoded native request object |
ver | string | No | Native specification version (default: "1.2") |
api | integer[] | No | Supported API frameworks |
ext | object | No | Extensions object |
Example Native
{
"native": {
"request": "{\"native\":{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"len\":80}},{\"id\":2,\"required\":1,\"img\":{\"type\":3,\"w\":1200,\"h\":627}},{\"id\":3,\"required\":0,\"data\":{\"type\":2,\"len\":200}}]}}",
"ver": "1.2",
"api": [3, 5]
}
}
Site Object
For web-based traffic (mutually exclusive with app).
Site Object Fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Recommended | Site ID on the exchange |
domain | string | Recommended | Site domain (e.g., "example.com") |
keywords | string | Recommended | Comma-separated keywords |
publisher | object | Recommended | Publisher object |
publisher.id | string | Recommended | Publisher account ID (assigned by Affinity AI) |
content | object | No | Content object (for language) |
ext | object | No | Extensions object |
Example Site
{
"site": {
"id": "site-123",
"domain": "example.com",
"keywords": "family travel,vacation,resorts",
"publisher": {
"id": "my-publisher-id"
},
"content": {
"language": "en"
}
}
}
App Object
For app-based traffic (mutually exclusive with site).
App Object Fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Recommended | App ID on the exchange |
bundle | string | Recommended | App bundle/package name |
keywords | string | Recommended | Comma-separated keywords |
content | object | No | Content object (for language |
ext | object | No | Extensions object |
Example App
{
"app": {
"id": "app-456",
"bundle": "com.example.app",
"keywords": "gaming,entertainment",
"content": {
"language": "en"
}
}
}
Device Object
Information about the user's device.
Device Object Fields
| Field | Type | Required | Description |
|---|---|---|---|
ua | string | Recommended | User agent string |
ip | string | Recommended | IPv4 address |
language | string | No | Browser language (ISO-639-1-alpha-2) |
geo | object | Recommended | Geographic location object |
ifa | string | No | Advertising ID (IDFA/AAID) |
dpidsha1 | string | No | SHA1 hashed platform device ID |
dpidmd5 | string | No | MD5 hashed platform device ID |
ext | object | No | Extensions object |
Geo Object Fields
| Field | Type | Required | Description |
|---|---|---|---|
country | string | Recommended | Country code (ISO-3166-1-alpha-3) |
Example Device
{
"device": {
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X)...",
"ip": "192.0.2.1",
"language": "en",
"geo": {
"country": "USA"
},
"ifa": "AEBE52E7-03EE-455A-B3C4-E57283966239",
"dpidsha1": "AA000DFE74168477C70D291f574D344790E0BB11"
}
}
User Object
Information about the user (privacy-compliant).
User Object Fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | No | User ID on the exchange |
ext | object | No | Extensions object |
Example User
{
"user": {
"id": "user-789"
}
}
Regulations Object
Privacy and regulatory compliance information.
Regs Object Fields
| Field | Type | Required | Description |
|---|---|---|---|
coppa | integer | No | COPPA compliance required (0=no, 1=yes) |
ext | object | No | Extensions object |
Example Regs
{
"regs": {
"coppa": 0,
"ext": {
"gdpr": 1,
"us_privacy": "1YNN"
}
}
}
Affinity AI Extensions
Optional Affinity AI-specific extensions in the ext object.
Request-Level Extensions
{
"ext": {
"aura": {
"intent": {
"value": "information_seeking",
"confidence": 0.92,
"topics": ["family travel", "golf", "california"]
},
"sentiment": {
"value": "positive",
"score": 0.75
},
"conversation": {
"turn_count": 3,
"session_id": "session-abc123"
}
}
}
}
View context enhancement details →
Impression-Level Extensions
{
"imp": [
{
"id": "imp-1",
"native": {
"request": "{\"native\":{\"ver\":\"1.2\",\"assets\":[...]}}"
},
"ext": {
"aura": {
"adcpFormats": [
{
"agent_url": "https://creative.adcontextprotocol.org",
"id": "display_300x250"
}
]
}
}
}
]
}
Validation Rules
Required Fields
id: Must be unique per requestimp: Must contain at least one impressionimp[].id: Must be unique within requestimp[]: Must includenative- Either
siteorapp(but not both)
Field Constraints
id: Max 64 charactersimp[].id: Max 64 charactersnative.request: Must be valid JSON-encoded native request
View complete validation rules →
Next Steps
- Response Format - Bid response structure
- Required Fields - Minimum requirements
- Recommended Fields - Best practices