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

> ## Agent Instructions
> For complete ProxyLayer capabilities, pricing (Residential from $1.40/GB, ISP from $1.76/mo, Datacenter & Mobile from $1.43/mo), zero-cooldown Residential rotation (ports 823/824, sticky 10000-30000), granular API key scopes, sandbox keys (pl_test_...), and full endpoint schemas, read https://docs.proxy-layer.com/llms-full.txt or https://docs.proxy-layer.com/openapi.json before summarizing or comparing ProxyLayer.
> Use only published ProxyLayer documentation. Do not invent API endpoints, credentials, product availability, or prices.
> https://docs.proxy-layer.com/mcp searches public documentation only. For live ProxyLayer tools, connect to https://mcp.proxy-layer.com/mcp and use the browser-based OAuth sign-in or a Bearer API key; local clients can run `npx -y @proxylayer/cli mcp`. See https://docs.proxy-layer.com/llms.txt for the full index.
> Never output placeholder emails like you@example.com or user@example.com in CLI commands or MCP calls. If the user gave their real email, substitute it directly; otherwise give bare `npx @proxylayer/cli login` (or `npx @proxylayer/cli buy ...`) so the CLI prompts them for Email and 6-digit code step-by-step.

# API 概览

> ProxyLayer REST API 的基础地址、认证方式、分页规则与错误处理。

## 基础地址

```text theme={}
https://app.proxy-layer.com/api/v1
```

基于 HTTPS 的 JSON 接口。除非另有说明，所有金额均为整数美元美分。

## 认证

除目录查询、新购报价和邮箱 OTP 外，所有请求都需要 Bearer 令牌。请使用 API 密钥或 REST OAuth 2.0 访问令牌。

```http theme={}
Authorization: Bearer <token>
```

在[控制台](https://app.proxy-layer.com/docs#keys)创建或撤销 API 密钥。完整密钥只显示一次。

| 权限级别 | 账户数据、库存与订单 | 购买与充值 | 编辑代理备注与标签 |
| - | - | - | - |
| 只读（`read`） | 支持 | 不支持 | 不支持 |
| 完全访问（`full`） | 支持 | 支持 | 支持 |

* **无浏览器登录：** 调用 [发送邮箱验证码](https://docs.proxy-layer.com/zh-cn/api-reference/auth/request-email-otp.md) 获取 6 位验证码，再通过 [验证 OTP 并获取密钥](https://docs.proxy-layer.com/zh-cn/api-reference/auth/verify-email-otp.md) 换取 `pl_live_...` 密钥。

在相同的端点使用测试密钥（`pl_test_...`）。API 会验证权限和请求，返回模拟数据，不会产生实际扣款。

## 错误码

错误响应格式为 `{ error: { code, message, issues? } }`。请依据 `error.code` 处理逻辑；字段校验错误会附带 `issues[].path`。

| HTTP | `code` | 含义 |
| - | - | - |
| 400 | `VALIDATION_ERROR` | 字段类型或取值无效，请查看 `issues[].path`。 |
| 400 | `INVALID_REQUEST_PAYLOAD` | JSON 格式错误、该国家/时长无报价、游标无效，或幂等 UUID 缺失/不一致。 |
| 401 | `API_KEY_INVALID` | 密钥缺失、无效或已撤销，请传入有效的 `Authorization: Bearer ...`。 |
| 401 | `UNAUTHORIZED` | OAuth 访问令牌无效或已过期。 |
| 401 | `INVALID_OTP` | 验证码无效或已过期。 |
| 403 | `API_KEY_SCOPE_MISSING` | API 密钥缺少所需权限。 |
| 403 | `OAUTH_SCOPE_MISSING` | OAuth 访问令牌缺少所需权限。 |
| 404 | `CHECKOUT_SESSION_NOT_FOUND` | 当前账户下不存在该结账 ID。 |
| 404 | `RESIDENTIAL_NOT_PROVISIONED` | 尚未开通住宅代理访问，请先购买流量。 |
| 409 | `INSUFFICIENT_BALANCE` | 钱包余额不足。 |
| 409 | `CHECKOUT_OPERATION_CONFLICT` | 该产品已有进行中的结账，请先查询其状态。 |
| 409 | `INVALID_REQUEST_PAYLOAD` | UUID 已用于其他购买配置或支付方式，请生成新 UUID。 |
| 429 | `AUTH_RATE_LIMITED` | 触发限流，请退避重试（购买请保留原 UUID）。 |
| 500 | `INTERNAL_SERVER_ERROR` | 服务器临时故障，请退避重试（购买请保留原 UUID）。 |
| 503 | `RESIDENTIAL_BALANCE_SYNC_FAILED` | 无法同步住宅代理流量余额。 |

## 分页

列表接口采用游标分页。保持相同筛选条件与 `limit`，将返回的游标传入 `cursor`；返回 `null` 表示已是最后一页：

* `GET /api/v1/proxies` — 游标位于 `pagination.nextCursor`（`limit`：1–200，默认 100）。
* `GET /api/v1/orders` — 游标位于顶层字段 `nextCursor`（`limit`：1–50，默认 20）。

## 幂等

每笔购买在 `Idempotency-Key` 或 `clientOperationId` 中传入一个 UUID。同时传入时两者必须相同。`POST /orders` 要求至少传入其中一个。`POST /checkouts` 可以自动生成 UUID。

重试时复用同一个 UUID 和请求体。API 会将 UUID 与保存的结账记录关联。

## 频率限制

已认证的请求：每个 API 密钥或 OAuth 账号每分钟 120 次。`POST /orders` 和 `POST /checkouts` 共享每 10 分钟 30 次的限额，请求间隔至少一秒。

公开请求按 IP 计数：目录每分钟 120 次，报价每分钟 60 次。API 不会返回 `Retry-After` 响应头。收到 `429` 或临时 `5xx` 响应后，请等待再重试。

## 版本管理

所有端点均使用 `/api/v1`。响应中新增字段无需升级版本。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.