SCL Open API

SCL Open API 用于通过 API 查询应用、模板、激活码,以及批量生成激活码。

基本规则

  • 基础路径:https://api.scl.meowstack.com/open
  • 鉴权方式:API 密钥,请求头 x-api-key: SK-...Authorization: Bearer SK-...
  • 业务标识统一使用 softwareKey (软件编码)templateKey (软件签名)code (激活码)

请求头

x-api-key: SK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json

或:

Authorization: Bearer SK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json

统一响应格式

成功:

{
  "success": true,
  "data": {}
}

失败:

{
  "success": false,
  "message": "Template not found"
}

1) 查询应用列表

GET /open/apps

2) 查询单个应用

GET /open/apps/{softwareKey}

示例:

GET /open/apps/{softwareKey}

3) 查询模板列表

GET /open/templates?softwareKey={softwareKey}

模板字段示例:

{
  "softwareKey": "{softwareKey}",
  "templateKey": "{templateKey}",
  "name": "模板名称",
  "description": "{模板描述}",
  "codePrefix": "{自定义前缀}",
  "codeFormat": "XXXX-XXXX-XXXX",
  "limitMode": "time",
  "durationHours": 24,
  "maxDevices": 1,
  "maxActivations": 1,
  "maxUnbindCount": 0,
  "status": "active"
}

说明:

  • durationHours:按小时单位配置有效时长
  • maxUnbindCount
    • 0 表示禁止用户侧解绑
    • >0 表示最大可解绑次数

4) 查询单个模板

GET /open/templates/{templateKey}?softwareKey={softwareKey}

5) 查询激活码列表

GET /open/codes?softwareKey={softwareKey}

可选参数:

  • templateKey
  • status
  • key(模糊匹配)
  • page(默认 1)
  • pageSize(默认 20,最大 100)

6) 查询单个激活码

GET /open/codes/{激活码}?softwareKey={softwareKey}

示例:

GET /open/codes/{激活码}?softwareKey={softwareKey}

7) 生成激活码

POST /open/codes/generate

请求体:

{
  "softwareKey": "{softwareKey}",
  "templateKey": "{templateKey}",
  "quantity": 1,
  "remark": "{备注信息}"
}

约束:

  • softwareKey 必填(兼容 softwareCode
  • templateKey 必填
  • quantity 范围 1-500

扣费规则:

  • 每个激活码消耗 15 积分
  • 总消耗:quantity * 15
  • 积分不足时返回:400 创建失败,积分不足

成功状态码:

  • 201

curl 示例

查询应用:

curl -H "x-api-key: SK-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  https://api.scl.meowstack.com/open/apps

查询模板:

curl -H "x-api-key: SK-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  "https://api.scl.meowstack.com/open/templates?softwareKey={softwareKey}"

生成激活码:

curl -X POST \
  -H "x-api-key: SK-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"softwareKey":"{softwareKey}","templateKey":"{templateKey}","quantity":{数量},"remark":"{备注信息}"}'
  https://api.scl.meowstack.com/open/codes/generate

按激活码重置设备绑定:

curl -X PATCH \
  -H "x-api-key: SK-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  "https://api.scl.meowstack.com/open/codes/{激活码}/reset-device?softwareKey={softwareKey}"

常见错误

  • 401 Invalid API key
  • 403 This endpoint requires API key authentication
  • 404 App not found
  • 404 Template not found
  • 404 Code not found
  • 400 softwareKey and templateKey are required
  • 400 softwareKey is required
  • 400 code is required
  • 400 quantity must be between 1 and 500
  • 400 Generate failed, not enough credits