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.