Skip to content
looot docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

media_link

Get a short-lived download link for a file a run produced (audio, image, video, PDF, or a large text or CSV answer).

Some runs produce a file instead of JSON: speech from a text-to-speech tool, a generated image or video, a PDF, a screenshot, or a text or CSV answer larger than 256 KB. looot stores the file and puts a media block on the run result. media_link turns that block into a download link that works with plain curl or fetch, no token, for 15 minutes. Call it again for a fresh link.

Inputs

Argument Type Required Default Limits Meaning
runId string Yes The run that produced the file, from run or runs_list.
mediaId string No the run’s only file Which file, when the run produced several. The error lists the ids.
inline boolean No false png, jpeg, gif or webp up to 200 KB Also return the image itself next to the link. Audio, video and PDF are never inline.

Example call

{
  "runId": "run_aa487ec9cbed4275acda99558ce55349"
}

Example answer

{
  "runId": "run_aa487ec9cbed4275acda99558ce55349",
  "mediaId": "44775a8177a0e58729bc7fabe6193c4b",
  "contentType": "application/pdf",
  "byteLength": 28798,
  "sha256": "9b1f...",
  "expiresAt": "2026-10-31T00:00:00.000Z",
  "downloadUrl": "https://api.looot.ai/v1/media-downloads/run_aa487ec9cbed4275acda99558ce55349/44775a8177a0e58729bc7fabe6193c4b?exp=...&sig=...",
  "downloadUrlExpiresAt": "2026-10-02T00:15:00.000Z",
  "downloadPath": "/v1/runs/run_aa487ec9cbed4275acda99558ce55349/media/44775a8177a0e58729bc7fabe6193c4b",
  "filename": "steel-pdf.pdf"
}

Check the download against sha256. downloadPath works too, with your agent token in the Authorization header. expiresAt is when looot deletes the stored file.

Errors

Code Meaning
run_not_found No run with that id in this workspace.
media_not_found That run has no stored file with that mediaId.
media_id_required The run has several files; call again with one of the listed mediaIds.
media_expired The file passed its retention time. Run the tool again.
media_links_disabled Signed links are off on this gateway; download downloadPath with a token instead.

media_link is free. It never runs a provider and never charges.

Was this page helpful?