﻿---
sidebar_position: 4
description: Download 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';

# Download file
 Get file data from the server



`Function DownloadFile(Val URL, Val Token, Val FileID, Val AdditionalHeaders = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | URL | --url | String | &#x2714; | OpenAI server URL |
  | Token | --token | String | &#x2714; | OpenAI authorization token |
  | FileID | --id | String | &#x2714; | File ID |
  | AdditionalHeaders | --headers | Map Of KeyAndValue | &#x2716; | Additional request headers, if necessary |

  
  Returns:  BinaryData - File data

<br/>

:::tip
Method at API documentation: [Retrieve file content](https://platform.openai.com/docs/api-reference/files/retrieve-contents)
:::
<br/>



```bsl title="1C:Enterprise/OneScript code example"
    URL   = "https://hut.openintegrations.dev/localai/";
    Token = "12We...";

    FileID = "file-6";

    Result = OPI_OpenAI.DownloadFile(URL, Token, FileID);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            oint openai DownloadFile \
             --url "https://api.athenaeum.digital:1122/" \
             --token "***" \
             --id "file-4"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint openai DownloadFile ^
             --url "https://api.athenaeum.digital:1122/" ^
             --token "***" ^
             --id "file-4"
        ```
    </TabItem>
</Tabs>


```json title="Result"
NOT JSON: 0D 0A FF D8 FF E1 54 C1 45 78 69 66 00 00 49 49 2A 00 08 00 00 00 0B 00 0E 01 02 00 20 00 00 00 92 00 00 00 0F 01 02 00 05 00 00 00 B2 00 00 00 10 01 02 00 07 00 00 00 B8 00 00 00 12 01 03 00…
```
