Skip to main content
Ablo’s SDK provides a built-in image upload API so you can host images alongside your presentation content without running your own storage. You call ablo.images.upload() with raw bytes and a MIME type, and the SDK uploads the file to Ablo’s hosted storage on your behalf. You get back a CDN URL that you can drop straight into any image() layer or { type: 'image', url } layer definition.

The upload method

Parameters: Returns:
Your organisation is derived from your API key server-side. You never need to pass an organizationId.

Supported MIME types

The contentType field must be one of the following values (the ImageMime type):
Passing any other value will throw a validation error before the network request is made.

Reading from the filesystem (Node.js)

Use readFileSync to load the file into a Buffer, then wrap it in Uint8Array before passing it to upload().

Reading from a browser File input

In the browser, convert the File to an ArrayBuffer using file.arrayBuffer(), then pass it directly — no Uint8Array wrapper needed.
The browser’s File.type property is a string, so you will need to cast it to ImageMime. If you want runtime safety, validate it against the IMAGE_MIME_TYPES array exported from @abloatai/decks before the upload call.

Using an existing public URL

If your image is already publicly accessible on the internet, you do not need to upload it at all. Pass the URL directly to the image() builder or inline { type: 'image', url }. Ablo will auto-rehost it at render time if needed.
Prefer ablo.images.upload() for assets under your control — it guarantees the image is durably stored alongside your presentation and won’t break if the origin goes down.

Uploading before creating a deck

You can upload images before you begin building your deck, then reference the returned URLs inside decks.create(). This is useful when you have multiple images to upload in parallel.

Scoping uploads to a deck

Pass deckId to associate the upload with a specific deck. This scopes the stored file under that deck, making it easier to reason about which assets belong to which presentation.