Asset Worker API

Upload, manage, and serve files via R2 storage

Base URL: https://assets.yesy.site

REST API

POST /api/upload Upload a file

Upload a file to R2 storage. The file will be automatically categorized by type and organized by date.

Request

Content-Type: multipart/form-data

FieldTypeRequiredDescription
file File required The file to upload (images, videos, HTML, PDF, text, etc.)
Response 200
{
  "state": true,
  "message": "上传成功",
  "data": {
    "key": "images/2026/02/a3f8b2c1.png",
    "url": "https://assets.yesy.site/f/images/2026/02/a3f8b2c1.png",
    "size": 204800,
    "contentType": "image/png"
  }
}
Example
curl -X POST https://assets.yesy.site/api/upload \
  -F "file=@photo.png"
Try It
GET /api/list List files

List files in R2 storage with optional filters by type, year, and month.

Query Parameters
ParamTypeRequiredDescription
type string optional File category: images, videos, web, documents, other
year string optional Year filter, e.g. 2026
month string optional Month filter, e.g. 02
Response 200
{
  "state": true,
  "message": "共找到 3 个文件",
  "data": [
    {
      "key": "images/2026/02/a3f8b2c1.png",
      "url": "https://assets.yesy.site/f/images/2026/02/a3f8b2c1.png",
      "size": 204800,
      "uploaded": "2026-02-26T07:00:00.000Z"
    }
  ]
}
Example
# List all files
curl https://assets.yesy.site/api/list

# List images from Feb 2026
curl "https://assets.yesy.site/api/list?type=images&year=2026&month=02"
Try It
DELETE /api/delete/:key Delete a file

Delete a file from R2 storage by its full key path.

Path Parameters
ParamTypeRequiredDescription
key string required Full file key, e.g. images/2026/02/a3f8b2c1.png
Response 200
{
  "state": true,
  "message": "删除成功"
}
Response 404
{
  "state": false,
  "message": "删除失败,文件不存在"
}
Example
curl -X DELETE https://assets.yesy.site/api/delete/images/2026/02/a3f8b2c1.png
GET /f/:key Access file (public)

Directly access a file by its key. Returns the raw file content with correct Content-Type header. Images render inline, PDFs open in browser, videos play directly.

Path Parameters
ParamTypeRequiredDescription
key string required Full file key, e.g. images/2026/02/a3f8b2c1.png
Response

Raw file binary with appropriate Content-Type and Cache-Control: public, max-age=31536000, immutable

Example
# In browser
https://assets.yesy.site/f/images/2026/02/a3f8b2c1.png

# In HTML
<img src="https://assets.yesy.site/f/images/2026/02/a3f8b2c1.png">

File Categories

CategoryDirectoryExtensions
imagesimages/{year}/{month}/png, jpg, jpeg, gif, webp, svg, ico, bmp, tiff
videosvideos/{year}/{month}/mp4, webm, mov, avi, mkv, flv
webweb/{year}/{month}/html, htm
documentsdocuments/{year}/{month}/pdf, doc, docx, xls, xlsx, ppt, pptx
otherother/{year}/{month}/txt, json, csv, xml, yaml, yml, md, zip, tar, gz

MCP Tools

Connect via SSE: https://assets.yesy.site/sse  |  HTTP: https://assets.yesy.site/mcp

upload_file
Upload a file to R2 storage, returns public access link
ParamTypeDescription
filenamestringFile name, e.g. photo.png
contentstringBase64 encoded file content
list_files
List files in R2 storage with optional filters
ParamTypeDescription
typestring?Category: images, videos, web, documents, other
yearstring?Year filter, e.g. 2026
monthstring?Month filter, e.g. 02
delete_file
Delete a file from R2 storage
ParamTypeDescription
keystringFull file key, e.g. images/2026/02/a3f8b2c1.png