快速开始

快速入门

了解如何开始使用 MomoHub API

Base URL

所有 API 端点的基础 URL 为:

https://momohub-api.hanasaki.tech/{version}

其中 {version} 是 API 版本,目前仅有 v1

请求格式

  • 请求体使用 JSON 格式
  • 文件上传使用 multipart/form-data 格式
  • 分页参数通过 Query String 传递

认证

大部分 API 需要认证。在请求头中携带 Bearer Token:

curl -X GET https://azusa.hanasaki.tech/v1/characters \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json"

获取 Token 请参阅 认证指南

分页

列表类接口支持分页查询:

参数类型说明
pagenumber页码,从 1 开始
limitnumber每页数量
qstring搜索关键词(部分接口支持)

分页响应格式:

{
  "items": [...],
  "total": 100,
  "page": 1,
  "limit": 20,
  "totalPages": 5,
  "hasNext": true,
  "hasPrevious": false
}

通用响应结构

所有接口返回统一的 ApiResponse<T> 结构:

interface ApiResponse<T> {
  success: boolean
  code: string | null
  message: string
  data: T | null
  errors: Record<string, string> | null
  timestamp: string
}

成功响应示例:

{
  "success": true,
  "code": null,
  "message": "OK",
  "data": {
    "id": "967217c8-4e26-4404-bcc4-03e084b5d6f9",
    "name": "白洲梓",
    "avatar": "https://cdn-momohub.hanasaki.tech/avatars/967217c8-4e26-4404-bcc4-03e084b5d6f9.png",
    "bio": "Vanitas Vanitatum Et Omnia Vanitas",
    "originPrompt": "",
    "isPublic": true
  },
  "errors": null,
  "timestamp": "2026-01-15T08:30:00Z"
}