Skip to main content
The ablo.decks namespace is the entry point for managing presentation decks. Every method resolves to a single atomic commit on the server, so a create call that includes slides and layers either succeeds completely or fails without partial state. Deck ids are minted client-side before the commit is sent, so you can capture the id immediately and use it in subsequent calls without an extra round-trip.

ablo.decks.create(input?, options?)

Creates a new deck. Pass input.slides to include the complete slide and layer tree in one commit. When omitted, an empty deck is created and slides can be added later via ablo.slides.create.

Parameters

input
CreateDeckInput
The deck configuration. All fields are optional; omit entirely to create a blank deck.
options
RequestOptions
Per-call commit controls.

Returns

id
string
Client-minted UUID for the new deck.
title
string
The deck title ("Untitled" when not supplied).
layoutId
string | null
The layout container id, or null if none was specified.
themeId
string | null
The theme id, or null if none was specified.
slides
SlideResult[]
One entry per slide passed in input.slides, in order.

Example

import { Decks } from '@abloatai/decks';

const ablo = new Decks(process.env.ABLO_API_KEY!);

// Create a deck with two slides and a layer on each
const deck = await ablo.decks.create({
  title: 'Q3 Market Update',
  color: '#4F46E5',
  slides: [
    {
      title: 'Key Metrics',
      layers: [
        {
          type: 'text',
          text: 'Revenue up 40%',
          style: 'h1',
          at: { x: 160, y: 120, w: 1600, h: 160 },
        },
        {
          type: 'bar',
          data: [
            { label: 'Q1', value: 120 },
            { label: 'Q2', value: 180 },
            { label: 'Q3', value: 252 },
          ],
          at: { x: 160, y: 340, w: 900, h: 600 },
        },
      ],
    },
    {
      title: 'Summary',
      layers: [
        {
          type: 'text',
          text: 'Thank you',
          style: 'title',
          at: { x: 400, y: 460, w: 1120, h: 160 },
        },
      ],
    },
  ],
});

console.log(deck.id);                    // deck UUID
console.log(deck.slides[0].layers[0].id); // first layer UUID — save this for later updates

ablo.decks.retrieve(id)

Fetches the stored record for a deck by id. Requires a readable client.

Parameters

id
string
required
The deck id returned by create.

Returns

id
string
The deck UUID.
title
string
The deck title.
layoutId
string | null
The attached layout container id, or null.
themeId
string | null
The attached theme id, or null.

Example

const deck = await ablo.decks.retrieve('deck_abc123');
console.log(deck.title, deck.themeId);

ablo.decks.update(params, options?)

Applies a field-level patch to an existing deck. Only the fields you include are changed; omitted fields are left untouched.

Parameters

params
UpdateDeckParams
required
options
RequestOptions

Returns

id
string
The commit UUID.
status
'queued' | 'confirmed'
The acknowledgement level reached.
lastSyncId
number
Monotonic sync cursor — use this to wait for a specific state in a real-time client.

Example

const receipt = await ablo.decks.update({
  id: 'deck_abc123',
  title: 'Q3 Market Update — Final',
  color: '#10B981',
});

console.log(receipt.status); // 'confirmed'

ablo.decks.delete(id, options?)

Permanently deletes a deck and all of its slides and layers in one atomic commit.

Parameters

id
string
required
The deck id to delete.
options
RequestOptions

Returns

id
string
The commit UUID.
status
'queued' | 'confirmed'
The acknowledgement level reached.
lastSyncId
number
Monotonic sync cursor.

Example

const receipt = await ablo.decks.delete('deck_abc123');
console.log(receipt.status); // 'confirmed'