Import image into assets
upload_assetImport an image into the project's asset library, optimized. Provide EXACTLY ONE of sourceUrl (an http(s) URL the worker fetches) or base64Data (raw base64 image bytes, requires mimeType). Returns the stored asset { id, name, url, type, metadata }; use the returned url as a section media.src. Asset names are unique within a project, so the stored name gets a short tag from the file's content, and optimized images are stored as .webp: rely on the returned name and url, not the requested filename. There is no replace-in-place: to swap an image, upload a new one and repoint media.src. An Unsplash photo (an images.unsplash.com url from search_stock_images) is NOT copied: pass its url as sourceUrl and its stock.downloadLocation, and the tool only reports the use to Unsplash and returns { url, hotlinked: true } to set as media.src as is.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | Desired filename, e.g. 'hero.jpg'. Names are unique within a project: the stored name gets a short content tag and optimization may store it as .webp, so use the returned asset name/url. Ignored for an Unsplash photo. | |
| mimeType | No | Image MIME type, e.g. 'image/jpeg'. Required with base64Data; for sourceUrl it is derived from the response. | |
| optimize | No | Optimize/convert before storing (recommended). Default true. | |
| projectId | Yes | The project ID | |
| sourceUrl | No | Public http(s) URL of the image to import. The worker fetches the bytes. Provide this OR base64Data, not both. Preferred for anything larger than ~5MB. | |
| base64Data | No | Raw base64 image bytes (NOT a data URL). Requires mimeType. Provide this OR sourceUrl, not both. Capped at ~5MB decoded; use sourceUrl for larger images. | |
| downloadLocation | No | For an Unsplash photo from search_stock_images: its stock.downloadLocation. Unsplash asks to be told when one of its photos is used. |