> For the complete documentation index, see [llms.txt](https://docs.ipwo.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ipwo.net/huo-qu-yu-pei-zhi-dai-li/ru-he-huo-qu-dai-li/api-ti-qu.md).

# API提取

API 提取是一种通过接口动态提取代理 IP 的方式，适用于自动化系统、爬虫程序以及需要批量管理代理的开发者场景。

相比用户名 & 密码认证，API 方式更加灵活，可以按需获取代理并自动集成到你的业务流程中。

***

### 一、什么是 API 获取？

API 提取是指：

👉 通过调用接口链接，自动提取一批代理 IP（IP + Port）

返回的数据通常为 JSON 或文本格式，可直接用于程序调用。

例如返回结果：

```json
{
  "code": 0,
  "success": true,
  "data": [
    {"ip": "1.1.2.2", "port": 14566},
    {"ip": "1.1.2.2", "port": 14577}
  ]
}
```

***

### 二、使用前准备

在使用 API 获取代理之前，请确保：

1. 已注册并登录 IPWO 账号
2. 已完成实名认证
3. 已购买或领取动态住宅代理资源
4. 已添加[ IP 白名单](/huo-qu-yu-pei-zhi-dai-li/ip-bai-ming-dan.md)（必须）

👉 API 调用通常需要绑定白名单 IP，否则无法访问

***

### 四、获取 API 链接

#### 动态住宅代理/不限量带宽代理

1. 登录 IPWO 用户中心进入对应的代理产品页面
2. 点击「**代理使用**」
3. 选择「API 提取」
4. 设置参数：
   * 代理数量
   * 国家 / 地区
   * 协议类型（不限量带宽代理默认支持HTTP/HTTPS/SOCKS5协议）

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

5. 点击「**生成代理**」

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

***

### 五、API 参数说明（常用）

你可以通过 API 参数控制代理行为，例如：

#### 国家 / 地区

```
zone_JP（日本）
zone_US（美国）
```

***

#### 州 / 城市

```
st_California
city_Jackson
```

***

#### 粘性会话（固定 IP）

```
sid_123456
```

👉 用于在一定时间内保持同一 IP

***

#### IP 存活时间

```
time_20（20分钟）
```

👉 与 sid 配合使用，控制 IP 持续时间（最高 180 分钟） ([ipwo.net](https://www.ipwo.net/proxy?utm_source=chatgpt.com))

***

### 六、使用建议

* API 适合自动化项目（如爬虫、数据采集）
* 建议按需获取 IP，避免资源浪费
* 合理设置参数（地区 / session / time）提升成功率
* 高并发场景建议结合线程池或队列管理

***

### 七、常见问题

#### 为什么 API 无法访问？

请确认当前 IP 已加入白名单。

***

#### API 返回为空怎么办？

请检查：

* 是否有可用流量
* 参数是否设置正确

***

#### 是否可以获取固定 IP？

可以，通过 `sid` 参数实现粘性会话。

***

### 九、下一步

完成 API 获取后，你可以继续：

* 查看「[参数说明](/huo-qu-yu-pei-zhi-dai-li/can-shu-shuo-ming.md)」 → 深入了解参数控制
* 查看「[轮换 IP](/huo-qu-yu-pei-zhi-dai-li/lun-huan-ip.md) / [粘性 IP](/huo-qu-yu-pei-zhi-dai-li/nian-xing-ip.md)」 → 优化 IP 使用策略
* 参考「[集成教程](/ji-cheng-jiao-cheng.md)」 → 接入你的程序或工具

***

### 总结

API 获取的核心优势在于“自动化”：

* 动态获取代理 IP
* 灵活控制参数
* 轻松集成到程序中

如果你正在构建自动化系统或爬虫，这是最推荐的代理获取方式。

***


---

# 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.ipwo.net/huo-qu-yu-pei-zhi-dai-li/ru-he-huo-qu-dai-li/api-ti-qu.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.
