Field name | Type | Required | Sample value | Comments |
---|---|---|---|---|
file | file | true | file | file data |
filename | string | true | GdIDB9HakAAiVFK.jpg | filename |
purpose | string | true | 0 | file purpose |
is_public | string | false | true | Whether to be public (optional) Default private |
tags | string | false | ["t1"] | File tag tag (optional) can be used to filter files |
expires_at | string | false | 2024-11-29T22:14:53+08:00 | File expiration time (optional) The system will automatically delete it if it expires. It is recommended to set this attribute when used to store temporary files |
file-v1
permissions.purpose
definition:{
COMMON = 0,
FINETUNE = 1,
CHAT = 2,
LLM_TMP = 3,
OPENAI_BATCH = 4,
ANTHROPIC_BATCH = 5,
}
curl --location --request POST 'https://cn2us02.opapi.win/api/v1/user/files/upload' \
--header 'Authorization: Bearer <token>' \
--form 'file=@"C:\\Users\\hash070\\Downloads\\GdIDB9HakAAiVFK.jpg"' \
--form 'filename="GdIDB9HakAAiVFK.jpg"' \
--form 'purpose="0"' \
--form 'is_public="true"' \
--form 'tags="t1"' \
--form 'tags="t2"' \
--form 'expires_at="2024-11-29T22:14:53+08:00"'
{
"statusCode": 200,
"message": "File Upload Success",
"data": {
"fileUniqueID": "ENthMCy_5zr5zN3GRJseM"
}
}