# Get download link for Invoices

**URL:** <https://www.dolibarr.org/forum/t/get-download-link-for-invoices/23300>\
**Category:** Developing for Dolibarr\
**Tags:** Help\
**Created:** [January 24, 2023, 9:33am UTC](https://www.dolibarr.org/forum/t/get-download-link-for-invoices/23300 "2023-01-24T09:33:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MatiasCostaN](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@MatiasCostaN](https://www.dolibarr.org/forum/u/MatiasCostaN)\
**Post date:** [January 24, 2023, 9:33am UTC](https://www.dolibarr.org/forum/t/get-download-link-for-invoices/23300/1 "2023-01-24T09:33:45Z")

</div>

Hello community,

Im using REST API to get some info about customers, products and invoices. Everything goes ok but i dont see any information about how to generate a download link for invoices. Is it possible to do it?  
I know there is a variable called \_DIRECTDOWNLOAD\_URL\_INVOICE which need to be 1 (is it already set) but i dont know how call or generate it from API…

Thanks all!

---

<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:** [January 9, 2024, 10:22pm UTC](https://www.dolibarr.org/forum/t/get-download-link-for-invoices/23300/2 "2024-01-09T22:22:46Z")

</div>

@MatiasCostaN did you come right on this?

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [January 10, 2024, 10:46pm UTC](https://www.dolibarr.org/forum/t/get-download-link-for-invoices/23300/3 "2024-01-10T22:46:15Z")

</div>

> [@MatiasCostaN](#):
>
> Im using REST API to get some info about customers, products and invoices. Everything goes ok but i dont see any information about how to generate a download link for invoices. Is it possible to do it?  
> I know there is a variable called \_DIRECTDOWNLOAD\_URL\_INVOICE which need to be 1 (is it already set) but i dont know how call or generate it from API…

You might need to generate the document first if it is not already created. Look at /documents/builddoc in the API explorer.

Other than that I do this all the time, but I need to find my code first, and that will not be today :-/

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [January 12, 2024, 7:59pm UTC](https://www.dolibarr.org/forum/t/get-download-link-for-invoices/23300/4 "2024-01-12T19:59:16Z")

</div>

> [@MatiasCostaN](#):
>
> Im using REST API to get some info about customers, products and invoices. Everything goes ok but i dont see any information about how to generate a download link for invoices. Is it possible to do it?  
> I know there is a variable called \_DIRECTDOWNLOAD\_URL\_INVOICE which need to be 1 (is it already set) but i dont know how call or generate it from API…
> 
> Thanks all!

I have now found the time to lookup what I am doing.

I find the document share hash and append that to an url leading to my dolibarr installation.

I search using module\_part = “order” and order\_id

config.DOLIBARR\_API\_URL + “/documents?modulepart=” + modulepart + ‘&id=’ + str(order\_id)

that gets me a json with 1 or more documents in it.

Then I generate the document to make sure it is there  
and from the document.json I find the share and return that value.

To generate the document I call this url config.DOLIBARR\_API\_URL + “/documents/builddoc” in the API.
