Skip to main content

Time-to-live for OTP Validity

By default the OTP validity is set to 6 hours. You can create shorter lived URLs by passing ttl parameter. This value is to be set in seconds.

The ttl value is relevant when there is a time-gap between the website backend requesting the OTP, and the video player loading on client-side. Such a scenario is relevant for users watching videos on very slow connections. We recommend a minimum ttl of 5 minutes. It is unrealistic for any user to be waiting for more than 5 minutes for video player load. Please note that a new OTP is generated when a page is refreshed.

By setting a very long ttl (30 years) you can create a static video URL, that you may use as part of your home page and for non-premium content.

This code below sets the ttl to 5 minutes.

{  "ttl": 300}

Get OTP Sample Code#

The sample videoID is 1234567890 and the API Secret Key is a1b2c3d4e5. The time-to-live for OTP validity is set to 300s in the sample code.

The sample code only passes the OTP time-to-live as parameter.

curl -X POST \  https://dev.vdocipher.com/api/videos/1234567890/otp \  -H 'Accept: application/json' \  -H 'Authorization: Apisecret a1b2c3d4e5' \  -H 'Content-Type: application/json' \  -d '{  "ttl":300}'