File hydration
Files returned by the VideoGen API include signed URLs for downloading thumbnails, previews, and the full-resolution asset. These URLs expire after a period of time. Hydration generates fresh URLs so you can access the file again.
When to hydrate
File source URLs are time-limited. You need to hydrate a file when:
- The
downloadSource,previewSource, orthumbnailSourceisnull - A source has
status: "pending"(still processing) - A source URL has passed its
expiresAttimestamp - You stored a
fileIdand need to access the file later
Webhook payloads and freshly completed tool executions include hydrated URLs already, so you typically only need to hydrate when accessing files some time after they were created.
Hydrate with the SDK
The getHydratedFile helper checks whether URLs are still valid and only calls the hydrate endpoint when necessary:
TypeScript
cURL
Response
The hydrate endpoint returns the full StorageFile object with populated source URLs:
Each source includes:
Downloading files
The downloadFile helper combines hydration and download into a single call: