2025-06-07 18:34:45 +03:00
---
sidebar_position: 2
description: Upload file and other functions to work with OpenAI in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, OpenAI]
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# 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
<br/>
:::tip
Method at API documentation: [Upload file](https://platform.openai.com/docs/api-reference/files/create)
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>
```bsl title="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
2025-06-08 20:09:09 +03:00
FileName = "picture4.png";
2025-06-07 18:34:45 +03:00
Destination = "assistants";
Result = OPI_OpenAI.UploadFile(URL, Token, FileName, File, Destination);
```