简单集成
使用任意编程语言,通过 HTTPS 直接调用 REST API。按照 API 文档的说明登录、读取账户详情并操作服务器。
- RESTful API 设计
- 完整文档
example.ts
// Plain HTTPS calls to the REST API
const API = 'https://api.orbai.world/api/v1';
// Sign in and receive an access token
const login = await fetch(`${API}/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: 'user@example.com',
password: 'your_password',
platform: 'web', // a script sign-in, not a VPN device
}),
});
// Accounts with two-factor sign-in get requires_2fa here instead of tokens.
const { data } = await login.json();
// Read the signed-in account
const me = await fetch(`${API}/users/me`, {
headers: { Authorization: `Bearer ${data.tokens.access_token}` },
});
console.log(await me.json());API 功能
身份认证
通过邮箱或社交账号登录获取令牌
限流控制
设有限制;请参阅速率限制文档。
Hylon API 密钥
通过 API 创建、列出和撤销 Hylon API 密钥。
WebSocket
通过 WebSocket 获取实时通知和聊天。
API 端点
POST
/api/v1/auth/register创建用户账户GET
/api/v1/users/me获取用户详情GET
/api/v1/subscriptions/current读取订阅GET
/api/v1/servers列出 VPN 服务器GET
/api/v1/vpn/connection获取当前连接GET
/api/v1/vpn/usage获取带宽使用情况