FreshImages

API 接口说明

返回图床

上传图片

通过 POST /upload 上传一张或多张图片。接口需要校验上传密码。

请求地址
/upload
请求方式
POST
Content-Type
multipart/form-data
密码
freshimages921jlw!

推荐鉴权方式

在请求头中传入上传密码:

X-Upload-Password: freshimages921jlw!

表单参数

file
必填,可重复传多个文件,支持 jpeg、png、gif、webp。
category
可选,图片分类,默认 manual
password
可选,也可以用表单字段传密码。

调用示例

curl

curl -X POST "https://imgs.freshman.de5.net/upload?category=manual" \
  -H "X-Upload-Password: freshimages921jlw!" \
  -F "file=@./image.png"

JavaScript

const formData = new FormData();
formData.append("file", fileInput.files[0]);

const res = await fetch("https://imgs.freshman.de5.net/upload?category=manual", {
  method: "POST",
  headers: {
    "X-Upload-Password": "freshimages921jlw!"
  },
  body: formData
});

const data = await res.json();
console.log(data.urls);

响应示例

{
  "urls": [
    "https://imgs.freshman.de5.net/2f1e0f1a-1c74-4f6b-bf6a-4a4c7a7a3a1d.png"
  ]
}

其他接口

GET /list?format=json
获取图片列表,返回图片 URL、key、category、uploaded。
GET /{key}
访问指定图片。
DELETE /{key}
删除指定图片。