Upload, manage, and serve files via R2 storage
Upload a file to R2 storage. The file will be automatically categorized by type and organized by date.
Content-Type: multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
| file | File | required | The file to upload (images, videos, HTML, PDF, text, etc.) |
{
"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"
}
}
curl -X POST https://assets.yesy.site/api/upload \
-F "file=@photo.png"
List files in R2 storage with optional filters by type, year, and month.
| Param | Type | Required | Description |
|---|---|---|---|
| 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 |
{
"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"
}
]
}
# 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"
Delete a file from R2 storage by its full key path.
| Param | Type | Required | Description |
|---|---|---|---|
| key | string | required | Full file key, e.g. images/2026/02/a3f8b2c1.png |
{
"state": true,
"message": "删除成功"
}
{
"state": false,
"message": "删除失败,文件不存在"
}
curl -X DELETE https://assets.yesy.site/api/delete/images/2026/02/a3f8b2c1.png
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.
| Param | Type | Required | Description |
|---|---|---|---|
| key | string | required | Full file key, e.g. images/2026/02/a3f8b2c1.png |
Raw file binary with appropriate Content-Type and Cache-Control: public, max-age=31536000, immutable
# 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">
| Category | Directory | Extensions |
|---|---|---|
| images | images/{year}/{month}/ | png, jpg, jpeg, gif, webp, svg, ico, bmp, tiff |
| videos | videos/{year}/{month}/ | mp4, webm, mov, avi, mkv, flv |
| web | web/{year}/{month}/ | html, htm |
| documents | documents/{year}/{month}/ | pdf, doc, docx, xls, xlsx, ppt, pptx |
| other | other/{year}/{month}/ | txt, json, csv, xml, yaml, yml, md, zip, tar, gz |
Connect via SSE: https://assets.yesy.site/sse | HTTP: https://assets.yesy.site/mcp
| Param | Type | Description |
|---|---|---|
| filename | string | File name, e.g. photo.png |
| content | string | Base64 encoded file content |
| Param | Type | Description |
|---|---|---|
| type | string? | Category: images, videos, web, documents, other |
| year | string? | Year filter, e.g. 2026 |
| month | string? | Month filter, e.g. 02 |
| Param | Type | Description |
|---|---|---|
| key | string | Full file key, e.g. images/2026/02/a3f8b2c1.png |