> ## Documentation Index
> Fetch the complete documentation index at: https://help.ip2up.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CURL请求

<Tip>平台的所有代理产品均需要在海外网络环境下使用，海外网络环境需要客户自行配置。</Tip>

本文展示如何使用 `curl` 通过Ip2up动态住宅代理IP发起请求，适用于终端或脚本中直接调用代理连接。

## V2 版本动态代理参数说明

**参数格式**

```yaml theme={null}
<账户名>-<代理类型>-<定位信息>[-sid-<会话ID>]
```

**参数说明**

|      参数      |    说明    |  必填 | 备注                              |
| :----------: | :------: | :-: | :------------------------------ |
|      账户名     |   分配的账号  | ✅ 是 | —                               |
|     代理类型     |   IP 类型  | ✅ 是 | 固定值：`res`                       |
|     定位信息     |   地理位置   | ✅ 是 | 详见下方“定位格式”                      |
| `sid-<会话ID>` | 固定 IP 会话 | ❌ 否 | 会话 ID 最多支持 9 位数字，若期间节点下线，系统自动补充 |

**定位格式**

|    级别   |             格式             |  代理类型写法  | 示例                                        |
| :-----: | :------------------------: | :------: | :---------------------------------------- |
|   无定位   |            `any`           |   `res`  | `account-res-any`                         |
|    国家   |         `<country>`        |   `res`  | `account-res-us`                          |
|   国家+州  |     `<country>_<state>`    | `res_sc` | `account-res_sc-us_california`            |
| 国家+州+城市 | `<country>_<state>_<city>` | `res_sc` | `account-res_sc-us_california_losangeles` |

> **说明：**
>
> * 当定位信息包含州或城市时，代理类型必须添加 `sc` 后缀（如 `res_sc`）
> * 所有地区名称需使用小写字母，且不含空格，例如：`us`、`california`、`losangeles`、`newsouthwales`

**案例示范**

```shell theme={null}
# 随机 不固定节点
curl -x http://account-res-any:password@[ip]:[port] http://httpbin.org/ip

# 随机 固定节点
curl -x http://account-res-any-sid-295592634:password@[ip]:[port] http://httpbin.org/ip

# 指定国家 不固定节点
curl -x http://account-res-us:password@[ip]:[port] http://httpbin.org/ip

# 指定国家 固定节点
curl -x http://account-res-us-sid-295592634:password@[ip]:[port] http://httpbin.org/ip

# 指定到国家-地区 不固定节点
curl -x socks5://account-res_sc-us_california:password@[ip]:[port] http://httpbin.org/ip

# 指定到国家-地区 固定节点
curl -x socks5://account-res_sc-us_california-sid-295592634:password@[ip]:[port] http://httpbin.org/ip

# 指定到国家-地区-城市 不固定节点
curl -x http://account-res_sc-us_california_losangeles:password@[ip]:[port] http://httpbin.org/ip

# 指定到国家-地区-城市 固定节点
curl -x http://account-res_sc-us_california_losangeles-sid-295592634:password@[ip]:[port] http://httpbin.org/ip

```

## V1 版本动态代理参数说明

**参数解释**

|      名称     |   类型   |  必填 | 备注                                      |
| :---------: | :----: | :-: | :-------------------------------------- |
|   account   | string |  是  | 账号：**后台的认证账号**                          |
|   country   |   int  |  是  | 国家Id：0代表混播 **\[当前混播仅对全球生效 非全球请指定国家Id]** |
|   province  |   int  |  是  | 地区 / 洲 Id：0代表混播                         |
|     city    |   int  |  是  | 城市Id：0代表混播                              |
|   session   | string |  是  | 会话标识：后台生成                               |
| sessionTime |   int  |  是  | 会话时长 （分钟） **0代表不固定会话**                  |
|     flag    |   Int  |  是  | 会话期间自动补充节点（1-是 0-否）\| **会话时间不为0才生效**    |

**案例示范**

```shell theme={null}

# 协议示范
规则：curl -x [protocol]://[ip]:[port] -U "[userName]:[password]" ipinfo.io
示例：curl -x http://192.168.46.222:12347 -U "op1233_0_0_0_rr123_1_1:hello123" ipinfo.io

# 案例示范

# 全球混播&不指定时长&不补充
curl -x [protocol]://[ip]:[port] -U "[account]_0_0_0_[session]_0_0:[password]" ipinfo.io

# 全球混播&指定时长&自动补充
curl -x [protocol]://[ip]:[port] -U "[account]_0_0_0_[session]_[sessionTime]_1:[password]" ipinfo.io

# 全球混播&指定时长&不自动补充
curl -x [protocol]://[ip]:[port] -U "[account]_0_0_0_[session]_[sessionTime]_0:[password]" ipinfo.io

# 指定国家&不指定时长&不补充
curl -x [protocol]://[ip]:[port] -U "[account]_[country]_0_0_[session]_0_0:[password]" ipinfo.io

# 指定国家和州&不指定时长&不补充
curl -x [protocol]://[ip]:[port] -U "[account]_[country]_[province]_0_[session]_0_0:[password]" ipinfo.io

# 指定国家和州和城市&不指定时长&不补充
curl -x [protocol]://[ip]:[port] -U "[account]_[country]_[province]_[city]_[session]_0_0:[password]" ipinfo.io
```
