The define API lets you create a presentation programatically and add it to the current user's Slides account. Presentations you create can include any of the content types that the Slides editor supports. You can even include live data from other sites via iframes.
For example, if you operate a web-based charting service, you can let your users create a presentation containing their fully interactive charts at the click of a button.
If the user isn't already signed in to Slides, they will automatically be prompted to authenticate or sign up. Once signed in, they are able to review the deck and confirm that they want to save it to their account. Here's what that process looks like:
JSON Examples
Here's the bare minimum JSON you'll need to describe a deck.
{
"title": "My Deck",
"slides": [
{ "html": "<h1>Slide 1</h1>" },
{ "html": "<h1>Slide 2</h1>" }
]
}
If you want to group multiple slides into one vertical stack you can nest them in an array:
{
"title": "My Deck",
"slides": [
{ "markdown": "# Slide 1" },
[
{ "markdown": "# Vertical Slide 2.1" },
{ "markdown": "# Vertical Slide 2.2" }
],
{ "markdown": "# Slide 3" }
]
}
To preserve an editable relationship between multiple blocks, use a group block with a nested blocks array. Groups can be nested up to six levels deep. Coordinates for all nested blocks remain relative to the slide, not to their parent group.
{
"title": "Grouped content",
"slides": [
{
"blocks": [
{
"type": "group",
"x": 100,
"y": 80,
"width": 600,
"height": 320,
"blocks": [
{
"type": "text",
"x": 100,
"y": 80,
"width": 300,
"value": "Grouped title",
"format": "h2"
},
{
"type": "image",
"x": 450,
"y": 80,
"width": 200,
"height": 200,
"value": "https://example.com/image.png"
}
]
}
]
}
]
}
The following JSON demonstrates most of the available options.
Note that there are three different ways to define slide content, blocks, HTML and Markdown. The benefit of using content blocks is that the elements you define are separately editable inside of the Slides editor. If you specify content as a string of HTML or Markdown, it will all be grouped into one element and edited as a text box.
{
"title": "My Deck",
"description": "Description of My Deck.",
"width": 1024,
"height": 576,
"auto-slide-interval": 0,
"slide-number": false,
"loop": false,
"theme-color": "white",
"theme-font": "overpass",
"transition": "slide",
"slides": [
{
"id": "an-optional-slide-id",
"background-color": "#cccccc",
"background-image": "https://static.slid.es/images/screenshots/v1/slides-homepage-1440x900.png",
"background-size": "cover",
"notes": "My speaker notes",
"blocks": [
{
"type": "text",
"value": "Hello world!",
"format": "h2"
},
{
"type": "image",
"value": "https://static.slid.es/images/screenshots/v1/slides-homepage-1440x900.png"
},
{
"type": "iframe",
"value": "https://slides.com/news/make-better-presentations/embed"
},
{
"type": "table",
"data": [
["A","B","C"],
[ 1, 2, 3 ]
]
}
]
},
{
"background-image": "https://static.slid.es/images/screenshots/v1/slides-homepage-1440x900.png"
},
{
"html": "<h1>HTML Slide</h1>"
},
{
"markdown": "**Markdown** slide! <https://daringfireball.net/projects/markdown/syntax>"
}
]
}
JSON Spec
Deck Properties
|
title
String
|
The title of the presentation. Appears anywhere the deck is listed on slides.com.
|
|
description
String
Optional
|
A short description of the presentation. Appears anywhere the deck is listed on slides.com.
|
|
width
Integer
|
The presentation width in pixels. Defaults to 960. We automatically scale content up or down to fit any display.
|
|
height
Integer
|
The presentation height in pixels. Defaults to 700. We automatically scale content up or down to fit any display.
|
|
visibility
String
Optional
|
Determines who this deck is visible to.
| Value |
Description |
| all |
Publicly visible to anyone. |
| self |
Only visible to the signed in user. Requires a paid account. |
| team |
Only visible to the user's team members. Requires a Team account. |
|
|
auto-slide-interval
Integer
Optional
|
Optionally make the presentation auto-slide. This value is defined in milliseconds and defaults to 0 (no autosliding).
|
|
slide-number
Boolean
Optional
|
Flags if a slide number should show the current slide number when viewing the presentations. False by default.
|
|
loop
Boolean
Optional
|
Flags if the last slide of the presentation should loop back to the first. False by default.
|
|
css
String
Optional
|
Additional CSS to include in the presentation. Learn more about custom CSS.
|
|
theme-id
String
Optional
|
The ID of a theme to apply to the presentation. This theme must be owned by the team the signed in user are a member of. If this value is not provided, the default theme is used.
|
|
theme-color
String
Optional
|
Presentation color. Available options:
| Value |
Description |
| white-blue |
White background, black text, blue links (default). |
| black-blue |
Black background, white text, blue links. |
|
|
theme-font
String
Optional
|
Presentation fonts. Open the Slides editor "Style" panel for previews. Available options:
| Value |
Font style |
| montserrat |
sans-serif (default) |
| asul |
semi-serif |
| helvetica |
sans-serif |
| josefine |
sans-serif |
| league |
sans-serif |
| merriweather |
sans-serif |
| news |
sans-serif |
| opensans |
sans-serif |
| overpass |
sans-serif |
| palatino |
serif |
| quicksand |
sans-serif |
| sketch |
Sans-serif |
|
|
transition
String
Optional
|
The transition to use when moving between slides.
| Value |
Description |
| slide |
Slide between slides (default). |
| none |
No transition at all. |
| fade |
Fade slides in and out. |
| concave |
Slide between slides with a concave 3D effect. |
| convex |
Slide between slides with a convex 3D effect. |
|
|
slides
Array
|
Each record in this array represents a slide. You can group multiple slides in a nested array to create vertical stacks, like this:
[ "slide 1", ["slide 2.1", " slide 2.2" ], "slide 3" ]
|
Slide Properties
|
id
String
Optional
|
A unique identifier for the slide. This id can be used used for internal links. Should only contain alphanumerics, dashes, and underscores.
|
|
background-color
String
Optional
|
Slide background color. Supports all CSS color formats, like red or #ff0000.
|
|
background-image
String
Optional
|
URL to a background image. Supported formats: JPG, PNG, GIF and SVG.
|
|
background-size
String
Optional
|
Controls the sizing of a background image. Options:
| Value |
Description |
| cover |
Covers the full page regardless of aspect ratio by allowing cropping (default). |
| contain |
As large as possible without cropping. |
|
|
notes
String
Optional
|
Plain text speaker notes that will appear when presenting this deck. Maximum length is 10000 characters.
|
|
html
String
Optional
|
Custom HTML that should be added to the slide. The HTML will be placed into a content block and centered on the slide. Note that we strip out all scripts, style tags and external stylesheets.
|
|
markdown
String
Optional
|
Markdown content that should be added to the slide. The HTML output will be placed in a content block and centered on the slide.
|
|
blocks
Array
Optional
|
An array of content blocks. Blocks are automatically placed in a column at the center of the page.
|
|
auto-animate
Boolean
Optional
|
Enables automatic animations between this slide and adjacent slides with the same property set. Elements are automatically matched and animated based on their content and position. See reveal.js Auto-Animate documentation for more details.
|
|
auto-animate-easing
String
Optional
|
CSS easing function for auto-animate transitions on this slide (e.g., ease, ease-in-out, cubic-bezier()).
|
|
auto-animate-duration
Float
Optional
|
Duration of auto-animate transitions in seconds.
|
|
auto-animate-unmatched
Boolean
Optional
|
Determines whether elements with no matching auto-animate target should fade in. Set to false to make them appear instantly. Defaults to true.
|
|
auto-animate-restart
Boolean
Optional
|
When set to true, prevents auto-animation between the previous slide and this one, effectively starting a new auto-animate sequence.
|
Block Properties
Properties available for all content blocks.
|
type
String
|
The type of content you want to insert.
|
|
x
Integer
Optional
|
The horizontal position of the block in pixels. If this value is not defined, we will automatically place it at the center of the slide.
|
|
y
Integer
Optional
|
The vertical position of the block in pixels. If this value is not defined, we will automatically place it at the center of the slide.
|
|
z
Integer
Optional
|
The z-index (layer depth) of the block. Higher values appear on top of lower values.
|
|
width
Integer
Optional
|
The width of the content block in pixels.
|
|
height
Integer
Optional
|
The height of the content block in pixels. Note that some blocks, like text, ignore this value since height is based on how tall the content is.
|
|
class
String
Optional
|
A class name to apply to the underlying HTML element for targeting with custom styles. Must be a valid CSS class name.
|
|
data
Object
Optional
|
An object of key-value pairs to add as data attributes to the underlying HTML element. For example:
{"foo": "bar"}
Will add data-foo="bar" to the underlying HTML element.
|
|
animation-type
String
Optional
|
Adds an animation to the content block.
| Values |
| fade-in |
| fade-out |
| slide-up |
| slide-down |
| slide-right |
| slide-left |
| scale-up |
| scale-down |
|
|
animation-trigger
String
Optional
|
Determines which interaction that will trigger the animation. Has no effect unless animation-type is set.
| Value |
Description |
| auto |
Animate when the slide becomes visible. |
| click |
Click or tap to click animate. |
| hover |
Hover over the element animate. |
|
|
animation-duration
Float
Optional
|
The number of seconds that the animation should run for.
|
|
animation-delay
Float
Optional
|
The number of seconds to wait before running the animation.
|
|
rotation
Integer
Optional
|
The rotation angle of the block in degrees.
|
|
align-content
String
Optional
|
CSS align-content property for controlling content alignment within the block.
|
|
border-color
String
Optional
|
Border color. Supports all CSS color formats, like red or #ff0000.
|
|
border-width
Integer
Optional
|
Border width in pixels.
|
|
border-style
String
Optional
|
Border style: solid, dashed, dotted, etc.
|
|
border-radius
Integer
Optional
|
Border radius in pixels for rounded corners.
|
|
auto-animate-delay
Float
Optional
|
Delay in seconds before auto-animate transitions for this block.
|
|
auto-animate-duration
Float
Optional
|
Duration in seconds of auto-animate transitions for this block.
|
|
auto-animate-easing
String
Optional
|
CSS easing function for auto-animate transitions (e.g., ease, linear, ease-in-out).
|
|
mix-blend-mode
String
Optional
|
CSS mix-blend-mode property for controlling how the block blends with content below it (e.g., multiply, screen, overlay).
|
|
locked
Boolean
Optional
|
Whether the block is locked from editing.
|
|
flip-x
Boolean
Optional
|
Whether to flip the block horizontally.
|
|
flip-y
Boolean
Optional
|
Whether to flip the block vertically.
|
|
blur-radius
Integer
Optional
|
Blur filter radius in pixels.
|
|
drop-shadow-x
Integer
Optional
|
Horizontal offset of drop shadow in pixels.
|
|
drop-shadow-y
Integer
Optional
|
Vertical offset of drop shadow in pixels.
|
|
drop-shadow-radius
Integer
Optional
|
Blur radius of drop shadow in pixels.
|
|
drop-shadow-color
String
Optional
|
Color of drop shadow. Supports all CSS color formats, like red or #ff0000.
|
|
link
String
Optional
|
URL to link the block to. When clicked, the block will navigate to this URL.
|
Group block
A group block contains a non-empty blocks array of direct child blocks. Child blocks may include other groups, up to six group levels in total. All child x, y, and z values use slide coordinates and layer depth. Optional group geometry is applied to the combined bounds of its children after they are imported.
|
blocks
Array
|
A non-empty array containing the group's direct child blocks. |
Text block
Properties available for the text content block.
|
value
String
|
The string of text to insert.
|
|
format
String
Optional
|
The text format, defined as one of the following HTML tags:
| Value |
Description |
| h1 |
Heading 1 |
| h2 |
Heading 2 |
| h3 |
Heading 3 |
| p |
Paragraph |
| pre |
Preformatted text |
If no format is specified, we pick a good default based on what other blocks there are on the slide. For example, if you have two text blocks we'll use an h1 for the first block and h2 for the second.
|
|
align
String
Optional
|
Left, center, right or justify.
|
|
padding
Integer
Optional
|
The number of pixels to leave empty around the text.
|
|
color
String
Optional
|
The color of table text. Supports all CSS color formats, like red or #ff0000.
|
|
font-size
String
Optional
|
The size of text as a percentage of the default size. For example, 150%.
|
|
text-layout
String
Optional
|
Controls text layout behavior.
| Value |
Description |
| auto-height |
Automatically adjusts height based on content (default). |
| auto-width |
Automatically adjusts width based on content. |
| fixed |
Fixed-size text container. |
|
|
auto-fit-text
Boolean
Optional
|
Whether to automatically scale text to fit within the block.
|
|
align-content
String
Optional
|
Controls the vertical alignment of text within a text block with a fixed text layout: start (top), center, or end (bottom).
|
Image block
Properties available for the image content block.
|
value
String
|
The URL of the image to insert. We support JPG, PNG, GIF and SVG.
|
|
alt
String
Optional
|
Alternative text for the image for accessibility purposes.
|
Iframe block
Properties available for the iframe content block.
|
value
String
|
The HTTPS URL of the web page to embed.
|
Code block
Properties available for the code content block.
|
value
String
|
Code to syntax highlight.
|
|
language
String
|
The language of the code. We use highlight.js for syntax highlighting, you can see which languages they support at highlightjs.org/static/demo.
If no language is specified, highlight.js will automatically try to determine what language it is.
|
|
word-wrap
Boolean
Optional
|
Flags if a code should wrap to new lines. False by default.
|
|
line-numbers
Boolean|String
Optional
|
Controls line number visibility and code highlights.
| Value |
Description |
| true |
Show line numbers (default). |
| false |
Hide line numbers. |
| <string> |
Comma separated list of lines to highlighted. "1,4-8" will highlight line 1 and 4 through 8.
You can add multiple highlight steps by using the | delimiter. "1|2-5|6" will highlight line 1, then highlight lines 2 through 5 and finally line 6.
|
|
|
theme
String
|
The theme to use for syntax highlighting. We support the following themes:
| Value |
Description |
| monokai |
Monokai (default) |
| a11y-dark |
A11y Dark |
| a11y-light |
A11y Light |
| ascetic |
Ascetic |
| darcula |
Darcula |
| far |
Far |
| github-gist |
GitHub Gist |
| ir-black |
Ir Black |
| monokai |
Monokai |
| obsidian |
Obsidian |
| seti |
Seti |
| solarized-dark |
Solarized Dark |
| solarized-light |
Solarized Light |
| sunburst |
Sunburst |
| tomorrow |
Tomorrow |
| xcode |
Xcode |
| zenburn |
Zenburn |
|
|
font-size
String
Optional
|
The size of code text in pixels.
|
|
frame
String
Optional
|
Frame style for the code block.
| Value |
Description |
| none |
No frame (default). |
| osx |
Color frame. |
| osx-grey |
Grey frame. |
|
|
autoheight
Boolean
Optional
|
Whether the code block should automatically adjust its height to fit the content.
|
Table block
Properties available for the table content block.
|
data
Array
Optional
|
Table data in a multidimensional array. Here's an example data set:
[
["A","B","C"],
[ 1, 2, 3 ]
]
This set will generate two rows, each with three columns. A, B, C, will on the first row and 1, 2, 3 will be on the second.
|
|
padding
Integer
Optional
|
Controls the empty spacing around each table cell.
|
|
text-color
String
Optional
|
The text color. Supports all CSS color formats, like red or #ff0000.
|
|
border-width
Integer
Optional
|
The size of the table border in pixels.
|
|
border-color
String
Optional
|
Color of the table border. Supports all CSS color formats, like red or #ff0000.
|
Video block
Properties available for the video content block.
|
value
String
|
The URL of the video file to embed.
|
|
controls
Boolean
Optional
|
Whether to display video playback controls. Default is true.
|
|
autoplay
Boolean
Optional
|
Whether the video should automatically start playing.
|
|
muted
Boolean
Optional
|
Whether the video should be muted by default.
|
|
loop
Boolean
Optional
|
Whether the video should loop when it reaches the end.
|
Math block
Properties available for the math content block.
|
value
String
|
Mathematical equation to render in LaTeX format.
|
|
font-size
String
Optional
|
The scale of the equation text as a percentage.
|
Chart block
Properties available for the chart content block.
|
value
String
|
Chart data in CSV format.
|
|
chart-type
String
Optional
|
The type of chart: column, bar, line, pie, doughnut, polarArea, or radar.
|
|
chart-scales
Boolean
Optional
|
Whether to show chart axis scales.
|
|
chart-legend
Boolean
Optional
|
Whether to show the chart legend.
|
|
chart-legend-position
String
Optional
|
Position of the legend: top, bottom, left, or right.
|
|
chart-begin-at-zero
Boolean
Optional
|
Specifies whether the the chart scale should always start from 0.
|
|
chart-theme
String
Optional
|
Color theme for the chart: vibrant, mono-dark, mono-light, warm, cool, pastel, contrast, earth, neon, or neutral.
|
|
chart-text-color
String
Optional
|
Color of chart text labels. Supports all CSS color formats.
|
|
chart-grid-color
String
Optional
|
Color of chart grid lines. Supports all CSS color formats.
|
Shape block
Properties available for the shape content block.
|
shape-type
String
Optional
|
Type of shape: rect, circle, diamond, octagon, triangle-up, triangle-down, triangle-left, triangle-right, arrow-up, arrow-down, arrow-left, or arrow-right. Defaults to rect.
|
|
fill
String
Optional
|
Fill color of the shape. Supports all CSS color formats.
|
|
stroke-color
String
Optional
|
Stroke color of the shape. Supports all CSS color formats.
|
|
stroke-width
String
Optional
|
Width of the shape's stroke in pixels.
|
|
corner-radius
Integer
Optional
|
Corner radius for rounded rectangles in pixels.
|
Line block
Properties available for the line content block.
|
line-color
String
Optional
|
Color of the line. Supports all CSS color formats.
|
|
line-width
String
Optional
|
Width of the line in pixels.
|
|
line-start-type
String
Optional
|
Type of line ending at the start point: none, line-arrow, arrow, circle, square, or cross.
|
|
line-end-type
String
Optional
|
Type of line ending at the end point: none, line-arrow, arrow, circle, square, or cross.
|
|
line-x1
String
Optional
|
X coordinate of the line's start point.
|
|
line-y1
String
Optional
|
Y coordinate of the line's start point.
|
|
line-x2
String
Optional
|
X coordinate of the line's end point.
|
|
line-y2
String
Optional
|
Y coordinate of the line's end point.
|
|
line-c
String
Optional
|
Controls the curvature of the line. This is an offset from the middle of the line to the outer edge of the arc along the line's perpendicular.
|