Is is possible to get a permanent URL to a file uploaded to Google drive?

I can't find the answer to this in the API docs or elsewhere. I see in the docs says you can get a downloadURL of a file, but it refers to it as a 'short lived URL'. What does that mean?

I need to upload images and get a permanent URL of that image that is the direct URL than can be embedded into emails or web docs etc. Is that possible?



Yes, you can get a permalink to any file hosted on Google Drive in a public folder. Just note the folderID: and paste it to the following URL:<folderID>/<filename> or you can create a short custom alias using G Drives:<alias>/<filename>

downloadUrl is short lived, but webContentLink is a permanent link. It's odd that one is a URL and the other is a "link", but I guess it probably has to do with the additional query params in the strong. Maybe that makes it not just a URL? :)

That property is only available for files that are publically readable, so you may have to use the SDK/API to set the permissions first.

In case someone encounter the same problem and don't want to do with deprecated Google Drive solution above and requires frequently changed files with exact same url, you can use Dropbox. Steps:

  • Download the program and share a folder (tutorial)
  • Copy a file into that folder; wait for sync with Dropbox
  • Go to your account
  • Share your file by button, get something like:
  • Rename it to:

Now you have a public, unchanged url for all your foo.exe changes. Enjoy, don't waste time with sites offering you file hosting and they change the URL for same files.

I don't know how often this changes but I was looking for a dynamic solution where I wouldn't need to manually upload to another site and the provided solutions weren't working.

Here's the url that worked for me:<file_id>

Where file_id is the getId() using the google apps script drive API. Secondly the file must be shared publicly like posted previously

Secondly I imagine the lh3 are different cdn's though I cannot confirm since lh1/2 don't work and everything higher than 3 redirects to lh3

I don't know if such API for google drive exists, but I think you should also have a look at dropbox, which will meet all the demands that you mention in your question.

Also there are some very cool applications developed just for dropbox, like which lets you share links of text, html files, in an html page format.

that + permanent link is always there.

If you share a file publicly in GDrive, you can use the following link to make the file download directly:

The problem happens when you want to change the file (for version controlled download, in instance) and keep the same downloading link.

You can use a URL Shortener like and use a Branded Bitlink to change the destination URL keeping the input URL.

I hope it works, good luck!

You can use, it got updated and now allows users to log in with their google drive account and share the list of files instantly, getting for each file "View" & "Download" short permalink.

There's also the old solution (login to Google Drive, set everything to "Public on web", copy share link, convert it into the textarea in the homepage), but it's just a waste of time, you should try "MyDrive" api.

It seems if you have file ID you can access it with such url:

If file is public, you'll see it immediately but if not, you're be asked to login

Need Your Help

Why is it not a good idea to use SOAP for communicating with the front end (ie web browser)?

javascript soap

Why is it not a good idea to use SOAP for communicating with the front end? For example, a web browser using JavaScript.