Programmatically download content from share links

A “Dropbox share link” is a link that’s intended to be sent out to another Dropbox user. The URL looks like this picture of me doing my job as a developer advocate: https://www.dropbox.com/s/r3p1au45g3rylvs/advocated.jpeg.

A share link renders a preview of the content and offers options for the user to download or view the actual file. Share links can be created from the Dropbox UI (right-click and select “Share Dropbox Link”), or they can be created using the Core API.

If you have a share link for a file, you can download the file directly by using the ?raw=1 query parameter. For example, here again is me advocating: https://www.dropbox.com/s/r3p1au45g3rylvs/advocated.jpeg?raw=1.

If you just need to download the file once, it’s probably better to use a media link (“direct link” in Chooser terminology), but those links expire after four hours. Converting a share link is useful if you need a more “permanent” download link. I put “permanent” in scare quotes because a user can unshare the file at any time or simply move or delete it, at which point the link will stop working.