Upload an image
upload_mediaUpload an image to the media library from a local file path or public URL, returning a usable asset URL for article featured images.
Instructions
Upload an image to the Site's media library and return the asset with a usable url, which you can then set as an article's featured_image_url. Give it either a local file path or a public source_url. It drives the whole three step upload for you: reserve, transfer the bytes, register the asset. Changes content on the customer's Site. Nothing becomes public: an asset is only visible where you attach it. Needs a secret key (wv_sk_) carrying the media:write scope.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucket | No | Which library the asset belongs to. Defaults to blog-images. | |
| alt_text | No | Accessibility text. Worth sending. It is what screen readers announce and what search engines read, and there is no way to generate it for you. | |
| file_name | No | The filename to store it under. Taken from the path or URL when omitted. | |
| file_path | No | Absolute path to an image on this machine. Give either this or source_url. | |
| source_url | No | Public https URL to fetch the image from. Give either this or file_path. | |
| content_type | No | The image type. Guessed from the filename when omitted. It is a hint either way: the API reads the real type from the bytes and refuses anything that is not an allowed image. |