开发者 API

强大、简洁的 RESTful API,几行代码即可实现专业的 PDF 转电子书功能

基础 URL:https://fusion-api.oomol.com/v1

认证

所有请求需要在 Authorization 请求头中携带 API 密钥(格式:Bearer YOUR_API_KEY)

Authorization: Bearer YOUR_API_KEY
POST/pdf-transform-markdown/submit

提交 PDF 转 Markdown 任务

上传 PDF 文件 URL 并提交转换为 Markdown 格式的任务

请求参数

  • pdfURL - PDF 文件的云端 URL(string,必需,从文件上传接口获取)
  • model - 转换模型(string,必需,固定值为 "gundam")
  • filename - 文件名(不含扩展名,可选),用于用户下载后识别文件
  • ignore_pdf_errors - 是否忽略 PDF 解析错误(可选,默认为 true)
  • ignore_ocr_errors - 是否忽略 OCR 错误(可选,默认为 true)

请求示例

{
  "pdfURL": "cache://abc123.pdf",
  "model": "gundam",
  "filename": "my-document",
  "ignore_pdf_errors": true,
  "ignore_ocr_errors": true
}

响应示例

{
  "success": true,
  "sessionID": "019aa097-f28d-7000-8d56-6a2987a7b144"
}
GET/pdf-transform-markdown/result/:taskId

查询 PDF 转 Markdown 结果

根据任务 ID 查询转换任务的状态和结果

URL 参数

  • taskId - 任务 ID(从提交接口返回的 sessionID)

响应示例(处理中)

{
  "success": true,
  "state": "processing",
  "progress": 66
}

响应示例(已完成)

{
  "success": true,
  "state": "completed",
  "progress": 100,
  "data": {
    "downloadURL": "https://cdn.oomol.com/result.md"
  }
}

响应示例(失败)

{
  "success": false,
  "state": "failed",
  "progress": 0,
  "error": "转换失败原因"
}
POST/pdf-transform-epub/submit

提交 PDF 转 EPUB 任务

上传 PDF 文件 URL 并提交转换为 EPUB 格式的任务

请求参数

  • pdfURL - PDF 文件的云端 URL(string,必需,从文件上传接口获取)
  • model - 转换模型(string,必需,固定值为 "gundam")
  • filename - 文件名(不含扩展名,可选),用于用户下载后识别文件
  • ignore_pdf_errors - 是否忽略 PDF 解析错误(可选,默认为 true)
  • ignore_ocr_errors - 是否忽略 OCR 错误(可选,默认为 true)

请求示例

{
  "pdfURL": "cache://abc123.pdf",
  "model": "gundam",
  "filename": "my-document",
  "ignore_pdf_errors": true,
  "ignore_ocr_errors": true
}

响应示例

{
  "success": true,
  "sessionID": "019aa097-f28d-7000-8d56-6a2987a7b144"
}
GET/pdf-transform-epub/result/:taskId

查询 PDF 转 EPUB 结果

根据任务 ID 查询转换任务的状态和结果

URL 参数

  • taskId - 任务 ID(从提交接口返回的 sessionID)

响应示例(处理中)

{
  "success": true,
  "state": "processing",
  "progress": 66
}

响应示例(已完成)

{
  "success": true,
  "state": "completed",
  "progress": 100,
  "data": {
    "downloadURL": "https://cdn.oomol.com/result.epub"
  }
}

响应示例(失败)

{
  "success": false,
  "state": "failed",
  "progress": 0,
  "error": "转换失败原因"
}