Programmatically saving a URL to Dropbox

// By Jennifer Lee • Jun 12, 2015

We've recently introduced a new feature to the Dropbox API: /save_url. This new endpoint lets app developers upload files to Dropbox by just providing a URL, without having to download the file first. It's analogous to the Dropbox Saver but works without any user interaction.

To try out /save_url, you'll first need an OAuth access token, as you would to use any Core API endpoint. There are a number of ways to obtain an access token, and our OAuth guide will help you get started.

Once you have an access token, calling /save_url is quite simple. Using curl:

curl https://api.dropbox.com/1/save_url/auto/images/downloaded.png \
-d url="https://dl.dropboxusercontent.com/s/deroi5nwm6u7gdf/advice.png" \
-H "Authorization: Bearer <ACCESS TOKEN>"

Note that the destination path is part of the URL. In the above case, it's /images/downloaded.png. The file to download is specified in the url form post parameter. The response will be JSON that looks like this:

{"status": "PENDING", "job": "PEiuxsfaISEAAAAAAADw7g"}

The job ID can be used to periodically check a save URL job's status using the /save_url_job endpoint. For example:

curl https://api.dropbox.com/1/save_url_job/PEiuxsfaISEAAAAAAADw7g \
-H "Authorization: Bearer <ACCESS TOKEN>"

Like /save_url, the response from a call to /save_url_job contains the current job status: 

{"status": "DOWNLOADING"}

When the job is completed successfully, the status field of the dictionary will have the value COMPLETE.

For the full details of /save_url and /save_url_job, please refer to the save url API documentation.


// Copy link