API 文档

快速开始

1. 获取API密钥

登录系统后,在项目管理页面创建项目,每个项目都会生成独立的API密钥。

2. 配置请求头

在所有API请求中,需要在请求头中添加 X-API-Key 字段。

3. 调用接口

使用下方的API端点进行版本检查、项目管理等操作。

代码示例
不同编程语言的集成示例
// 使用API Key检查更新
fetch('/api/v1/check', {
  method: 'POST',
  headers: { 'X-API-Key': 'your-project-api-key', 'Content-Type': 'application/json' },
  body: JSON.stringify({ currentVersion: '1.0.0', platform: 'android' })
})
  .then(r => r.json())
  .then(console.log)

API 端点

认证
GET/api/user/token

获取当前用户的API Token

认证方式: Session

响应示例

{
  "token": "hot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "createdAt": "2024-01-01T00:00:00.000Z"
}
POST/api/user/token

生成或重新生成API Token

认证方式: Session

响应示例

{
  "token": "hot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "createdAt": "2024-01-01T00:00:00.000Z",
  "message": "API Token已生成"
}
版本检查
POST/api/v1/check

检查最新版本(使用API Key)

认证方式: X-API-Key

请求头

{
  "X-API-Key": "your-project-api-key"
}

请求体

{
  "currentVersion": "1.0.0",
  "platform": "android" // 可选
}

响应示例

{
  "success": true,
  "hasUpdate": true,
  "data": {
    "version": "1.0.x",
    "downloadUrl": "/api/versions/{versionId}/download?i=0",
    "md5": "0123456789abcdef0123456789abcdef",
    "size": 123456,
    "forceUpdate": false,
    "changelog": "",
    "createdAt": "2025-11-12T00:00:00.000Z",
    "updatedAt": "2025-11-12T00:00:00.000Z",
    "timestamp": 1762954467000,
    "isCurrent": true
  }
}
POST/api/v1/check

检查最新版本(使用Bearer Token)

认证方式: Bearer Token

请求头

{
  "Authorization": "Bearer hot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

请求体

{
  "currentVersion": "1.0.0",
  "projectId": "clxxxxx",  // 必需,指定项目ID
  "platform": "android"    // 可选
}

响应示例

{
  "success": true,
  "hasUpdate": true,
  "data": {
    "version": "1.0.x",
    "downloadUrl": "/api/versions/{versionId}/download?i=0",
    "md5": "0123456789abcdef0123456789abcdef",
    "size": 123456,
    "forceUpdate": false,
    "changelog": "",
    "createdAt": "2025-11-12T00:00:00.000Z",
    "updatedAt": "2025-11-12T00:00:00.000Z",
    "timestamp": 1762954467000,
    "isCurrent": true
  }
}
GET/api/v1/check/latest

获取最新版本(使用Bearer Token)

认证方式: Bearer Token

请求头

{
  "Authorization": "Bearer hot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

请求体

// GET请求,projectId通过URL参数传递
?projectId=clxxxxx

响应示例

{
  "success": true,
  "data": {
    "version": "1.0.x",
    "downloadUrl": "/api/versions/{versionId}/download?i=0",
    "md5": "0123456789abcdef0123456789abcdef",
    "size": 123456,
    "forceUpdate": false,
    "changelog": "",
    "createdAt": "2025-11-12T00:00:00.000Z",
    "updatedAt": "2025-11-12T00:00:00.000Z",
    "timestamp": 1762954467000,
    "isCurrent": true
  }
}
POST/api/versions/latest

获取最新版本信息(使用API Key)

认证方式: X-API-Key

请求头

{
  "X-API-Key": "your-project-api-key"
}

请求体

// 可选,也可以在body中传递API Key
{
  "apiKey": "your-project-api-key"
}

响应示例

{
  "success": true,
  "data": {
    "version": "1.0.x",
    "downloadUrl": "/api/versions/{versionId}/download?i=0",
    "md5": "0123456789abcdef0123456789abcdef",
    "size": 123456,
    "forceUpdate": false,
    "changelog": "",
    "createdAt": "2025-11-12T00:00:00.000Z",
    "updatedAt": "2025-11-12T00:00:00.000Z",
    "timestamp": 1762954467000,
    "isCurrent": true
  }
}
POST/api/versions/latest

获取最新版本信息(使用Bearer Token)

认证方式: Bearer Token

请求头

{
  "Authorization": "Bearer hot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

请求体

{
  "projectId": "clxxxxx" // 必需,指定要查询的项目ID
}

响应示例

{
  "success": true,
  "data": {
    "version": "1.0.x",
    "downloadUrl": "/api/versions/{versionId}/download?i=0",
    "md5": "0123456789abcdef0123456789abcdef",
    "size": 123456,
    "forceUpdate": false,
    "changelog": "",
    "createdAt": "2025-11-12T00:00:00.000Z",
    "updatedAt": "2025-11-12T00:00:00.000Z",
    "timestamp": 1762954467000,
    "isCurrent": true
  }
}
项目管理
版本管理
安全说明

• API密钥应妥善保管,避免泄露到公开代码库中

• 建议在服务端调用API,避免在客户端直接暴露密钥

• 定期更新API密钥以确保安全性

• 所有API请求都通过HTTPS加密传输