文件下载与访问
curl --request GET \
--url https://api.omnimux.ai/api/v1/files/download/{file_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.omnimux.ai/api/v1/files/download/{file_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.omnimux.ai/api/v1/files/download/{file_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.omnimux.ai/api/v1/files/download/{file_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}文件管理
文件下载与访问
GET /api/v1/files/download/ · 通过文件唯一标识获取文件或重定向至 CDN 直链
GET
/
api
/
v1
/
files
/
download
/
{file_id}
文件下载与访问
curl --request GET \
--url https://api.omnimux.ai/api/v1/files/download/{file_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.omnimux.ai/api/v1/files/download/{file_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.omnimux.ai/api/v1/files/download/{file_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.omnimux.ai/api/v1/files/download/{file_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
- 公开寻址(免登录),依赖全局唯一的
file_id访问- 绑定 R2 公共域名时会自动 302 重定向 到 R2 CDN 极速下载直链
- 本地存储模式时由网关流式回源输出并自动设置正确的
Content-Type与Content-Disposition- 文件超出 72 小时 后自动失效并返回
404 Not Found
路径参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
file_id | string | 是 | 上传成功时返回的文件全局唯一标识(如 file_8e6d425c0e564bde) |
响应说明
- 未过期文件 (200 OK / 302 Found):返回文件二进制数据流或重定向至 R2 公共存储直链。
- 过期或已删除文件 (404 Not Found):
{ "success": false, "code": 404, "msg": "文件已过期" }