> For the complete documentation index, see [llms.txt](https://docs.digitalriver.com/commerce-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalriver.com/commerce-api/admin-apis/file-management/downloading-a-file.md).

# Downloading a file

Easy access to files is essential for seamless operations. Whether you're handling important documents, images, or software packages, having a straightforward method to download files can significantly enhance efficiency. The Commerce API offers a simple yet powerful endpoint that allows users to download files securely and efficiently. Using the [`GET /files/{fileId}/content`](https://docs.digitalriver.com/commerce-api-references/admin-apis/file-management/retrieve-a-file) request, where you replace `{fileId}` with the actual identifier of the file you wish to download, you can retrieve the content of a specific file by its unique identifier. This guide will walk you through the steps to use a cURL command to download a file using your API key and site ID, ensuring a smooth and secure file transfer process.

Here's an example CURL command to achieve this:

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

```http
curl --location --request GET 'https://api.digitalriver.com/files/{fileId}/content' \
--header 'authorization: Basic YOUR_API_KEY' \
--header 'x-siteid: YOUR_SITE_ID'

```

{% endtab %}

{% tab title="200 OK response" %}

```json
{
  "id": "9e00869b-e2f5-4663-aacb-e33687466020",
  "fileName": "File Name"
}
```

{% endtab %}
{% endtabs %}

Be sure to replace `YOUR_API_KEY` with your actual API key and `YOUR_SITE_ID` with your site ID. Also, replace `{fileId}` with the specific file ID you are trying to download.

Refer to the [Downloading the invoice](/commerce-api/admin-apis/order-management/downloading-the-invoice.md) section for more detailed information.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.digitalriver.com/commerce-api/admin-apis/file-management/downloading-a-file.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
