Upload file
Uploads a file for further use in other requests
Function UploadFile(Val URL, Val Token, Val FileName, Val Data, Val Destination, Val AdditionalHeaders = "") Export
Parameter | CLI option | Type | Required | Description |
---|---|---|---|---|
URL | --url | String | ✔ | OpenAI server URL |
Token | --token | String | ✔ | OpenAI authorization token |
FileName | --name | String | ✔ | File name with extension |
Data | --data | String, BinaryData | ✔ | Path to file or data |
Destination | --purpose | String | ✔ | File purpose: assistants, batch, vision, user_data, evals |
AdditionalHeaders | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
Returns: Map Of KeyAndValue - Processing result
tip
Method at API documentation: Upload file
Parameters with Binary data type can also accept file paths on disk and URLs
1C:Enterprise/OneScript code example
URL = "https://api.athenaeum.digital:1122/";
Token = "sk-or-vv-c5884ebe9f13fb143194bb07ecb...";
File = "https://api.athenaeum.digital/test_data/picture.jpg"; // URL, Path or Binary Data
FileName = StrTemplate("%1.png", String(New UUID()));
Destination = "assistants";
Result = OPI_OpenAI.UploadFile(URL, Token, FileName, File, Destination);
- Bash
- CMD/Bat
oint openai UploadFile \
--url "https://api.athenaeum.digital:1122/" \
--token "***" \
--name "fac80cf7-501d-4616-8a39-ffc7a91692d2.png" \
--data "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg" \
--purpose "assistants"
oint openai UploadFile ^
--url "https://api.athenaeum.digital:1122/" ^
--token "***" ^
--name "fac80cf7-501d-4616-8a39-ffc7a91692d2.png" ^
--data "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg" ^
--purpose "assistants"
Result
{
"id": "file-20",
"object": "file",
"bytes": 2114025,
"created_at": "2025-06-16T18:34:16.153579044Z",
"filename": "8c0197c7-42d8-4ee6-9918-33d113e6414f.png",
"purpose": "assistants"
}