> For the complete documentation index, see [llms.txt](https://docs.rolaproxy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rolaproxy.com/overview/api-interface.md). Agents can also search and read this documentation through its [MCP server](https://docs.rolaproxy.com/~gitbook/mcp).

# API Interface

### Authentication Method <a href="#usercontent-ren-zheng-fang-shi" id="usercontent-ren-zheng-fang-shi"></a>

All `/v1/*` endpoints require 4 request headers

| Header        | Required | Description                                                          |
| ------------- | -------- | -------------------------------------------------------------------- |
| `X-Api-Key`   | Yes      | API Key, e.g. `ak_xxxxxxxx`                                          |
| `X-Signature` | Yes      | HMAC-SHA256 signature (lowercase hex)                                |
| `X-Timestamp` | Yes      | Current Unix timestamp (seconds), must be within 300s of server time |
| `X-Nonce`     | Yes      | 8-64 character random string, **each nonce can only be used once**   |

### Signature Algorithm <a href="#user-content-signature-algorithm" id="user-content-signature-algorithm"></a>

{% hint style="info" %}
sign\_string = METHOD + PATH + TIMESTAMP + NONCE \[ + BODY ] signature = HMAC-SHA256(api\_secret, sign\_string)
{% endhint %}

| Component | Description                                                                |
| --------- | -------------------------------------------------------------------------- |
| METHOD    | `GET` / `POST` / `PUT` / `DELETE`                                          |
| PATH      | Request path, e.g. `/v1/static/order` (**no** query params, **no** domain) |
| TIMESTAMP | Same value as header `X-Timestamp`                                         |
| NONCE     | Same value as header `X-Nonce`                                             |
| BODY      | Only for POST/PUT, raw JSON request body                                   |

### Anti-Replay Rules <a href="#user-content-anti-replay-rules" id="user-content-anti-replay-rules"></a>

| Mechanism | Rule                                                                                            |
| --------- | ----------------------------------------------------------------------------------------------- |
| Timestamp | Difference from server time must be **<= 5 minutes**, expired requests are rejected             |
| Nonce     | **Each nonce can only be used once** within 5 minutes, duplicates are treated as replay attacks |

### Example Request (bash) <a href="#user-content-example-request-bash" id="user-content-example-request-bash"></a>

```
API_KEY="ak_xxxxxxxx"
API_SECRET="sk_xxxxxxxx"

BODY='{"items":[{"region_id":3630,"quantity":1,"is_native":0}]}'
TS=$(date +%s)
NONCE=$(head -c 16 /dev/urandom | xxd -p)

SIGN=$(echo -n "POST/v1/static/order${TS}${NONCE}${BODY}" \
  | openssl dgst -sha256 -hmac "$API_SECRET" | awk '{print $NF}')

curl -X POST "https://api.v1.rolaproxy.com/v1/static/order" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: $API_KEY" \
  -H "X-Timestamp: $TS" \
  -H "X-Nonce: $NONCE" \
  -H "X-Signature: $SIGN" \
  -d "$BODY"
```

### Unified Response Format <a href="#user-content-unified-response-format" id="user-content-unified-response-format"></a>

```
json
{"code": 0, "message": "success", "error": "", "data": {}}
```

| code  | HTTP | Description                                                      |
| ----- | ---- | ---------------------------------------------------------------- |
| 0     | 200  | Success                                                          |
| 40001 | 400  | Invalid request parameters                                       |
| 40101 | 401  | Authentication failed (invalid signature / key / replay request) |
| 40301 | 403  | HTTPS required / key disabled                                    |
| 40401 | 404  | Resource not found                                               |
| 50001 | 500  | Internal server error                                            |

### Health <a href="#user-content-health" id="user-content-health"></a>

**`GET /health`** — Health check, no authentication required

```
json
{"code":0,"message":"success","data":{"status":"ok"}}
```

### Wallet <a href="#user-content-wallet" id="user-content-wallet"></a>

**`GET /v1/wallet/balance`** — Query account balance

```
json
{
  "code": 0,
  "data": {
    "uid": 3,
    "email": "aa_zhangkun@163.com",
    "balance": "16.06",
    "available": "16.06"
  }
}
```

### Static ISP <a href="#user-content-static-isp" id="user-content-static-isp"></a>

List Regions

**`GET /v1/static/regions`**

| Query Param      | Type   | Required | Description                               |
| ---------------- | ------ | -------- | ----------------------------------------- |
| `is_native`      | int    | Yes      | `0` = broadcast range, `1` = native range |
| `continent_code` | string |          | Continent filter: `NA` / `EU` / `AS` ...  |
| `region_code`    | string |          | Country code: `US` / `CN` / `JP` ...      |
| `city_code`      | string |          | City code filter                          |

Response is grouped by country. `current_price` is dynamically calculated based on user tier

```
json
{
  "code": 0,
  "data": [
    {
      "continent_code": "NA",
      "region_code": "US",
      "region_name": "United States",
      "current_price": "3.15",
      "original_price": 7,
      "valid_days": 30,
      "is_native": 1,
      "ip_num": 1660861,
      "cities": [
        {"id": 3630, "city_code": "US-LA", "city_name": "Los Angeles", "ip_num": 20000}
      ]
    }
  ]
}
```

💡 `current_price` in the list is the lowest tier price for that country and range type. Different cities within the same country may have different tier prices depending on the price group (NTT / ordinary). The order price is recalculated per city when placing an order.

💡 The `region_id` used when ordering is `cities[].id`

### Create Order (Batch) <a href="#user-content-create-order-batch" id="user-content-create-order-batch"></a>

**`POST /v1/static/order`**

A single request can order IPs from multiple countries/cities simultaneously. The server consolidates them into one order with a single charge.

```
json
{
  "items": [
    {"region_id": 3630, "quantity": 2, "is_native": 0},
    {"region_id": 3631, "quantity": 1, "is_native": 1},
    {"region_id": 3700, "quantity": 5, "is_native": 0}
  ]
}
```

| Field       | Type   | Required | Description                                                      |
| ----------- | ------ | -------- | ---------------------------------------------------------------- |
| `region_id` | uint64 | Yes      | From `cities[].id` in the regions list                           |
| `quantity`  | int    | Yes      | Quantity per item, 1-100                                         |
| `is_native` | int    | Yes      | `0` = broadcast range, `1` = native range, must match the region |

💡 Multiple items are supported in the `items` array. `order_amount` is the total of all items. Pricing uses the same tier-based logic as `current_price` from the list endpoint.

Example response

```
json
{
  "code": 0,
  "data": {
    "order_no": "SI179577296250654e3706f833a",
    "order_type": "purchase",
    "order_amount": "12.80",
    "actual_paid_amount": "12.80",
    "payment_method": "api-balance",
    "total_items": 3,
    "total_quantity": 8,
    "order_status": "success",
    "payment_status": "paid",
    "ip_status": 1
  }
}
```

### Renew (Batch) <a href="#user-content-renew-batch" id="user-content-renew-batch"></a>

**`POST /v1/static/renew`**

A single request can renew multiple owned IPs.

```
json
{
  "items": [
    {"users_static_isp_id": 369},
    {"users_static_isp_id": 370},
    {"users_static_isp_id": 375}
  ]
}
```

| Field                 | Type   | Required | Description                            |
| --------------------- | ------ | -------- | -------------------------------------- |
| `users_static_isp_id` | uint64 | Yes      | From `static_ips[].id` in order detail |

Response is the same as Create Order, with `order_no` prefixed by `RE`.

List Orders

**`GET /v1/static/orders?page=1&page_size=20`**

```
json
{
  "code": 0,
  "data": {
    "total": 15,
    "list": [
      {"order_no": "RE179577414933709f16f048444", "order_status": "success", "ip_status": 1}
    ]
  }
}
```

### Order Detail <a href="#user-content-order-detail" id="user-content-order-detail"></a>

**`GET /v1/static/order/detail?order_no=xxx`**

Returns `order` (order info) + `items` (line items) + `static_ips` (allocated IP list).

```
json
{
  "code": 0,
  "data": {
    "order": {"order_no": "SI...", "order_status": "success"},
    "static_ips": [
      {
        "id": 369,
        "show_ip": "166.88.236.235",
        "un": "user:pass@166.88.236.235:7778",
        "expire_time": "2026-12-27T17:49:32+08:00"
      }
    ]
  }
}
```

### Update IP Credentials <a href="#user-content-update-ip-credentials" id="user-content-update-ip-credentials"></a>

**`POST /v1/static/credentials`**

```
json
{
  "ids": [369],
  "username": "newuser",
  "password": "newpass123"
}
```

Either `username` or `password` can be omitted (at least one required).

### List CIDRs <a href="#user-content-list-cidrs" id="user-content-list-cidrs"></a>

**`POST /v1/public-catalog/isp-cidrs`**

```
json
{
  "language": "zh",
  "region_code": "",
  "key_words": "",
  "is_native": null
}
```

Each CIDR entry includes `current_price` (tier price) and `original_price` (list price). Different cities within the same country may have different tier prices depending on the price group (NTT / ordinary / hk / hks).

### Calculate CIDR Order Price (Batch) <a href="#user-content-calculate-cidr-order-price-batch" id="user-content-calculate-cidr-order-price-batch"></a>

**`POST /v1/public-catalog/isp-cidrs/calculate`** — Preview price, no charge

```
json
{
  "items": [
    {"static_isp_cidr_price_id": 1000, "cidr": "204.1.68.0/24", "quantity": 1},
    {"static_isp_cidr_price_id": 1001, "cidr": "8.8.8.0/24", "quantity": 2}
  ]
}
```

💡 Multiple items are supported in the `items` array for batch price inquiries.

### Order CIDR (Batch) <a href="#user-content-order-cidr-batch" id="user-content-order-cidr-batch"></a>

**`POST /v1/public-catalog/isp-cidrs/order`** — Same request body as above. Multiple CIDRs can be ordered in one request. `order_no` is prefixed by `CI`.

### Calculate CIDR Renew Price (Batch) <a href="#user-content-calculate-cidr-renew-price-batch" id="user-content-calculate-cidr-renew-price-batch"></a>

**`POST /v1/public-catalog/isp-cidrs/renew/calculate`**

```
json
{
  "items": [
    {"users_static_isp_id": 368},
    {"users_static_isp_id": 369},
    {"users_static_isp_id": 380}
  ]
}
```

### Renew CIDR (Batch) <a href="#user-content-renew-cidr-batch" id="user-content-renew-cidr-batch"></a>

**`POST /v1/public-catalog/isp-cidrs/renew/order`** — Same request body as above. Multiple CIDRs can be renewed in one request. `order_no` is prefixed by `CR`.

### Appendix <a href="#user-content-appendix" id="user-content-appendix"></a>

**Order Number Prefixes**

| Prefix | Type     | Description             |
| ------ | -------- | ----------------------- |
| `SI`   | purchase | Static ISP new purchase |
| `RE`   | renew    | Static ISP renewal      |
| `CI`   | purchase | CIDR new purchase       |
| `CR`   | renew    | CIDR renewal            |

**IP Status**

| ip\_status | Description                                     |
| ---------- | ----------------------------------------------- |
| 0          | Not allocated (order failed or processing)      |
| 1          | Allocated (IP successfully purchased / renewed) |
