Web SDK Reference Guide

Miro Web SDK Reference Guide v1 -> v2

If your app currently uses the Miro Web SDK v1, it’s time to plan your migration to v2. The Miro Developer Platform 2.0 has reworked and improved the Web SDK, focusing on performance and reliability, as well as the developer experience. This document will outline the changes in certain data objects, and in how those objects relate to others. For a higher-level explanation of these changes, be sure to check out the comparison guide.

window.miro

The window.miro object continues to be the root object of the Web SDK, serving as the main entry point to the SDK methods. All methods in this reference guide are referred to by their hierarchy following window.miro._______.

Boards

At first glance, much of the v1 board object has changed. Despite this, working with a board object in the Miro Web SDK v2 should feel familiar. The structure of the board object is fundamentally the same between v1 and v2. While many methods were renamed for improved clarity, they behave in the same manner as in v1.

Creating a widget / item

The most significant change for board objects in the v2 Web SDK is the replacement of the board.widgets.create method with individual constructors for each widget type.

In the Miro Web SDK v1, the widget methods were polymorphic – meaning that one method was used to interact with all potential widget types. The structure of the call would differ depending on what type of widget you were creating or updating. In the v2 SDK, we have replaced this with an independent constructor for each widget type. Widgets are now referred to as "items" and each item exists as its own object, rather than as a property of the board.

The new item constructors should feel familiar to you, as they were designed to mostly follow the structure of the type-specific payloads of the previous board.widgets.create() call. The following table provides a map of the v1 board.widgets.create call for each supported widget type and its equivalent v2 item constructor.

Widget creation in v1Item creation in v2
Not available in v1

AppCard

board.createAppCard({
    title: "Hello, app card",
    description: "This is a description"
})

Card

board.widgets.create({
    type: "card", 
    title: "Hello, card"
})

Card

board.createCard({
    title: "Hello, card"
})

Embed

board.widgets.create({
    type: "embed", 
    html: "miro.com/blog"
})

Embed

board.createEmbed({
    url: "https://www.miro.com/blog"
})

Emoji
Note that emoji widgets were only partially supported in v1. The default smiley-face can be created, but the code property was read-only, and so no other emoji could be specified.

board.widgets.create({
    type: "emoji"
})
Not currently available in v2

Frame

board.widgets.create({
    type: "frame", 
    title: "Hello, frame"
})

Frame

board.createFrame({
    title: "Hello, frame"
})

Image

board.widgets.create({
    type: "image", 
    title: "Hello, image", 
    url: "miro.com/logo"}
)

Image

board.createImage({
    title: "Hello, image", 
    url: "miro.com/logo"
})

Line

board.widgets.create({
    type: "line", 
    startWidgetId: "[[id]]", 
    endWidgetid: "[[id]]"
})

Lines are not currently supported in the Miro v2 Web SDK. This is a known issue. If you’d like updates on this feature, please subscribe by voting on the feature request in our roadmap.

Preview creation was not supported in v1.

Preview

board.createPreview({
    url: "https://miro.com"
})

Shape

board.widgets.create({
    type: "shape", 
    text: "Hello, shape",
    style: {
        shapeType: "star"
    }
})

Shape

board.createShape({
    content: "Hello, shape",
    shape: "star"
})



Sticker

board.widgets.create({
    type: "sticker", 
    text: "Hello, world"
})

Sticky Note

board.createStickyNote({
    content: "Hello, world"
})

Text

board.widgets.create({
    type: "text", 
    text: "Hello, words"
})

Text

board.createText({
    content: "Hello, words"
})

Board properties

The table below provides a side-by-side comparison of each board property in the v1 and v2 Web SDKs. The majority of the properties supported in v1 have been removed, and so we have tried to provide the reasoning behind those removals.

board properties in v1

board properties in v2

board.ui served as the namespace for the methods that interact with the Miro board’s user interface.

board.ui continues to serve this same function in v2.

board.viewport served as the namespace for the methods that interact with the current viewport.

board.viewport continues to serve this same function in v2.

board.widgets served as the namespace for all CRUD operations on board items.

This has been removed as a property in v2, as explained above. Board items now exist as their own objects, separate from the board object.

board.tags served as the namespace for the methods for interacting with tags on a board.

This has been removed as a property in v2, as explained below. Tags now exist as their own objects, separate from the board object.

board.info served as the namespace for methods related to getting board information.

However, there was only one supported method in this namespace: board.info.get().

This has been removed in v2, as there is not a need for a dedicated namespace for board information.

Board information can now be retrieved using the board.getInfo() method.

board.selection served as the namespace for methods that interacted with the selection of certain widgets on the board.


This has been removed in v2, as the v2 Web SDK does not support the programmatic selection of items.

The current user selection can be retrieved using the board.getSelection() method.

board.utils served as the namespace for utility methods for a board.

However, there was only one supported method in this namespace: board.utils.unionWidgetBounds().

This has been removed in v2, as there is not a need for a dedicated namespace for board utility functions.

Specifically, a bounds object is no longer a property of board items, rendering the v1 utility method obsolete.

Board metadata / storage

In the v1 Web SDK, board.metadata supported two experimental methods. Metadata was also sometimes referred to as "storage" and provided developers with a way to write a key-value data object into local storage.

Both of these endpoints have been upgraded and are now fully-supported in v2, and have been renamed for clarity.

The table below provides a side-by-side comparison of the usage of each method.

v1 methodv2 method
board.metadata.update("key", "value")
board.setAppData("key", value)
board.metadata.get("key")
board.getAppData("key")

BoardUI

When building the v2 SDK, we decided to rethink the way we expose extension points. As a result of this design choice, we have removed several extension points that were available in v1.

Currently, developers building applications with the Miro v2 Web SDK have two options available: the app panel ("Panel") and the pop-up modal ("Modal"). The bottom bar and the left sidebar are no longer available.

The table below shows the board.ui endpoints from v1 and their v2 counterparts, if available.

board.ui in v1

board.ui in v2

board.ui.openLibrary(
    "show-this-page-in-the-library.html", 
    { title: "The library!" }
)
board.ui.openPanel({
    url: 'show-this-page-in-the-panel.html'
})
board.ui.closeLibrary()
board.ui.closePanel()
board.ui.openModal(
    "show-this-page-in-the-modal.html", 
    { 
        width: 400, 
        height: 400 
    }
)
board.ui.openModal({
    url: 'show-this-page-in-the-modal.html',
    width: 600,
    height: 400,
    fullscreen: false,
})
board.ui.closeModal()
board.ui.closeModal()
board.ui.openLeftSidebar(
    "show-this-page-in-the-sidebar.html"
)
Not currently available in v2.
board.ui.closeLeftSidebar()
Not currently available in v2.
board.ui.openBottomPanel(
    "show-this-page-in-the-bottom-bar.html", 
    {
        width: 200,
        height: 200,
    }
)
Not currently available in v2.
board.ui.closeBottomPanel()
Not currently available in v2.

board.ui.resizeTo() provided a way to resize the current iframe inside of the bottom bar.

This method has been removed in v2, as the bottom bar is not currently available.

We will be adding new extension points over time, and we will continue to share updates as we consider the design implications of each new option. There are several feature requests already noted on our roadmap, and we encourage you to add your votes and subscribe to future updates. You’re also welcome to raise any questions or concerns in our developer Discord or on our community forum.

Viewport

In both the v1 and v2 Web SDKs, board.viewport serves as the namespace for the collection of methods that interact with the current viewport. The viewport endpoints are largely unchanged, with one major exception: the three methods for controlling the zoom level of a viewport in v1 are no longer supported in v2.

See the table below for a full side-by-side comparison of each board.viewport method and its usage across both v1 and v2.

board.viewport in v1

board.viewport in v2

board.viewport.get()



board.viewport.get()

This method and its response are both unchanged between the v1 and v2 SDKs.

board.viewport.getViewport()

Note that this method is functionally equivalent to board.viewport.get() and was already deprecated in v1.

board.viewport.get()




board.viewport.set({
    x: x-coordinate,
    y: y-coordinate,
    height: height-of-viewport,
    width: width-of-viewport
})



board.viewport.set({
    x: x-coordinate,
    y: y-coordinate,
    height: height-of-viewport,
    width: width-of-viewport
})

This method is unchanged between the v1 and v2 SDKs.

board.viewport.zoomToObject(myShape.id)







board.viewport.zoomTo(myShape)

In the v2 Web SDK, zoomToObject has been renamed to zoomTo.

In addition, where the v1 zoomToObject required the object’s ID as a String parameter, zoomTo requires one or more item objects as a parameter.

board.viewport.setViewportWithAnimation(
    viewport: {
        x: x-coordinate,
        y: y-coordinate,
        height: height-of-viewport,
        width: width-of-viewport
    },
    animationTimeInMs: 1000
)




board.viewport.set(
    viewport: {
        x: x-coordinate,
        y: y-coordinate,
        height: height-of-viewport,
        width: width-of-viewport
    },
    animationDurationInMs: 1000
)

To set the viewport with an animation in v2, include the option animationDurationInMs parameter when calling board.viewport.set().

board.viewport.setZoom(percentage)
Not available in v2
board.viewport.getZoom()
Not available in v2
board.viewport.getScale()
Not available in v2

Widgets / Items

In the Miro Web SDK v1, the widget methods were polymorphic – meaning that one method was used to interact with all potential widget types. The structure of the call would differ depending on what type of widget you were creating or updating. In the v2 SDK, we have replaced this with independent endpoints for each item type. Widgets are now referred to as "items" and each item exists as its own object, rather than as a property of the board object.

widgets.update() and the new sync() method

Every item type has a sync() method. All item updates are now handled through [item].sync() rather than board.widgets.update(). For more information on the sync() method and an explanation of its usage, please refer to this guide.

The following table shows an example of updating the title of a card item in both v1 and v2.

Updating widgets in v1Updating items in v2
board.widgets.update({
    id: myCard.id,
    title: "New Card Title"
})
myCard.title = "New Card Title"
myCard.sync()

board.widgets endpoints

With the removal of the board.widgets property in the v2 Web SDK, the methods contained in the boards.widget namespace have moved to the board object in v2. The board.widgets.create() and board.widgets.update() methods are discussed separately in this guide, but the remaining methods can be found in the table below, side-by-side with their v2 counterparts.

v1 widget methodsv2 equivalents
board.widgets.get()











board.get()

or

board.getById()

The v2 SDK offers the same support as the v1 SDK for fetching items. The response can be all of the items on the board, one item specifically, or a subset of items matching a particular set of filters. Filters include item type, associated tags, etc. For more examples and a full reference of possible filters, please see the Web SDK reference documentation.

board.widgets.bringForward(myWidget.id)



board.bringToFront(myItem)

Note that where v1 required the object’s ID as a parameter, v2 requires one or more item objects as a parameter.

board.widgets.sendBackward(myWidget.id)



board.sendToBack(myItem)

Note that where v1 required the object’s ID as a parameter, v2 requires one or more item objects as a parameter.

board.widgets.deleteById(myWidget.id)



board.remove(myItem)

Note that where v1 required the object’s ID as a parameter, v2 requires the item object as a parameter.

board.widgets.images.get()

board.get({
    type: image
})
board.widgets.areAllWidgetsLoaded()
Not available in v2
board.widgets.transformDelta()
Not available in v2

Widget / Item properties

In the v2 Web SDK, each item type has its own defined set of properties, directly applicable to that item. These properties would include data unique to the item, such as the type of shape, or style options like color choices. Other properties are universal to all item types, such as geometry or positioning information.

The table below enumerates the various item properties as they exist in both v1 and v2, beginning with the universal properties, and then moving into type-specific properties.

Widget properties in v1Item properties in v2
Basic information
  • id

  • id
  • parentId
  • createdUserId
  • lastModifiedUserId


  • createdBy
  • modifiedBy
  • createdAt
  • modifiedAt
  • groupId
  • capabilities
  • clientVisible
  • metadata
  • scale
Not available in v2
Geometry / Position information
  • bounds
    • x- and y- coordinates
    • height and width
    • bottom and top
    • left and right
  • rotation


  • x- and y- coordinates
  • origin
  • height and width
  • rotation

Note that the bounds object is no longer available in v2.
origin is new in v2 and denotes both the origin point for positioning and the pivot point for rotation.

Type-specific information

Card

  • type: card
  • title
  • description
  • date
  • assignee
  • tags
  • style
    • backgroundColor
  • card
    • customFields
    • logo

Card

  • type: card
  • title
  • description
  • dueDate
  • assignee.userId
  • tagIds
  • style
    • cardTheme

Note: although the card property is not supported in the v2 SDK, you can create a custom card with AppCard.

Embed

  • type: embed
  • html


Embed

  • type: embed
  • url
  • previewUrl
  • mode

Frame

  • type: frame
  • title
  • childrenIds
  • style
    • backgroundColor
  • frameIndex


Frame

  • type: frame
  • title
  • childrenIds
  • style
    • fillColor

Note that frameIndex is not available in the v2 SDK, and that style.backgroundColor has been renamed to style.fillColor

Image

  • type: image
  • title
  • url

Image

  • type: image
  • title
  • url

Line

  • type: line
  • captions
  • endPosition
  • endWidgetId
  • startPosition
  • startWidgetId
  • style
    • lineColor
    • lineEndStyle
    • lineStartStyle
    • lineStyle
    • lineThickness
    • lineType

Lines are not currently supported in the Miro v2 Web SDK. This is a known issue. If you’d like updates on this feature, please subscribe by voting on the feature request in our roadmap.

Preview

  • type: preview
  • url

Preview

  • type: preview
  • url

Shape

  • type: shape
  • text - supports basic HTML
  • plainText - content without HTML tags
  • style
    • shapeType
    • backgroundColor
    • fontFamily
    • fontSize
    • textAlign
    • textAlignVertical
    • textColor
    • backgroundOpacity
    • borderColor
    • borderOpacity
    • borderStyle
    • borderWidth
    • bold
    • highlighting
    • italic
    • strike
    • underline

Shape

  • type: shape
  • content
  • shape
  • style
    • fillColor
    • fontFamily
    • fontSize
    • textAlign
    • textAlignVertical

Note that `style.shapeType` in v1 is now `shape` in v2. The property has been renamed, and moved out of the `style` object. `text` has been renamed to `content` and `plainText` has been removed from v2. Also, `style.backgroundColor` has been renamed to `style.fillColor`. Borders, text color, and text emphasis are not yet available in v2.





Sticker

  • type: sticker
  • text - supports basic HTML
  • plainText - content without HTML tags
  • tags
  • style
    • stickerType: square or rectangle
    • stickerBackgroundColor
    • textAlign
    • textAlignVertical
    • fontFamily
    • fontSize






Sticky Note

  • type: sticky_note
  • content
  • tagIds
  • shape: square or rectangle
  • style
    • fillColor
    • textAlign
    • textAlignVertical

Note that text has been renamed to content and plainText has been removed from v2.
Also, style.stickerType in v1 is now shape in v2. The property has been renamed, and moved out of the style object.
style.fontFamily and style.fontSize for sticky notes are no longer supported in v2.
style.stickerBackgroundColor has been renamed to style.fillColor

Text

  • type: text
  • text
  • style
    • backgroundColor
    • backgroundOpacity
    • fontFamily
    • textAlign
    • textColor
    • padding
    • borderColor
    • borderOpacity
    • borderStyle
    • borderWidth
    • bold
    • highlighting
    • italic
    • strike
    • underline

Text

  • type: text
  • content
  • style
    • fillColor
    • fillOpacity
    • fontFamily
    • fontSize
    • textAlign

Note that `text` has been renamed to `content`. `style.backgroundColor` and `style.backgroundOpacity` have been renamed to `style.fillColor` and `style.fillOpacity` Padding, borders, text color and emphasis are not yet supported in v2.




"Unsupported" item types

For board items that are not yet supported in the Miro v2 Web SDK, there is an unsupported item type, which serves as a catch-all object. It does not offer any item-specific properties, but it does have a sync() method. This allows applications to interact with unsupported board objects, including moving or relocating these objects.

Currently, the following item types are not yet supported in the v2 SDK.

We will be adding new item types over time, and we will continue to share updates as we make progress. There are several feature requests already noted on our roadmap, and we encourage you to add your votes and subscribe to future updates. You’re also welcome to raise any questions or concerns in our developer Discord or on our community forum.

Tags

As with the v1 board.widgets property, board.tags is no longer a supported property in the v2 SDK. Tags now exist as their own object, rather than as a property of the board object.

Creating a tag

Although tags are not considered to be items on a Miro board, the new item constructor approach has also been used to create a tag constructor. A side-by-side comparison of the v1 and v2 constructions can be found in the table below.

Tag creation in v1Tag creation in v2
board.tags.create({
    title: "Hello, tag", 
    color: "yellow"
})
board.createTag({
    title: "Hello, tag", 
    color: "yellow"
})

Updating a tag

Similar to items, tag objects each have a sync() method. All tag updates are now handled through [tag].sync() rather than board.tags.update(). For more information on the sync() method and an explanation of its usage, please refer to this guide.

The following table shows an example of updating a tag in both v1 and v2.

Updating tags in v1Updating tags in v2
board.tags.update({
    id: myTag.id,
    title: "New Tag Title"
})
myTag.title = "New Tag Title"
myTag.sync()

Working with tags

Aside from the new create and update implementations, tags are similar across the v1 and v2 SDKs. The most significant change lies in how tags and items are associated. In the v1 Web SDK, a tag was assigned to a widget by adding the widget’s ID to the tag object. In the v2 Web SDK, this has been reversed to the more intuitive approach, where a tag’s ID is added to an item object.

For this, and other side-by-side comparisons of tags across v1 and v2, see the table below.

Tag properties

  • id
  • title
  • color
  • widgetIds





Tag properties

  • type: tag
  • id
  • title
  • color

Note that the v2 SDK introduces the type: tag property, but removes the widgetIds property. Instead, tag and item associations can be found in the tagIds property of the item.

board.tags.get()







board.get({type: "tag"})

Note: because the tag objects in v2 no longer include the widgetIds property, this is not a full equivalent of the v1 board.tags.get() method. This approach will still return an array of all of the tags on the board.
However, there is not currently a way to get all of the items that have been tagged. This is a known issue.

board.tags.delete(myTag.id)
board.remove(myTag)

Info

In the Miro v1 Web SDK, board.info served as the namespace for methods related to getting board information. However, there was only one supported method in this namespace: board.info.get().
This has been removed in v2, as there is not a need for a dedicated namespace for board information.

Board information can now be retrieved using the board.getInfo() method, as shown in the table below. Unfortunately, the v2 board info object is pretty bare compared to its v1 counterpart. This is a known issue, and the board info objects have been included in the table below for clarity.

Board Info in v1Board Info in v2
board.info.get()
board.getInfo()

Board Info object properties

  • id
  • title
  • description
  • owner
  • picture
  • currentUserPermissions
  • lastModifyingUser
  • lastViewedByMeDate
  • modifiedByMeDate
  • createdAt
  • updatedAt

Board Info object properties

  • id
  • createdAt
  • updatedAt










Selection

In the v1 Web SDK, board.selection served as the namespace for methods that interacted with the selection of certain widgets on the board. This property has been removed in v2, as the v2 Web SDK does not support the programmatic selection of items. However, the current user selection can be retrieved using the board.getSelection() method.

The table below provides a side-by-side comparison of the v1 board.selection property and its v2 counterpart (if available).

Selections in v1Selections in v2
board.selection.get()
board.getSelection()
board.enterSelectWidgetsMode()
Not available in the v2 Web SDK
board.selection.selectWidgets(myWidget.id)
Not available in the v2 Web SDK
board.selection.clear()
Not available in the v2 Web SDK

Utils

In the v1 Miro Web SDK, board.utils served as the namespace for utility methods for a board. This property has been removed in v2, as there is not a need for a dedicated namespace for board utility functions.

Specifically, in the v1 SDK, there was only one supported method in this namespace: board.utils.unionWidgetBounds(). With v2, the bounds object is no longer a property of board items, rendering the sole utility method obsolete.

v1v2
board.utils.unionWidgetBounds()
Not available in the v2 Web SDK

Users and Accounts

The v1 Web SDK offered several endpoints for working with users and accounts, including the UserInfo object, Account Info object, and several methods, including:

  • .account.get()
  • .currentUser.getScopes()
  • .currentUser.isSignedIn()
  • .currentUser.getCurrentBoardPermissions()
  • .currentUser.getCurrentAccountPermissions()
  • .currentUser.isMemberOfCurrentAccount()

None of these are available in the Miro v2 Web SDK. When building the v2 platform, all enterprise methods have been moved to the REST API. The Web SDK will no longer offer any endpoints that require a Team or Organization authorization scope.

However, applications can still retrieve the context and information of the current authenticated user by using board.getUserInfo(). An example of this method, and its v1 counterpart, is provided in the table below.

v1v2
.currentUser.getId()




board.getUserInfo()

Note that while the v1 method returns the user ID of the current user, the v2 board.getUserInfo() method returns a user object containing the user ID.

Experimental methods

Some of the experimental methods from the v1 Web SDK are now fully supported in v2. For those that were not upgraded to become permanent parts of the v2 platform, we have removed the methods from our SDK. This is an attempt to clean up erroneous code, and to ensure a consistent developer experience.

The removed methods are listed below.

  • board.__getParamsFromURL()
  • board.widgets.__blinkWidget()
  • board.widgets.__getIntersectedObjects()
  • board.getOnlineUsers()
  • board.comments.get()

If any of these methods were critical to your v1 application, or if you have any other questions or concerns, please reach out. You can post in our community forum, start a discussion in our developer Discord, or suggest and vote on new features in our public roadmap.


Did this page help you?