Skip to main content
The Images API closes the “slides as code” loop for local files. Instead of hosting images externally before referencing them in a slide, you upload the raw bytes through the SDK and get back a CDN URL that you can pass straight to image(url) or use in an imageFill. The SDK uploads the bytes to Ablo’s hosted storage on your behalf — your API key is the only credential required. The returned URL is a stable CDN edge URL that remains valid across subsequent renders.

ablo.images.upload(params)UploadedImage

Uploads image bytes to Ablo’s CDN and returns the hosted URL.
Uint8Array | ArrayBuffer
required
The raw image bytes. Accepts either a Uint8Array (the type you get from fs.readFileSync in Node.js) or an ArrayBuffer.
ImageMime
required
The MIME type of the image. Must be one of the allowed types:Passing an unlisted MIME type throws a validation error before any network request is made.
string
Optional cosmetic file name used to form the S3 key. Does not affect the returned URL. Useful for debugging storage keys.
string
Optional deck id that scopes the storage key. Images uploaded with a deckId are namespaced under that deck in storage. Omitting it still works — the file is stored under a random id.
Returns UploadedImage
string
The CDN URL for the uploaded image. Pass this to image(url), imageFill(url), or use it directly in an { type: 'image', url, at } layer object.
string
The S3 key where the file is stored. Informational — you don’t need this for slide authoring.

Examples

Upload a local file with Node.js

Read a file from disk using fs.readFileSync, then upload it and use the CDN URL as an image layer.

Upload and use with the image() builder

When you’re filling a layout placeholder or using the functional builder style, pass the URL to image().

Upload from a browser File input

In a browser context, read the file as an ArrayBuffer and upload it.