# DownloadFile

Task version: 1.5.0

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.HTTP/tree/main/Frends.HTTP.DownloadFile>

## Task Parameters

{% tabs %}
{% tab title="Input" %}

| Name                 | Description                                                                                                                                                                                                                    |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Url : `String`       | <p>The URL with protocol and path.</p><p>You can include query parameters directly in the URL.</p><p><br>Default: <code><https://example.org/path/to></code><br>Example: <code><https://example.org/path/to></code></p>        |
| Headers : `Header[]` | <p>List of HTTP headers to be added to the request.</p><p><br>Default: <code>-</code><br>Example: <code>\[ { Name = "Content-Type", Value = "application/json" }, { Name = "Accept", Value = "application/json" } ]</code></p> |
| FilePath : `String`  | <p>Exact location and name of the file to be created.</p><p><br>Default: <code>-</code><br>Example: <code>C:\temp\example.txt</code></p>                                                                                       |
| {% endtab %}         |                                                                                                                                                                                                                                |

{% tab title="Options" %}

| Name                                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authentication : `Authentication`                     | <p>Method of authenticating request.</p><p>Possible values:</p><ul><li><code>None</code>: Method of authenticating request.</li><li><code>Basic</code>: Method of authenticating request.</li><li><code>WindowsAuthentication</code>: Method of authenticating request.</li><li><code>WindowsIntegratedSecurity</code>: Method of authenticating request.</li><li><code>OAuth</code>: Method of authenticating request.</li><li><code>ClientCertificate</code>: Method of authenticating request.</li></ul><p><br>Default: <code>-</code><br>Example: <code>OAuth</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Username : `String`                                   | <p>If WindowsAuthentication is selected you should use domain\username</p><p><br>Default: <code>-</code><br>Example: <code>Username</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 🗝Password : `String`                                 | <p>Password for the user</p><p><br>Default: <code>-</code><br>Example: <code>Password123</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| 🗝Token : `String`                                    | <p>Bearer token to be used for request.</p><p>Token will be added as Authorization header.</p><p><br>Default: <code>-</code><br>Example: <code>Token123</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| UseProxy : `Boolean`                                  | <p>Whether to route requests through a proxy server. When set to true, the ProxyUrl must be provided.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ProxyUrl : `String`                                   | <p>Proxy URL used for the request.</p><p><br>Default: <code>-</code><br>Example: <code><http://proxy.example.com:8080></code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ProxyUsername : `String`                              | <p>Username for proxy authentication. Leave empty if proxy does not require authentication.</p><p>Both username and password must be provided together or left empty.</p><p><br>Default: <code>-</code><br>Example: <code>Username</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 🗝ProxyPassword : `String`                            | <p>Password for proxy authentication. Leave empty if proxy does not require authentication.</p><p>Both username and password must be provided together or left empty.</p><p><br>Default: <code>-</code><br>Example: <code>Password123</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ClientCertificateSource : `CertificateSource`         | <p>Specifies where the Client Certificate should be loaded from.</p><p>Possible values:</p><ul><li><code>CertificateStore</code>: Specifies where the Client Certificate should be loaded from.</li><li><code>File</code>: Specifies where the Client Certificate should be loaded from.</li><li><code>String</code>: Specifies where the Client Certificate should be loaded from.</li></ul><p><br>Default: <code>0</code><br>Example: <code>File</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ClientCertificateFilePath : `String`                  | <p>Applicable only when Certificate Source is "File".</p><p>Path to the Client Certificate, pfx (pkcs12) files are recommended. For other supported formats, see</p><p><https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2collection.import?view=netframework-4.7.1></p><p><br>Default: <code>-</code><br>Example: <code>domain\path</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ClientCertificateInBase64 : `String`                  | <p>Applicable only when Certificate Source is "String".</p><p>Client certificate bytes as a base64 encoded string, pfx (pkcs12) format is recommended. For other supported formats, see</p><p><https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2collection.import?view=netframework-4.7.1></p><p><br>Default: <code>-</code><br>Example: <code>domain\path</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 🗝ClientCertificateKeyPhrase : `String`               | <p>Applicable only when Certificate Source is "File" or "String".</p><p>Key phrase (password) to access the certificate data</p><p><br>Default: <code>-</code><br>Example: <code>string value</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| CertificateThumbprint : `String`                      | <p>Applicable only when Certificate Source is "CertificateStore".</p><p>Thumbprint for using client certificate authentication.</p><p><br>Default: <code>-</code><br>Example: <code>thumbprint</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| CertificateStoreLocation : `CertificateStoreLocation` | <p>Applicable only when Certificate Source is "CertificateStore".</p><p>Store location for the certificate.</p><p>Possible values:</p><ul><li><code>CurrentUser</code>: Applicable only when Certificate Source is "CertificateStore".</li></ul><p>Store location for the certificate.</p><ul><li><code>LocalMachine</code>: Applicable only when Certificate Source is "CertificateStore".</li></ul><p>Store location for the certificate.</p><p><br>Default: <code>0</code><br>Example: <code>CurrentUser</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| LoadEntireChainForCertificate : `Boolean`             | <p>Should the entire certificate chain be loaded from the certificate store and included in the request. Only valid when using Certificate Store as the Certificate Source</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ConnectionTimeoutSeconds : `Int32`                    | <p>Timeout in seconds to be used for the connection and operation.</p><p><br>Default: <code>30</code><br>Example: <code>30</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| FollowRedirects : `Boolean`                           | <p>If FollowRedirects is set to false, all responses with an HTTP status code from 300 to 399 is returned to the application.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| AllowInvalidCertificate : `Boolean`                   | <p>Do not throw an exception on certificate error.</p><p><br>Default: <code>-</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| AllowInvalidResponseContentTypeCharSet : `Boolean`    | <p>Some Api's return faulty content-type charset header. This setting overrides the returned charset.</p><p><br>Default: <code>-</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ThrowExceptionOnErrorResponse : `Boolean`             | <p>Throw exception if return code of request is not successfull</p><p><br>Default: <code>-</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| AutomaticCookieHandling : `Boolean`                   | <p>If set to false, cookies must be handled manually. Defaults to true.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| HttpProtocolVersion : `HttpVersion`                   | <p>HTTP protocol version to use for requests. HTTP/1.1 is the default and most compatible option.</p><p>Possible values:</p><ul><li><code>Http11</code>: HTTP protocol version to use for requests. HTTP/1.1 is the default and most compatible option.</li><li><code>Http20</code>: HTTP protocol version to use for requests. HTTP/1.1 is the default and most compatible option.</li></ul><p><br>Default: <code>0</code><br>Example: <code>Http11</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| SslProtocolVersion : `SslVersion`                     | <p>SSL/TLS protocol version to use for secure connections. Default lets the OS decide, which matches previous behavior.</p><p>Use Tls12 or Tls12And13 if the server requires a specific version.</p><p>Possible values:</p><ul><li><code>Default</code>: SSL/TLS protocol version to use for secure connections. Default lets the OS decide, which matches previous behavior.</li></ul><p>Use Tls12 or Tls12And13 if the server requires a specific version.</p><ul><li><code>Tls12</code>: SSL/TLS protocol version to use for secure connections. Default lets the OS decide, which matches previous behavior.</li></ul><p>Use Tls12 or Tls12And13 if the server requires a specific version.</p><ul><li><code>Tls13</code>: SSL/TLS protocol version to use for secure connections. Default lets the OS decide, which matches previous behavior.</li></ul><p>Use Tls12 or Tls12And13 if the server requires a specific version.</p><ul><li><code>Tls12And13</code>: SSL/TLS protocol version to use for secure connections. Default lets the OS decide, which matches previous behavior.</li></ul><p>Use Tls12 or Tls12And13 if the server requires a specific version.</p><p><br>Default: <code>0</code><br>Example: <code>Default</code></p> |
| Overwrite : `Boolean`                                 | <p>If set to true, an existing file at the target path will be overwritten during download.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| {% endtab %}                                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| {% endtabs %}                                         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

## Task Result

| Name                | Description                                                       |
| ------------------- | ----------------------------------------------------------------- |
| Success : `Boolean` | <p>Task complete.<br>Example: <code>True</code></p>               |
| FilePath : `String` | <p>Path to created file.<br>Example: <code>C:\temp.txt</code></p> |

## Task Changelog

Changelog for Task Frends.HTTP.DownloadFile.

### \[1.5.0] - 2026-05-13

#### Added

* Added UseProxy, ProxyUrl, ProxyUsername, ProxyPassword, HttpProtocolVersion, and SslProtocolVersion options with proxy handler and protocol configuration support.

### \[1.4.0] - 2026-03-02

#### Added

* Added CertificateStoreLocation option to allow selection between CurrentUser and LocalMachine certificate stores when using certificate authentication.

### \[1.3.0] - 2025-05-15

#### Changed

* Added new Overwrite parameter to control whether the downloaded file should replace an existing one.
* Use the default parameter value ('false') if you want the task to work as before.

### \[1.2.0] - 2025-03-25

#### Changed

* Update packages: System.Runtime.Caching 7.0.0 -> 9.0.3 coverlet.collector 3.1.0 -> 6.0.4 Microsoft.NET.Test.Sdk 16.7.0 -> 17.13.0 MSTest.TestAdapter 2.1.2 -> 3.8.3 MSTest.TestFramework 2.1.2 -> 3.8.3

### \[1.1.0] - 2024-12-30

#### Changed

* Descriptions of ClientCertificate suboptions includes clearer information about usage in terms of different types of ClientCertificate.

### \[1.0.0] - 2023-01-27

#### Added

* Initial implementation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.frends.com/tasks/tasks/http/downloadfile.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
