upload_id, which works wherever an item id or ref does.
A file you have
POST /api/v1/uploadswithfile_name,content_typeandfile_sizereturnsupload_url, valid for one hour, andr2_key. One upload can be up to 5 GB. A larger file can be added by the user through the pageimport_mediareturns inlinkmode.PUTthe bytes toupload_urlwith the same content type and exactlyfile_sizebytes. Any other length is refused.POST /api/v1/uploads/confirmwithr2_key,file_name,file_sizeandcontent_typeturns the file into a library item and returnsupload_idand its type.descriptionsets the item’s description.enrich: truedescribes and tags an image, using cloud processing.made_fromrecords what the file was made from.
A file at a URL
POST /api/v1/uploads/import fetches a public URL into the library in one call, keeping the original bytes. It takes url for one file, or items for up to 20, each with its own file_name, description and made_from. A batch returns results in input order, each with a status of imported, duplicate or failed, and a summary. A failed item is a status in the list, not an error. folder_id accepts an id or a path.
A duplicate, meaning a file the library already holds byte for byte, returns 200 with the existing item and duplicate: true.
The same over the tools
import_media does the same through any interface, in url, file, presign and confirm modes, in link mode for files the user can add from their own device, and through the desktop app in local mode for a path on that computer. See Library.
