# Cổng proxy di động và xoay vòng IP

> API LocalSERP Proxy: cổng 4G/5G, xoay vòng IP (ngay lập tức, theo lịch hoặc qua liên kết) và lưu lượng hằng ngày. Tham số, phản hồi mẫu, mã curl, Python và Node.js.

- URL: https://localserpproxy.com/vi/docs/api/mobile/
- Cập nhật lần cuối: 2026-10-15
- Publisher: LocalSERP Proxy (https://localserpproxy.com)

Cổng 4G/5G chuyên dụng: đổi IP ngay hoặc theo lịch, dùng liên kết xoay IP và xem lưu lượng hằng ngày.

**Các điểm cuối trên trang này**

- `GET /v1/mobile`: Liệt kê cổng proxy di động
- `GET /v1/mobile/{portId}`: Lấy thông tin cổng proxy di động
- `PATCH /v1/mobile/{portId}`: Đổi tên, bật/tắt tự động gia hạn hoặc thiết lập xoay vòng tự động
- `POST /v1/mobile/{portId}/rotate`: Đổi IP ngay
- `GET /v1/mobile/{portId}/rotate`: Liên kết xoay vòng (GET với API key trong chuỗi truy vấn)
- `POST /v1/mobile/{portId}/reset-password`: Tạo mật khẩu proxy mới cho cổng
- `GET /v1/mobile/{portId}/usage`: Lưu lượng hằng ngày qua cổng (chỉ để tham khảo: dữ liệu không giới hạn, tuân theo chính sách sử dụng hợp lý)
- `GET /v1/catalog/countries/{countryCode}/carriers`: Nhà mạng di động có cổng 4G/5G khả dụng tại một quốc gia

URL cơ sở `https://localserpproxy.com/api/v1`. Xem tổng quan API để biết thông tin xác thực, lỗi và giới hạn: [Tổng quan API](https://localserpproxy.com/vi/docs/api/).

## Danh sách cổng di động

`GET /v1/mobile`

Xác thực: khóa API trong tiêu đề `Authorization: Bearer API_KEY`.

**Phản hồi** `200 OK`

```json
{
  "data": [
    {
      "id": "mob_2v8k1q",
      "label": "US Verizon #1",
      "status": "active",
      "country": "US",
      "city": null,
      "carrier": "verizon",
      "carrierName": "Verizon",
      "networkType": "4G",
      "currentIp": "203.0.113.201",
      "ipChangedAt": "2026-10-05T14:03:11Z",
      "endpoint": {
        "host": "gw.localserpproxy.com",
        "httpPort": 7777,
        "socksPort": 7778
      },
      "username": "USERNAME",
      "password": "PASSWORD",
      "rotation": {
        "mode": "interval",
        "intervalMinutes": 10
      },
      "minRotationIntervalSeconds": 30,
      "rotationLink": "https://localserpproxy.com/api/v1/mobile/mob_2v8k1q/rotate?key=API_KEY",
      "planId": "mob-us-30d",
      "autoRenew": false,
      "createdAt": "2026-10-05T14:03:11Z",
      "expiresAt": "2026-11-04T14:03:11Z"
    }
  ]
}
```

*curl*

```bash
curl -s "https://localserpproxy.com/api/v1/mobile" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.get(f"{API}/mobile", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/mobile`, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Nhận cổng di động

`GET /v1/mobile/{portId}`

Xác thực: khóa API trong tiêu đề `Authorization: Bearer API_KEY`.

**Tham số**

| Tên | Trong | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `portId` | path | string | Có | — |

**Phản hồi** `200 OK`

```json
{
  "id": "mob_2v8k1q",
  "label": "US Verizon #1",
  "status": "active",
  "country": "US",
  "city": null,
  "carrier": "verizon",
  "carrierName": "Verizon",
  "networkType": "4G",
  "currentIp": "203.0.113.201",
  "ipChangedAt": "2026-10-05T14:03:11Z",
  "endpoint": {
    "host": "gw.localserpproxy.com",
    "httpPort": 7777,
    "socksPort": 7778
  },
  "username": "USERNAME",
  "password": "PASSWORD",
  "rotation": {
    "mode": "interval",
    "intervalMinutes": 10
  },
  "minRotationIntervalSeconds": 30,
  "rotationLink": "https://localserpproxy.com/api/v1/mobile/mob_2v8k1q/rotate?key=API_KEY",
  "planId": "mob-us-30d",
  "autoRenew": false,
  "createdAt": "2026-10-05T14:03:11Z",
  "expiresAt": "2026-11-04T14:03:11Z"
}
```

*curl*

```bash
curl -s "https://localserpproxy.com/api/v1/mobile/mob_2v8k1q" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.get(f"{API}/mobile/mob_2v8k1q", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/mobile/mob_2v8k1q`, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Đổi tên, bật/tắt tự động gia hạn hoặc cài đặt xoay IP tự động

`PATCH /v1/mobile/{portId}`

Đổi tên cổng, bật hoặc tắt tự động gia hạn, hoặc đặt hẹn giờ xoay IP tự động từ mỗi 2 phút đến mỗi 24 giờ: `"rotation": { "mode": "interval", "intervalMinutes": 10 }` (2–1440 phút); `"mode": "manual"` sẽ tắt tính năng này. Nếu không, cổng sẽ giữ nguyên IP cho đến khi bạn xoay IP, dù nhà mạng đôi khi có thể tự đổi IP.

Xác thực: khóa API trong tiêu đề `Authorization: Bearer API_KEY`.

**Tham số**

| Tên | Trong | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `portId` | path | string | Có | — |

**Nội dung yêu cầu**

| Trường | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- |
| `label` | string | Không | tối đa 60 ký tự |
| `autoRenew` | boolean | Không | — |
| `rotation` | object | Không | Hẹn giờ xoay IP tự động: `{ "mode": "interval", "intervalMinutes": 2–1440 }` (từ mỗi 2 phút đến mỗi 24 giờ), hoặc `{ "mode": "manual", "intervalMinutes": null }` để chỉ xoay IP theo yêu cầu. |

*Ví dụ: Tự động xoay IP*

```json
{
  "rotation": {
    "mode": "interval",
    "intervalMinutes": 10
  }
}
```

*Ví dụ: Thủ công*

```json
{
  "rotation": {
    "mode": "manual",
    "intervalMinutes": null
  }
}
```

**Phản hồi** `200 OK`

```json
{
  "id": "mob_2v8k1q",
  "label": "US Verizon #1",
  "status": "active",
  "country": "US",
  "city": null,
  "carrier": "verizon",
  "carrierName": "Verizon",
  "networkType": "4G",
  "currentIp": "203.0.113.201",
  "ipChangedAt": "2026-10-05T14:03:11Z",
  "endpoint": {
    "host": "gw.localserpproxy.com",
    "httpPort": 7777,
    "socksPort": 7778
  },
  "username": "USERNAME",
  "password": "PASSWORD",
  "rotation": {
    "mode": "interval",
    "intervalMinutes": 10
  },
  "minRotationIntervalSeconds": 30,
  "rotationLink": "https://localserpproxy.com/api/v1/mobile/mob_2v8k1q/rotate?key=API_KEY",
  "planId": "mob-us-30d",
  "autoRenew": false,
  "createdAt": "2026-10-05T14:03:11Z",
  "expiresAt": "2026-11-04T14:03:11Z"
}
```

*curl*

```bash
curl -s -X PATCH "https://localserpproxy.com/api/v1/mobile/mob_2v8k1q" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rotation":{"mode":"interval","intervalMinutes":10}}'
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.patch(f"{API}/mobile/mob_2v8k1q", headers=HEADERS, json={"rotation": {"mode": "interval", "intervalMinutes": 10}}, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/mobile/mob_2v8k1q`, {
  method: 'PATCH',
  headers: { Authorization: `Bearer ${process.env.API_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ rotation: { mode: 'interval', intervalMinutes: 10 } }),
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Đổi IP ngay

`POST /v1/mobile/{portId}/rotate`

Mỗi lần xoay IP, cổng sẽ kết nối lại với nhà mạng để nhận IP mới và thường mất 5–15 giây; đôi khi nhà mạng có thể cấp lại cùng IP: chỉ cần xoay IP lần nữa. Mỗi cổng chỉ được xoay tối đa 1 lần trong 30 giây (`minRotationIntervalSeconds`): nếu yêu cầu xoay quá sớm, hệ thống sẽ trả về `429 rotation_too_soon` cùng `Retry-After` (số giây cần chờ).

Xác thực: khóa API trong tiêu đề `Authorization: Bearer API_KEY`.

**Tham số**

| Tên | Trong | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `portId` | path | string | Có | — |

**Phản hồi** `200 OK`

```json
{
  "ip": "203.0.113.201",
  "previousIp": "203.0.113.77",
  "rotatedAt": "2026-10-05T14:03:11Z",
  "nextRotationAvailableAt": "2026-10-05T14:03:41Z"
}
```

*curl*

```bash
curl -s -X POST "https://localserpproxy.com/api/v1/mobile/mob_2v8k1q/rotate" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.post(f"{API}/mobile/mob_2v8k1q/rotate", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/mobile/mob_2v8k1q/rotate`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Liên kết xoay IP (GET với API key trong chuỗi truy vấn)

`GET /v1/mobile/{portId}/rotate`

Tương tự `POST`, dùng cho tập lệnh và dấu trang: `GET https://localserpproxy.com/api/v1/mobile/{portId}/rotate?key=API_KEY`. API key cần có phạm vi `proxies`. `format=text` trả về IP mới dưới dạng `text/plain`.

Xác thực: khóa API trong tham số truy vấn `key` (phạm vi `proxies`), để liên kết hoạt động khi mở từ dấu trang.

**Tham số**

| Tên | Trong | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `key` | query | string | Có | API key của bạn (phạm vi `proxies`). |
| `portId` | path | string | Có | — |
| `format` | query | `json` · `text` | Không | mặc định `json` |

**Phản hồi** `200 OK`

```json
{
  "ip": "203.0.113.201",
  "previousIp": "203.0.113.77",
  "rotatedAt": "2026-10-05T14:03:11Z",
  "nextRotationAvailableAt": "2026-10-05T14:03:41Z"
}
```

*curl*

```bash
curl -s "https://localserpproxy.com/api/v1/mobile/mob_2v8k1q/rotate?key=$API_KEY&format=text"
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"

r = requests.get(f"{API}/mobile/mob_2v8k1q/rotate", params={"key": os.environ["API_KEY"], "format": "text"}, timeout=30)
r.raise_for_status()
print(r.text)
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/mobile/mob_2v8k1q/rotate?key=${process.env.API_KEY}&format=text`);
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.text());
```

## Tạo mật khẩu proxy mới cho cổng

`POST /v1/mobile/{portId}/reset-password`

Xác thực: khóa API trong tiêu đề `Authorization: Bearer API_KEY`.

**Tham số**

| Tên | Trong | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `portId` | path | string | Có | — |

**Phản hồi** `200 OK`

```json
{
  "id": "mob_2v8k1q",
  "label": "US Verizon #1",
  "status": "active",
  "country": "US",
  "city": null,
  "carrier": "verizon",
  "carrierName": "Verizon",
  "networkType": "4G",
  "currentIp": "203.0.113.201",
  "ipChangedAt": "2026-10-05T14:03:11Z",
  "endpoint": {
    "host": "gw.localserpproxy.com",
    "httpPort": 7777,
    "socksPort": 7778
  },
  "username": "USERNAME",
  "password": "PASSWORD",
  "rotation": {
    "mode": "interval",
    "intervalMinutes": 10
  },
  "minRotationIntervalSeconds": 30,
  "rotationLink": "https://localserpproxy.com/api/v1/mobile/mob_2v8k1q/rotate?key=API_KEY",
  "planId": "mob-us-30d",
  "autoRenew": false,
  "createdAt": "2026-10-05T14:03:11Z",
  "expiresAt": "2026-11-04T14:03:11Z"
}
```

*curl*

```bash
curl -s -X POST "https://localserpproxy.com/api/v1/mobile/mob_2v8k1q/reset-password" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.post(f"{API}/mobile/mob_2v8k1q/reset-password", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/mobile/mob_2v8k1q/reset-password`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Lưu lượng hằng ngày qua cổng (thông tin: dữ liệu không giới hạn, theo chính sách sử dụng hợp lý)

`GET /v1/mobile/{portId}/usage`

Chỉ để tham khảo. Dữ liệu không giới hạn trên cổng riêng của bạn, theo chính sách sử dụng hợp lý: nhà mạng có thể giảm tốc độ hoặc tạm dừng khi mức sử dụng quá cao.

Xác thực: khóa API trong tiêu đề `Authorization: Bearer API_KEY`.

**Tham số**

| Tên | Trong | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `portId` | path | string | Có | — |
| `from` | query | string (date) | Không | Ngày đầu tiên (UTC), tính cả ngày đó. Mặc định = 29 ngày trước `to`. |
| `to` | query | string (date) | Không | Ngày cuối cùng (UTC), tính cả ngày đó. Mặc định = hôm nay. Khoảng thời gian tối đa là 366 ngày. |

**Phản hồi** `200 OK`

```json
{
  "from": "2026-10-04",
  "to": "2026-10-05",
  "totalBytes": 2350000000,
  "totalRequests": 48210,
  "points": [
    {
      "date": "2026-10-04",
      "bytes": 1200000000,
      "requests": 24800
    },
    {
      "date": "2026-10-05",
      "bytes": 1150000000,
      "requests": 23410
    }
  ],
  "byCountry": [
    {
      "country": "US",
      "bytes": 2350000000
    }
  ]
}
```

*curl*

```bash
curl -s "https://localserpproxy.com/api/v1/mobile/mob_2v8k1q/usage" \
  -H "Authorization: Bearer $API_KEY"
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['API_KEY']}"}

r = requests.get(f"{API}/mobile/mob_2v8k1q/usage", headers=HEADERS, timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/mobile/mob_2v8k1q/usage`, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

## Nhà mạng di động có cổng 4G/5G khả dụng tại một quốc gia

`GET /v1/catalog/countries/{countryCode}/carriers`

Công khai: không cần khóa API.

**Tham số**

| Tên | Trong | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `countryCode` | path | string | Có | ISO 3166-1 alpha-2, viết hoa. |

**Phản hồi** `200 OK`

```json
{
  "data": [
    {
      "id": "verizon",
      "name": "Verizon",
      "networkTypes": [
        "4G",
        "5G"
      ],
      "available": true,
      "cities": []
    }
  ]
}
```

*curl*

```bash
curl -s "https://localserpproxy.com/api/v1/catalog/countries/US/carriers"
```

*Python*

```python
import os
import requests

API = "https://localserpproxy.com/api/v1"

r = requests.get(f"{API}/catalog/countries/US/carriers", timeout=30)
r.raise_for_status()
print(r.json())
```

*Node.js*

```javascript
// Node.js 18+ (built-in fetch), ES module
const API = 'https://localserpproxy.com/api/v1';

const res = await fetch(`${API}/catalog/countries/US/carriers`);
if (!res.ok) throw new Error((await res.json()).error?.message ?? `HTTP ${res.status}`);
console.log(await res.json());
```

---

LocalSERP Proxy: LocalSERP Proxy là dịch vụ proxy dân cư tại Hoa Kỳ để kiểm tra kết quả tìm kiếm địa phương, quảng cáo và giá theo từng thành phố, thanh toán bằng tiền mã hóa và không cần tải lên giấy tờ tùy thân.
