Introduction Stay organized with collections Save and categorize content based on your preferences.
The Google Slides API lets you create and modify Google Slides presentations.
Apps can integrate with the Google Slides API to create beautiful slide decksautomatically from user- and system-provided data. For example, you coulduse customer details from a database and combine them with predesignedtemplates and selected configuration options to create finished presentationsin a fraction of the time it would take to create them manually.
Overview of the API
Thepresentations collection providesmethods that let you get and update elements within the presentation.
Most of your work with the Slides API will probably be creating and updatingpresentations. You'll do this using thebatchUpdate method;this method takes a list ofRequestobjects that let you do things like:
- Create slides
- Add elements to slides such as shapes or tables
- Insert, change, and remove text
- Apply transforms to elements
- Change the order of slides
SeeBatch updates for more details. See the Get Started guidesfor a simple end-to-end example of how to use the API.
The structure of a presentation
A presentation in the Slides API is made up of pages, which contain pageelements.
The ID of a presentation can be derived from the URL:
https://docs.google.com/presentation/d/presentationId/edit
The presentation ID is a string containing letters, numbers, and some specialcharacters. The following regular expression can be used to extract thepresentation ID from a Google Sheets URL:
/presentation/d/([a-zA-Z0-9-_]+)
If you're familiar with the Drive API, thepresentationIdcorresponds to the ID of theFileresource.
Pages and page elements are identified by object IDs.
Pages
Google Slides has the following kinds of pages:
| Masters | Slide masters define the default text styles, background, and page elements that appear in all of the slides that use this master. Page elements that must appear on all slides should be added to the master. Most presentations have one master, but some may have several or none. |
| Layouts | Layouts serve as a template for how page elements will be arranged by default on slides using a layout. Each layout is associated with one master. |
| Slides | These pages contain the content you are presenting to your audience. Most slides are based on a master and a layout. You can specify which layout to use for each slide when it is created. |
| Notes | These pages contain the content for presentation handouts, including a a shape that contains the slide's speaker notes. Each slide has one corresponding notes page. Only the text in the speaker notes shape can be modified with the Slides API. |
| Notes masters | Notes masters define the default text styles and page elements for all notes pages. Notes masters are read-only in the Slides API. |
Page elements
Page elements are the visual components that are placed on pages. The APIexposes several kinds of page elements:
| Group | A set of page elements that are treated as an individual unit. They can be moved, scaled, and rotated together. |
| Shape | A plain visual object, such as rectangles, ellipses, and text boxes. Shapes can contain text, so they are the most common page elements to build slides. |
| Image | A graphic imported into Slides. |
| Video | A video imported into Slides. |
| Line | A visual line, curve, or connector. |
| Table | A grid of content. |
| WordArt | A visual text element that behaves more like a shape. |
| SheetsChart | A chart imported into Slides from Google Sheets. |
Batch updates
ThebatchUpdate methodlets you update many aspects of a presentation. Changes are grouped together ina batch so that if one request fails, none of the other (potentially dependent)changes are written.
ThebatchUpdate method works by taking one or moreRequestobjects, each one specifying a single kind of request to perform. There aremany different kinds of requests. Here's a breakdown of the types of requests,grouped into different categories.
ThebatchUpdate method returns aresponse body,which contains aResponsefor each request. Each response occupies the same index as the correspondingrequest; for requests with no applicable response, the response at that indexwill be empty. The variousCreate requests normally do have responses, sothat you know the ID of the newly added object.
Working with object IDs
A presentation in the Slides API is made up ofpages andpage elements. These objects include anobject ID string that is uniquewithin a presentation.
Specifying object IDs on creation
When creating pages or page elements using thebatchUpdatemethod, you can optionally specify an object ID for the new object. This letsyou create an object and modify it within the same batchUpdate request,minimizing the number of calls to the Slides API and reducing
quota usage.
They must start with an alphanumeric character ([a-zA-Z0-9])or an underscore (“_”). Subsequent characters can bealphanumeric, or underscores, dashes (“-”), or colons (“:”).
We recommend generating a random object ID in most cases. For example, if youare using Java,java.util.UUID.randomUUID().toString() should work well.
When your application wants to keep track of objects over a longer period oftime, don't rely on the object ID, because it may change. See the followingsection for more details.
Keeping track of objects without using the object ID
When you make a Slides API request, the object ID is normallypreserved. (Any exceptions are called out in the method's referencedocumentation.) Making a copy of a whole presentation with theDrive API also preserves object IDs.
However, you cannot depend on an object ID being unchanged after a presentationis changed in the Slides UI. For example, if someone uses theSlides UI to copy-paste a page element and then deletes theoriginal, the page element will now have a new unique ID, and the ID youpreviously provided through the API will be lost. As a result, we don'trecommend you store object IDs in your application's storage. Instead, youshould find objects in the presentation by its text content or alt-text.
Some actions, especially manual editing using the SlidesUI, can change object IDs. So in the longer term, keep track of objects usingtheir text content.Newly created presentations normally use a consistent set of IDs for defaultslides, masters, and text boxes. These IDs are subject to change over time,so we don't recommend that you rely on this feature. Instead, find the elementsyou'd like to modify using the presentation object returned by calls tocreate() orget().
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-11 UTC.