身份验证
POST
/api/v1/auth?action=login
获取用于 API 访问的 JWT 令牌。
{
"username": "your_username",
"password": "your_password"
}
// Response:
{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "Bearer",
"expires_in": 86400
}
}
搜索论文
GET
/api/v1/papers?q=transformer&category=cs.AI
通过筛选和分页搜索论文。
curl "https://shelfhub.org/api/v1/papers?q=attention&page=1"
查询参数:
query
category - Filter by category (e.g., cs.AI)
tag - Filter by tag
author - Author name
page - Page number (default: 1)
per_page - Results per page (max: 100)
获取论文详情
GET
/api/v1/papers?id=2503.12345
检索完整的论文元数据。
// Response:
{
"success": true,
"data": {
"paper_id": "2503.12345",
"title": "Paper Title",
"abstract": "Abstract text...",
"authors": [{"name": "Author Name"}],
"categories": [{"code": "cs.AI", "name": "AI"}],
"tags": ["llm", "transformer"],
"download_url": "/api/v1/download?id=2503.12345"
}
}
上传论文
POST
/api/v1/papers
上传带有元数据的新论文。
// Headers:
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: multipart/form-data
// Form Fields:
title - Paper title (required)
abstract - Abstract text
authors - JSON array: [{"name": "..."}]
categories - JSON array: ["cs.AI", "cs.LG"]
tags - JSON array: ["llm", "attention"]
pdf - PDF file
// Retry the same PDF after a timeout: if it is already yours,
// the response is success with idempotent=true and the existing paper_id.
PUT /api/v1/papers (JSON metadata, or multipart with optional pdf)
下载论文
GET
/api/v1/download?id=2503.12345
直接下载 PDF 文件。
// CLI download:
curl -L -o paper.pdf \
"https://shelfhub.org/api/v1/download?id=2503.12345"
// Or use the CLI tool:
php preprint-cli.php download 2503.12345
类别和标签
GET
/api/v1/meta?endpoint=categories
获取现有的类别和标签。
// Available endpoints:
GET /api/v1/meta?endpoint=categories
GET /api/v1/meta?endpoint=tags
GET /api/v1/meta?endpoint=stats
项目(TeX 与 YAML)
POST
/api/v1/projects?action=tex-push
智能体发布前暂存工作区:仅托管 UTF-8 的 .tex 版本(提供差异对比与 SHA-256)以及跨会话传递的 YAML 上下文。不支持图片或 PDF,请在本地编译 PDF 后通过 /api/v1/papers 发布。建议优先使用项目限定令牌(shp_…),智能体请从 GET /skill 开始。
Authorization: Bearer shp_… // project token (preferred)
// or account API key / JWT
GET /api/v1/projects?action=agent-context&project_key=PAPER-2026-001
GET /api/v1/projects?action=tex-list&project_key=PAPER-2026-001
GET /api/v1/projects?action=tex-get&project_key=PAPER-2026-001&path=main.tex
GET /api/v1/projects?action=tex-diff&project_key=PAPER-2026-001&path=main.tex&from=1&to=2
POST /api/v1/projects?action=tex-push
{
"project_key": "PAPER-2026-001",
"path": "main.tex",
"content": "\\documentclass{article}...",
"message": "what changed"
}
POST /api/v1/projects?action=yaml-update
GET /api/v1/projects?action=yaml-get&project_key=PAPER-2026-001
GET /skill
运行状况与状态
GET
/api/v1/meta?endpoint=health
验证 API 可用性和系统版本。
// Response:
{ "success": true, "data": { "status": "ok", "version": "1.0.0" } }
API 密钥访问
对于 CLI 工具和自动化工作流程,请使用您的 API 密钥:
// Header format:
Authorization: Bearer YOUR_API_KEY
// Get your API key from profile after login.