The declarative pattern
The fastest way to create a deck is to pass its entire structure — slides, layers, and all — toablo.decks.create() in a single call. The entire tree is saved atomically: either everything is written or nothing is. There is no partial state to clean up if something goes wrong.
The imperative pattern
When you need to add slides or layers after a deck is already created — for example, appending new slides in a loop or reacting to user input — use the individualablo.slides.create() and ablo.layers.create() methods.
Client-minted IDs
All resource IDs are generated on the client side — before the request is sent to the API. This means every ID returned fromdecks.create(), slides.create(), and layers.create() is available synchronously in the returned object without any extra round-trip. You can hold onto a layer ID immediately and use it to push updates in every subsequent run.
Resource fields
DeckResource
id — unique deck identifiertitle — display namelayoutId — applied layout container, or nullthemeId — applied theme, or nullslides — ordered array of SlideResultSlideResource
id — unique slide identifierdeckId — parent decktitle — display nameorder — integer position in the deckLayerResource
id — unique layer identifierslideId — parent slidetype — the persisted layer type (e.g. text, chart, shape)Slide ordering
Theorder field on a slide is an integer that determines where the slide appears in the deck. Slides are sorted ascending by order, so order: 0 is the first slide. When you use the declarative ablo.decks.create(), the SDK assigns order automatically based on the position of each slide in the slides array. When you call ablo.slides.create() imperatively, you supply order yourself — typically set it to the current slide count so the new slide lands at the end.
Slide backgrounds
You set a slide’s background using thebackground field in the slide spec. You can pass a raw CSS string, a hex color, or use the structured background builders exported from @abloatai/decks.
Slide size presets
The default slide canvas is 1920 × 1080 pixels (16:9 widescreen). You can change the size per slide using thesize field, which accepts a preset ID.
| Preset | Dimensions | Aspect ratio |
|---|---|---|
'16:9' (default) | 1920 × 1080 | 16:9 |
'16:10' | 1920 × 1200 | 16:10 |
'a4-portrait' | 2480 × 3508 | A4 portrait |
All layer coordinates — the
x, y, w, and h fields inside at — are expressed in pixels within the slide’s canvas dimensions. For a standard 16:9 slide, that means x and w are in the range 0–1920 and y and h are in the range 0–1080.The coordinate system
Every layer is positioned using anat field that specifies a bounding box in slide-canvas pixels.
(0, 0) is the top-left corner of the slide. On a default 16:9 slide, a layer at { x: 160, y: 120, w: 1600, h: 840 } leaves an 160 px margin on the left and right and sits 120 px from the top. You can also supply an optional rotation in degrees.