Search code examples
vimeovimeo-api

Get a non-expiring video file URL using Vimeo API


On a Vimeo PRO account, I have no problem getting a video file URL, ie https://player.vimeo.com/external/12345.sd.mp4?s=12345&profile_id=165&oauth2_token_id=12345

My problem is that the oauth2_token_id on the above video URL was generated by the Vimeo API and i'm afraid it will expire someday and I'd like to know how long the link is valid for because i want to avoid having to send too many requests to the Vimeo API just to get a refreshed video file URL.

Any guidance is greatly appreciated!

Note: I am aware i can get a "direct link" using Vimeo's platform but I need to do it via the API (direct link: https://help.vimeo.com/hc/en-us/articles/224823567-Direct-links )


Solution

  • The direct video file links provided by the API under the "files" key do not expire. Those links are HTTP 302 redirects to the actual video file resource, the location of which does expire every few hours. Always use those direct links exactly as they are served from the API; those links are the same as the direct links provided on the video's settings page on Vimeo.