Some generation tools accept an existing file as input (for example, animating an image into a video clip or transforming a video with a text prompt). To use your own files, upload them through the API first.
The presigned URL goes directly to the storage provider, so no additional authentication is needed for the PUT request. It expires shortly after creation, so upload promptly.
The uploadFile helper handles all three steps in a single call:
Once the file is ready, pass its fileId to any tool that accepts a file input:
The uploadFile helper accepts these options:
Instead of polling for file readiness, you can subscribe to file upload lifecycle webhooks. These are only fired for API uploads.
Register for these events when creating a webhook endpoint:
Each event payload includes a hydrated file object with the latest file state, so no extra API call is needed. See Webhooks guide for details on verifying webhook signatures.