> 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/kai-fa-zhe-wen-dang/api-shi-yong-zhi-nan/session-shi-yong-shuo-ming.md).

# Session 使用说明

IPWO 支持 Session（会话）功能，用于在一定时间内保持同一出口 IP，适用于需要“稳定登录状态”的业务场景。

***

### 一、什么是 Session？

Session（会话）是指在代理请求中，通过指定参数让同一段时间内的请求使用相同的出口 IP。

简单理解：

```
不使用 Session → 每次请求可能换 IP
使用 Session → 一段时间内固定 IP
```

***

### 二、适用场景

Session 主要适用于：

* 社交媒体账号登录（TikTok / Facebook / Instagram）
* 电商账号运营（Amazon / eBay）
* 广告账户管理
* 需要保持登录状态的业务
* 防止频繁 IP 变化触发风控

***

### 三、Session 使用方式

在用户名中加入 Session 参数即可启用固定 IP 会话。

***

#### 示例格式

```
username_custom_zone_us_session_123456
```

说明：

* `session_123456` 为自定义 Session ID
* 相同 Session ID → 使用相同 IP
* 不同 Session ID → 分配不同 IP

***

### 四、cURL 示例

```bash
curl -x http://us.ipwo.net:7878 \
-U username_custom_zone_us_session_123456:password \
http://ipinfo.io
```

***

### 五、Session 规则说明

#### 1. Session 保持时间

* 在有效时间内保持同一 IP
* 超过时间后可能重新分配 IP

***

#### 2. Session 切换逻辑

```
Session A → IP 1
Session A → IP 1（保持）
Session B → IP 2
```

***

#### 3. Session 随机性

* Session ID 相同 → IP 稳定
* Session ID 不同 → IP 不同

***

### 六、如何设计 Session ID？

建议使用：

* 用户 ID + 时间戳
* 业务编号
* 账号标识

示例：

```
user_1001_tiktok
order_20240601
fb_account_01
```

***

### 七、使用建议

推荐：

* 一个账号对应一个 Session ID
* 不要频繁更换 Session
* 长期登录场景保持固定 Session
* 多账号使用不同 Session

***

### 八、常见问题

#### Session 不生效

请检查：

* 是否正确写入 username
* Session 格式是否正确
* 是否使用相同 Session ID

***

#### IP 仍然变化

可能原因：

* Session ID 每次请求都不同
* Session 已过期
* 使用了轮换模式

***

#### Session 和轮换冲突

如果同时使用：

* Session → 固定 IP
* 轮换 → 自动换 IP

请避免混用逻辑冲突。

***

### 九、相关文章

* [什么是粘性会话](/dai-li-ji-chu-zhi-shi/shen-me-shi-nian-xing-hui-hua.md)
* [什么是轮换 IP](/dai-li-ji-chu-zhi-shi/shen-me-shi-lun-huan-ip.md)
* [如何降低账号关联风险](/dai-li-jian-ce-yu-yin-si-an-quan/ru-he-jiang-di-zhang-hao-guan-lian-feng-xian.md)
* [代理连接失败](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/dai-li-lian-jie-shi-bai.md)
* [如何检测代理是否生效](/dai-li-jian-ce-yu-yin-si-an-quan/ru-he-jian-ce-dai-li-shi-fou-sheng-xiao.md)

> 建议在账号登录类业务中优先使用 Session 模式，可显著降低登录频繁失效和风控风险。


---

# 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/kai-fa-zhe-wen-dang/api-shi-yong-zhi-nan/session-shi-yong-shuo-ming.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.
