> For the complete documentation index, see [llms.txt](https://docs.exoclick.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.exoclick.com/rtb/zh/fa-bu-shang/kai-fang-rtb/pub-open-rtb-2.4-request.md).

# Open RTB 2.4 出价请求

本页面说明如何发起竞价请求

## 竞价请求头

* **OpenRTB 版本 HTTP 头**: `x-openrtb-version: 2.4`
* **Keep-Alive HTTP 头**: `Connection: Keep-Alive`
* **内容 JSON**: `Content-Type: application/json`

以下对象应作为 JSON 编码后发送到请求体中：

## 竞价请求

| 属性     | 必填？ | 描述                                  |
| ------ | --- | ----------------------------------- |
| 在      | 是   | 竞价类型，第一价格 = 1（整数）                   |
| id     | 是   | 唯一竞价请求 ID（字符串）                      |
| imp    | 是   | 表示所提供展示位的 Imp 对象数组（对象）。             |
| site   | 是   | 通过 Site 对象提供关于发布商网站的详情（对象）。         |
| app    | 是   | 通过 App 对象提供的有关发布者应用程序的详细信息\*（对象）。   |
| device | 是   | 通过 Device 对象提供关于将投放该展示的用户设备的详情（对象）。 |
| user   | 否   | 通过 User 对象提供关于设备的人类用户的详情；即广告受众（对象）。 |
| ext    | 否   | OpenRTB 扩展的占位符。                     |

{% hint style="info" %}
以下对象中只应有一个 `{site, app}` 应出现在每个请求中。
{% endhint %}

## imp

| 属性          | 必填？                        | 描述                                                                                           |
| ----------- | -------------------------- | -------------------------------------------------------------------------------------------- |
| id          | 是                          | 此竞价请求中的唯一展示 ID（字符串）                                                                          |
| bidfloor    | 否                          | 此展示的最低出价（CPM）/点击（CPC）以及账户货币（浮点数）                                                             |
| bidfloorcur | 否                          | 使用 ISO-4217 字母代码指定的最低出价值所对应的货币（字符串）                                                          |
| native      | 仅适用于原生广告和推送展示位             | 一个 Native 对象机会（对象）。                                                                          |
| banner      | 仅适用于横幅广告和全屏插屏展示位           | 一个 Banner 对象机会（对象）。                                                                          |
| instl       | 仅适用于弹窗、直接链接、电子邮件和全屏插屏点击展示位 | 一个 Fullscreen 对象机会（对象）。                                                                      |
| video       | 仅适用于视频                     | 一个 Video 对象机会（对象）                                                                            |
| secure      | 推荐                         | 指示该展示是否需要安全的 HTTPS URL 创意素材和标记的标志，其中 0 = 非安全，1 = 安全（推荐选项）。如果省略，则安全状态未知，但可以假定支持非安全的 HTTP。（整数） |
| el          | 否                          | Base64 编码的电子邮件（字符串）                                                                          |
| ext         | 否                          | 交易所特定扩展的占位符                                                                                  |

### imp.banner

| 属性    | 必填？ | 描述                                                                                                |
| ----- | --- | ------------------------------------------------------------------------------------------------- |
| w     | 是   | 横幅的宽度（整数）                                                                                         |
| h     | 是   | 横幅的高度（整数）                                                                                         |
| mimes | 否   | 支持的 mime 类型列表（字符串数组）。我们支持：image/jpeg、image/jpg、image/png、image/png、image/gif、image/webp、video/mp4 |
| ext   | 否   | 交易所特定扩展的占位符（对象）                                                                                   |

### imp.banner.ext

| 属性            | 必填？ | 描述                 |
| ------------- | --- | ------------------ |
| image\_output | 否   | 指示图片横幅的输出格式\*（字符串） |
| video\_output | 否   | 指示视频横幅的输出格式\*（字符串） |

\*定义横幅格式的 adm 字段格式。可选值为 xml 或 html。若未提供该字段，默认值为 xml。

### imp.instl

| 属性    | 必填？ | 描述                           |
| ----- | --- | ---------------------------- |
| instl | 是   | 0 = 直接链接/电子邮件点击，1 = 弹出页/全页插屏 |

### imp.native（用于原生广告和推送通知广告）

| 属性      | 必填？ | 描述                                                                    |
| ------- | --- | --------------------------------------------------------------------- |
| request | 是   | 符合原生广告规范的请求载荷——一个 **JSON 编码字符串** 的原生广告请求，包括其 **native** 顶层对象（JSON 对象） |
| ver     | 否   | 动态原生广告 API 的版本， **request** 符合（字符串）                                   |

### imp.native.request

| 属性        | 必填？ | 描述                                                                                                                                   |
| --------- | --- | ------------------------------------------------------------------------------------------------------------------------------------ |
| ver       | 是   | 所使用的 Native Markup 版本（字符串）                                                                                                           |
| context   | 否   | 广告出现的场景。在此情况下，它是 **1** (*以内容为中心的场景，例如新闻流、文章、图片画廊、视频画廊或类似场景*），可选（整数）                                                                  |
| plcmttype | 是   | 所提供广告单元的设计/格式/布局。目前我们支持 **4** (*推荐组件*）和 **500** (*推送通知*）（整数）                                                                         |
| plcmtcnt  | 否   | 此布局中相同位置的数量。最大：10（整数）（整数）                                                                                                            |
| assets    | 是   | 一个 **资产对象**。任何竞价响应都必须符合竞价请求中表达的元素数组（JSON 对象数组）                                                                                       |
| seq       | 否   | 第一个广告为 0，第二个广告为 1，依此类推。注意，这通常不应与 plcmtcnt 结合使用——要么你正在对多个相同展示位进行竞价（此时 plcmtcnt>1，seq=0），要么你正在针对信息流中的不同项目分别进行竞价（此时 plcmtcnt=1，seq=>=1） |

### imp.native.request.assets

| 属性       | 必填？ | 描述                                                       |
| -------- | --- | -------------------------------------------------------- |
| id       | 是   | 由交易所分配的唯一素材 ID。通常为数组计数器（整数）1：图片素材 ID，2：标题素材 ID，3：描述素材 ID |
| 必需       | 否   | 设置为 **1** 如果资产是必需的，或 **0** 如果素材是可选的（整数）                  |
| plcmtcnt | 否   | 此布局中相同展示位的数量（整数）                                         |
| img      | 是   | 用于图片素材的 Image 对象\*\*（JSON 对象）                            |
| title    | 否   | 用于标题素材的 Title 对象\*\*（JSON 对象）                            |
| data     | 否   | 用于品牌名称、描述、评分、价格等的数据对象\*（JSON 对象）                         |

\*收到的原生请求竞价数量将基于您在“plcmtcnt”中设置的值。例如，"plcmtcnt":3 的竞价请求将收到 3 个不同的竞价对象。您可以在以下位置找到该示例： [响应示例页面](/rtb/zh/fa-bu-shang/kai-fang-rtb/open-rtb-publisher-code-examples.md).

\*\* 每个素材对象中只应包含 {img, title, data} 对象中的一个

### imp.native.request.assets.img

| 属性   | 必填？ | 描述                                                              |
| ---- | --- | --------------------------------------------------------------- |
| type | 否   | 发布商支持的图像元素类型 ID。我们支持： **1** (*图标图片*）（整数）， **3** (*广告的大图预览*）（整数） |
| w    | 否   | 图片宽度，单位像素，可选（整数）                                                |
| h    | 否   | 图片高度，单位像素，可选（整数）                                                |
| wmin | 是   | 图片请求的最小宽度，单位像素（整数）                                              |
| hmin | 是   | 图片请求的最小高度，单位像素（整数）                                              |

\*推送通知图标尺寸：192px x 192px

### imp.native.request.assets.title

| 属性  | 必填？ | 描述                |
| --- | --- | ----------------- |
| len | 是   | 标题元素中文本的最大长度。（整数） |

### imp.native.request.assets.data

| 属性   | 必填？ | 描述                                                                                                    |
| ---- | --- | ----------------------------------------------------------------------------------------------------- |
| type | 是   | 发布商支持的元素类型 ID（整数）。我们支持： **1** (*sponsored - 赞助方信息，响应中应包含赞助商的品牌名称*), **2** (*desc - 与所广告产品或服务相关的描述文本*) |
| len  | 否   | 元素响应中文本的最大长度（整数）                                                                                      |

### imp.video

| 属性        | 必填？ | 描述                            |
| --------- | --- | ----------------------------- |
| mimes     | 否   | 支持的 mime 类型列表（字符串数组）          |
| protocols | 否   | 支持的视频竞价响应协议列表（整数数组）           |
| skip      | 否   | 指示播放器是否允许跳过视频，其中 0 = 否，1 = 是  |
| skipafter | 否   | 在启用跳过前，视频必须播放的秒数；仅在广告可跳过时适用   |
| skipmin   | 否   | 总时长大于该秒数的视频可设置为可跳过；仅在广告可跳过时适用 |

{% hint style="info" %}
如果您在请求中只提供“skip”而没有提供“skipafter”，则视频将在 5 秒后可跳过。响应将把“skipoffset”设置为 5。\
如果您提供“skip”但没有提供“skipmin”，则无论视频时长如何，都可以跳过。
{% endhint %}

### imp.ext

| 属性         | 必填？ | 描述                               |
| ---------- | --- | -------------------------------- |
| video\_cta | 否   | 指示是否应提供 CTA，其中 0 = 否，1 = 是（默认 1） |

如需查看 CTA 示例，请查看我们的 [响应示例页面](/rtb/zh/fa-bu-shang/kai-fang-rtb/open-rtb-publisher-code-examples.md).

## site

| 属性       | 必填？ | 描述                                       |
| -------- | --- | ---------------------------------------- |
| id       | 必填  | 唯一站点 ID（字符串）                             |
| domain   | 必填  | 站点的域名（字符串）                               |
| 名称       | 必填  | 站点名称（字符串）                                |
| cat      | 否   | IAB 类别 ID（字符串数组）                         |
| page     | 推荐  | 将展示广告的页面完整 URL（字符串）                      |
| keywords | 否   | 关键字可用于确保广告位获得正确类型的广告。关键字应为由逗号分隔的词组成的字符串。 |
| ext      | 否   | 用于 OpenRTB 交易平台特定扩展的占位符。                 |

### site.ext

| 属性          | 必填？ | 描述                      |
| ----------- | --- | ----------------------- |
| exchangecat | 否   | 自定义 ExoClick 类别 ID（整数）  |
| idzone      | 否   | 自定义 ExoClick 广告位 ID（整数） |

## app

| 属性        | 必填？ | 描述                                           |
| --------- | --- | -------------------------------------------- |
| id        | 必填  | 唯一 App ID（字符串）                               |
| cat       | 否   | IAB 类别 ID（字符串数组）                             |
| keywords  | 否   | 关键字可用于确保广告位获得正确类型的广告。关键字应为由逗号分隔的词组成的字符串（字符串） |
| publisher | 否   | 关于发布者的详细信息（对象）                               |

### app.publisher

| 属性     | 必填？ | 描述                                 |
| ------ | --- | ---------------------------------- |
| domain | 推荐  | 发布者的最高级域名（例如，“publisher.com”）（字符串） |

## device

| 属性       | 必填？ | 描述                                 |
| -------- | --- | ---------------------------------- |
| ua       | 是   | 浏览器用户代理（字符串）                       |
| geo      | 否   | 通过 Geo 对象定义的设备位置，假定为用户当前位置。        |
| ip       | 是   | 用户的 IP 地址（字符串）\*                   |
| ipv6     | 推荐  | 用户的 IPv6 地址（字符串）\*                 |
| language | 推荐  | 浏览器语言，使用 ISO-639-1 两位字母代码（字符串）     |
| os       | 否   | 操作系统（字符串）                          |
| js       | 否   | 是否支持 JavaScript，其中 0 = 否，1 = 是（整数） |
| ext      | 否   | 用于 OpenRTB 交易平台特定扩展的占位符            |

{% hint style="info" %}
您只需要在请求中包含 ip 或 ipv6 其中之一，而不是两者都包含。如果使用 ipv6，请移除 ip 属性，反之亦然。两者都包含可能会导致错误。
{% endhint %}

### device.geo

| 属性      | 必填？ | 描述      |
| ------- | --- | ------- |
| country | 否   | 国家 ISO3 |

### device.ext

| 属性                | 必填？ | 描述                                     |
| ----------------- | --- | -------------------------------------- |
| remote\_addr      | 否   | 用户的主 IP 地址（字符串）                        |
| x\_forwarded\_for | 否   | 用户的 X-FORWARDED-FOR IP 地址；若未设置则为空（字符串） |

## user

| 属性 | 必填？ | 描述           |
| -- | --- | ------------ |
| id | 是   | 唯一用户 ID（字符串） |

{% hint style="info" %}
如果您无法生成用户 ID 字符串，可以将其留空（“”）。只要请求中包含“user”对象，请求就会收到响应。
{% endhint %}

## ext

| 属性  | 必填？ | 描述                                      |
| --- | --- | --------------------------------------- |
| sub | 否   | Sub ID。该值应为 1 到 10 位数字：Sub ID 不要以 0 开头。 |
| 导出  | 否   | 响应类型可以是“json”或“xml”（字符串）。默认值为“json”。    |

## 示例

您可以在我们的中找到详细的请求示例列表 [示例页面](/rtb/zh/fa-bu-shang/kai-fang-rtb/open-rtb-publisher-code-examples.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.exoclick.com/rtb/zh/fa-bu-shang/kai-fang-rtb/pub-open-rtb-2.4-request.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
