import{_ as i,c as a,o as t,ag as n}from"./chunks/framework.BmLMQRXF.js";const E=JSON.parse('{"title":"FileCodeBox API Documentation","description":"","frontmatter":{},"headers":[],"relativePath":"en/api/index.md","filePath":"en/api/index.md","lastUpdated":1739330962000}'),e={name:"en/api/index.md"};function h(l,s,p,d,k,r){return t(),a("div",null,s[0]||(s[0]=[n(`
Some APIs require Authorization header for authentication:
Authorization: Bearer <token>POST /share/text/
Share text content and get a share code.
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| text | string | Yes | - | Text content to share |
| expire_value | integer | No | 1 | Expiration time value |
| expire_style | string | No | "day" | Expiration time unit(day/hour/minute) |
Response Example:
{
"code": 200,
"msg": "success",
"detail": {
"code": "abc123",
"name": "text.txt"
}
}POST /share/file/
Upload and share a file, get a share code.
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| file | file | Yes | - | File to upload |
| expire_value | integer | No | 1 | Expiration time value |
| expire_style | string | No | "day" | Expiration time unit(day/hour/minute) |
Response Example:
{
"code": 200,
"msg": "success",
"detail": {
"code": "abc123",
"name": "example.txt"
}
}GET /share/select/
Get file information by share code.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | File share code |
Response Example:
{
"code": 200,
"msg": "success",
"detail": {
"code": "abc123",
"name": "example.txt",
"size": 1024,
"text": "File content or download link"
}
}POST /share/select/
Select file by share code.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | File share code |
Response Example:
{
"code": 200,
"msg": "success",
"detail": {
"code": "abc123",
"name": "example.txt",
"size": 1024,
"text": "File content or download link"
}
}GET /share/download
Download shared file.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | Download key |
| code | string | Yes | File share code |
POST /admin/login
Admin login to get token.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| password | string | Yes | Admin password |
GET /admin/dashboard
Get system dashboard data.
Response Example:
{
"code": 200,
"msg": "success",
"detail": {
"totalFiles": 100,
"storageUsed": "1.5GB",
"sysUptime": "10 days",
"yesterdayCount": 50,
"yesterdaySize": "500MB",
"todayCount": 30,
"todaySize": "300MB"
}
}GET /admin/file/list
Get system file list.
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| page | integer | No | 1 | Current page |
| size | integer | No | 10 | Page size |
| keyword | string | No | "" | Search keyword |
Response Example:
{
"code": 200,
"msg": "success",
"detail": {
"page": 1,
"size": 10,
"total": 100,
"data": [
{
"id": 1,
"name": "example.txt",
"size": 1024,
"created_at": "2024-01-01 12:00:00"
}
]
}
}DELETE /admin/file/delete
Delete file from system.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | File ID |
GET /admin/config/get
Get system configuration.
PATCH /admin/config/update
Update system configuration.
When an error occurs, the API will return corresponding error message:
{
"code": 422,
"detail": [
{
"loc": ["body", "password"],
"msg": "Password cannot be empty",
"type": "value_error"
}
]
}