> For the complete documentation index, see [llms.txt](https://iptuns.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://iptuns.gitbook.io/docs/dai-li-chan-pin/dong-tai-zhu-zhai-dai-li/api-bai-ming-dan.md).

# API 白名单

{% hint style="warning" %}
平台的所有代理产品均需要在海外网络环境下使用，海外网络环境需要客户自行配置。
{% endhint %}

本文将介绍如何在 **Iptuns平台** 为动态住宅代理配置 **API 白名单**，以便通过 API 接口安全地获取代理信息。

#### 一、选择白名单

登录 [**Iptuns**](https://iptuns.com/) 平台后，点击左侧菜单栏的 **动态住宅代理**，然后在界面中选择 **白名单** 选项。

<figure><img src="/files/TpSEx506ZvRXnuZcwJIM" alt=""><figcaption></figcaption></figure>

#### 二、管理白名单

**1. 添加白名单**

点击 **添加到白名单** 按钮，系统将自动将您当前的公网 IP 添加至白名单。

**2. 删除白名单 IP**

在白名单列表中，找到需要删除的 IP 地址，点击右侧的 **删除** 按钮即可移除。

<figure><img src="/files/b5Rwyxw40uEYXCbODHW9" alt=""><figcaption></figcaption></figure>

**3. 批量添加白名单**

如需手动添加多个 IP 地址：

* 在输入框中填写 IP 地址（每行一个）
* 可选填备注信息，便于识别和管理
* 单击 **确定** 按钮完成添加

<figure><img src="/files/8YeTqfwmVnOZxLNsIBAy" alt=""><figcaption></figcaption></figure>

#### 三、配置代理参数

**API 参数说明**

<table><thead><tr><th width="127.79998779296875">参数</th><th width="87.39996337890625">类型</th><th width="78.39996337890625">必填</th><th>说明</th></tr></thead><tbody><tr><td><code>mode</code></td><td>string</td><td>是</td><td>会话类型：<code>rotating</code>（轮换 IP）、<code>sticky</code>（粘性 IP）</td></tr><tr><td><code>host</code></td><td>string</td><td>是</td><td>代理网关地址</td></tr><tr><td><code>protocol</code></td><td>string</td><td>是</td><td>代理协议：<code>http</code> 或 <code>socks5</code></td></tr><tr><td><code>country</code></td><td>string</td><td>否</td><td>国家代码，如 <code>US</code>（不填则随机）</td></tr><tr><td><code>state</code></td><td>string</td><td>否</td><td>州/地区代码，如 <code>AK</code>（需配合 country 使用）</td></tr><tr><td><code>city</code></td><td>string</td><td>否</td><td>城市名称，如 <code>Bethel</code>（需配合 country、state 使用）</td></tr><tr><td><code>count</code></td><td>int</td><td>是</td><td>生成代理数量，支持 <strong>1 至 100</strong></td></tr><tr><td><code>format</code></td><td>string</td><td>是</td><td>输出格式：<code>txt</code>（文本格式）、<code>json</code>（JSON 格式）</td></tr><tr><td><code>sessionTime</code></td><td>int</td><td>否</td><td>粘性 IP 持续时间（分钟），<strong>1 至 70</strong>，仅在 <code>mode=sticky</code> 时生效</td></tr></tbody></table>

**配置步骤**

**1. 选择地理位置**

* 选择指定的 **国家/地区**
* 或选择 **随机位置**，由系统自动分配

**2. 选择代理格式**

* **TXT**：文本格式
* **JSON**：JSON 格式

**3. 选择代理协议**

支持 **HTTP** 和 **SOCKS5** 两种代理协议，请根据实际使用场景选择。

**4. 选择代理地址**

系统将根据您的配置自动分配可用的代理网关地址。

**5. 配置会话类型**

* **轮换 IP** ：每个新请求自动更换 IP
* **粘性 IP** ：保持相同 IP，持续时长为 **1 至 70 分钟**

**6. 设置生成数量**选择需要生成的代理数量，支持 **1 至 100** 之间的任意整数。

<figure><img src="/files/0GokubtAuiZ8bA5QpxxC" alt=""><figcaption></figcaption></figure>

#### 四、生成并获取代理信息

1. 点击 **生成代理** 按钮
2. 在右侧的 **代理信息** 区域，系统将根据以上配置显示生成的代理信息
3. 生成成功后，您可以：
   * 直接点击 **打开链接**，在浏览器中查看生成的代理列表
   * 或点击 **复制链接**，获取 API 链接以便程序调用

<figure><img src="/files/HCNNLuyduvL4wURI0CMI" alt=""><figcaption></figcaption></figure>

✅ **至此，已成功配置动态住宅代理的 API 白名单，并可通过 API 链接获取代理信息。**
