# How do you get a link to the pdf in GET /documents/download

**URL:** <https://www.dolibarr.org/forum/t/how-do-you-get-a-link-to-the-pdf-in-get-documents-download/22922>\
**Category:** Developing for Dolibarr\
**Tags:** v15, Question, Help, API, Linux\
**Created:** [October 14, 2022, 6:21pm UTC](https://www.dolibarr.org/forum/t/how-do-you-get-a-link-to-the-pdf-in-get-documents-download/22922 "2022-10-14T18:21:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![his\_africa](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/h/aca169/32.png) [@his\_africa](https://www.dolibarr.org/forum/u/his_africa)\
**Post date:** [October 14, 2022, 6:21pm UTC](https://www.dolibarr.org/forum/t/how-do-you-get-a-link-to-the-pdf-in-get-documents-download/22922/1 "2022-10-14T18:21:08Z")

</div>

I do have an external app to Dolibarr that requires to download a document and do something with the document. However, I am struggling to understand, how does one get the actual link to the PDF via REST API. Below is the response I am getting. Could please anyone help.

 ![image](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/b/ba65abb237252b1266449930b652da04d94920a2.png)

The GET `/documents/download` API documents read like this:

> Note that, this API is similar to using the wrapper link “documents.php” to download a file (used for internal HTML links of documents into application), but with no need to have a session cookie (the token is used instead).

When I am using the internal HTML links, the documents download immediately when I am logged into Dolibarr. IF I am not logged in, Dolibarr prompts for a username and password. How can I simulate the same behaviour as the web browser.

I am able to login using the `/login` api. There is `token` returned in the response. How do I pass this in the subsequent request to Dolibarr?

---

<div class="post-metadata">

**Author:** ![julius](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/ecd19e/32.png) [@julius](https://www.dolibarr.org/forum/u/julius)\
**Post date:** [December 9, 2025, 9:22am UTC](https://www.dolibarr.org/forum/t/how-do-you-get-a-link-to-the-pdf-in-get-documents-download/22922/2 "2025-12-09T09:22:19Z")

</div>

Old topic but the answer is to pass a correct filepath, not only the name.

On the example given above, instead of &orginial\_file=000008 at the en of the URL, it should be **&orginial\_file=000008/000008.pdf**

---

<div class="post-metadata">

**Author:** ![Jayden-Lee](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@Jayden-Lee](https://www.dolibarr.org/forum/u/Jayden-Lee)\
**Post date:** [December 9, 2025, 1:28pm UTC](https://www.dolibarr.org/forum/t/how-do-you-get-a-link-to-the-pdf-in-get-documents-download/22922/3 "2025-12-09T13:28:25Z")

</div>

Use the token from `/login` in the `DOLAPIKEY` header when calling `/documents/download` to access the PDF without logging in.
