URLDownload
✖
URLDownload
downloads the contents of the specified URLs to files in a local temporary directory.
returns an association of the values of the elements elemi.
Details and Options


- URLDownload[url] creates a local temporary file in the directory $TemporaryDirectory.
- URLDownload[{url1,url2,…}] creates a local temporary directory in $TemporaryDirectory.
- URLDownload[url,…] returns the File[…] object it has created, or a Failure[…] object if the URL is not found or the file cannot be created.
- URLDownload[{url1,url2,…},…] returns a list of File[…] or Failure[…] objects.
- In URLDownload[{url1,url2,…},…], the files created have names generated from retrieved headers or from the final elements of the URL paths urli. If files with the same name already exist, a "-n" suffix is added.
- In URLDownload[req,…] and URLDownload[{req1,req2,…},…], the requests can be HTTPRequest[…] objects or associations giving components and metadata elements, as in URLRead.
- URLDownload takes the following options:
-
Authentication None authentication information to send CookieFunction Automatic function to apply to each cookie received FollowRedirects True whether to follow HTTP redirects Interactive True whether to allow interactive authentication dialogs TimeConstraint Infinity time to wait for a response VerifySecurityCertificates True whether to verify SSL security certificates - TimeConstraint->t allows a maximum of t seconds for connection to the URL and reading from it.
- TimeConstraint-><"Connecting"->tc,"Reading"->tr > specifies separate timeouts for connecting to the URL and reading from it.
- In URLDownload[req,loc,elem], the following elements can be used:
-
"File" file object to read the response body "Headers" list of headers received in the response "Cookies" list of cookies received in the response "ContentType" content type header "StatusCode" status code returned by the server "StatusCodeDescription" plain text description of status code {elem1,elem2,…} an association of the elements elemi Automatic symbolic File object All an association of all elements
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
This saves the content of the URL:

https://wolfram.com/xid/0bzrwo2bv1itropwh-s5iag


https://wolfram.com/xid/0bzrwo2bv1itropwh-2mnal2

Download a file and check the status code returned from the server:

https://wolfram.com/xid/0bzrwo2bv1itropwh-9cj19t

Gather information about a connection:

https://wolfram.com/xid/0bzrwo2bv1itropwh-cun3h9

For more complex requests, use HTTPRequest:

https://wolfram.com/xid/0bzrwo2bv1itropwh-qa561k

Options (4)Common values & functionality for each option
CookieFunction (1)
FollowRedirects (1)
TimeConstraint (1)
Properties & Relations (2)Properties of the function, and connections to other functions
File and CloudObject are fully supported:

https://wolfram.com/xid/0bzrwo2bv1itropwh-f48c8p

Perform an HTTPRequest by using Import or URLExecute:

https://wolfram.com/xid/0bzrwo2bv1itropwh-vijtc7


https://wolfram.com/xid/0bzrwo2bv1itropwh-nb5lmg


https://wolfram.com/xid/0bzrwo2bv1itropwh-mz0qa0

Possible Issues (1)Common pitfalls and unexpected behavior
URLDownload will return a Failure if the host is unable to return a response:

https://wolfram.com/xid/0bzrwo2bv1itropwh-idg9ks


URLDownload will always download the response of the server, even if the "StatusCode" indicates a client or a server error:

https://wolfram.com/xid/0bzrwo2bv1itropwh-le3lgf

Wolfram Research (2016), URLDownload, Wolfram Language function, https://reference.wolfram.com/language/ref/URLDownload.html.
Text
Wolfram Research (2016), URLDownload, Wolfram Language function, https://reference.wolfram.com/language/ref/URLDownload.html.
Wolfram Research (2016), URLDownload, Wolfram Language function, https://reference.wolfram.com/language/ref/URLDownload.html.
CMS
Wolfram Language. 2016. "URLDownload." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/URLDownload.html.
Wolfram Language. 2016. "URLDownload." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/URLDownload.html.
APA
Wolfram Language. (2016). URLDownload. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/URLDownload.html
Wolfram Language. (2016). URLDownload. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/URLDownload.html
BibTeX
@misc{reference.wolfram_2025_urldownload, author="Wolfram Research", title="{URLDownload}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/URLDownload.html}", note=[Accessed: 01-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_urldownload, organization={Wolfram Research}, title={URLDownload}, year={2016}, url={https://reference.wolfram.com/language/ref/URLDownload.html}, note=[Accessed: 01-April-2025
]}