How long will the video link expired?

Hi there,

I’ve generated some videos few days ago, and saved the video url to database, but the link expired today. How long will the video link expired?

BTW, I’m using the stage environment for now, does that make a difference on the link expiration?

Hi @Lane,

Hosting and serving rendered videos can be done in two ways:

Types of hosting storage

  1. Temporary storage (url property in edit api response)
  2. CDN (via the serve API)

Temporary storage

Available for 24 hours and is then deleted. This does not impact your storage.

CDN

Available until you delete the asset via the Serve API. Optimised for streaming. This does impact your storage allowance.

Changing temporary URL to CDN URL

In terms of your videos. It may be the case you are using the temporary URL that has since expired.

You can retrieve the serve urls using the Serve API or change the owner and uuid parameter of the existing URL you are using:

Temporary url
https://shotstack-api-stage-output.amazonaws.com/hwxmtow4o5/d2b46ed6-998a-4d6b-9d91-b8cf0193a655.mp4

CDN url
https://cdn.shotstack.io/au/stage/hwxmtow4o5/d2b46ed6-998a-4d6b-9d91-b8cf0193a655.mp4

1 Like

Videos generated by the API are stored temporarily for 24 hours and are available for you to download to your own hosting provider if you chose to do so.

In the background, every video created, is also copied to our hosting service which is behind a global CDN. Depending on the size of the file it can take several seconds to copy the file to the CDN. That is why we provide hosting as a separate service.

There are a couple of workflows you can follow - polling or webhooks.

Polling

  • Submit your render to the Edit API /render endpoint
  • Poll the edit API /render/{{RENDER_ID}} status endpoint
  • When the status is done start polling the Serve API using the render ID like this:
    https://api.shotstack.io/serve/{{ENV}}/assets/render/{{RENDER_ID}}
  • When the status is ready, you know that the asset has been copied and you can use it in your application.

Note: if you created thumbnails and poster images, each asset has it’s own status and they may complete at different times. Parse the response to see which assets have completed.

Webhooks

  • Submit your render to the Edit API /render endpoint, with a callback URL pointing to your webhook endpoint.
  • Receive the webhook callback when the render is complete - you might want to ignore this.
  • Receive the webhook callback for each asset once it is copied to the hosting/CDN. The file is now ready so you can use the URL in the webhook body and serve the files.

Webhooks is the recommended approach as it it removes the need to poll either API.

The process is documented in the hosting and serving assets section of our website here: https://shotstack.io/docs/guide/serving-assets/hosting

1 Like

Thank you very much. That works for me!

2 Likes