Skip to Content
DocumentationFiles and media URLs

Files and media URLs

Media inputs are URLs inside a model’s input object. Use public HTTPS URLs that the upstream provider can fetch without cookies, authorization headers, or an interactive login.

{ "model": "nano-banana-2", "input": { "prompt": "Replace the background with a clean studio wall", "imageUrls": ["https://cdn.example.com/source.png"] } }

The exact field name and maximum number of files vary by model. Use that model’s parameter table rather than assuming a media field is universal.

Input checklist

  • Return the file body directly, not an HTML preview page.
  • Keep the URL reachable for the entire generation.
  • Use the media type and size accepted by the selected model.
  • Avoid short-lived signed URLs unless their expiry exceeds processing time.

Generated files

Successful media tasks return API Stock storage URLs in data.files:

{ "files": [ { "fileUrl": "https://s3.api-stock.com/generated/result.png", "fileType": "image" } ] }

Download results as soon as the task becomes finished and copy assets you need to storage you control.

Retention and the two clocks

  • Task details and links: for standard accounts, cleanup runs after 3 days from task creation (createdTime in the task-status response). Processing time is included; completion, polling and downloads do not restart this clock. After cleanup, task status is expired and its files are no longer returned.
  • Generated files: storage schedules deletion 3 days after the file is uploaded, rounded up to the next midnight UTC. This starts separately from task creation. A longer task-history allowance does not extend file storage.

Cleanup is asynchronous. A URL may still open after its scheduled expiry; that does not promise continued storage. Do not rely on an exact deletion second or a specific HTTP status such as 404 at the deadline.

URLs inside output that point to a provider’s CDN have that provider’s lifetime. Copy those assets too if you need them. These rules describe ordinary media-generation results; separately saved Agent files follow the Agent storage rules.