Microsoft Visio API Pages API

Operations for listing and managing pages within a Visio document

OpenAPI Specification

visio-pages-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Visio JavaScript Application Pages API
  description: The Visio JavaScript API enables building Office Add-ins that interact with Visio diagrams embedded in classic SharePoint Online pages. The API provides access to document elements including pages, shapes, hyperlinks, comments, shape data items, and shape views. Developers can create visual overlays, register mouse event handlers, read shape text and shape data, and control application settings. The API uses a request context and proxy object pattern with batch execution via Visio.run() and context.sync().
  version: '1.1'
  contact:
    name: Microsoft Office Dev
    url: https://developer.microsoft.com/office
    email: officedevfeedback@microsoft.com
  license:
    name: Microsoft APIs Terms of Use
    url: https://learn.microsoft.com/en-us/legal/microsoft-apis/terms-of-use
  termsOfService: https://www.microsoft.com/en-us/legal/terms-of-use
servers:
- url: https://appsforoffice.microsoft.com/embedded/1.0
  description: Visio Office Add-ins embedded endpoint
security:
- EmbeddedSession: []
tags:
- name: Pages
  description: Operations for listing and managing pages within a Visio document
paths:
  /document/pages:
    get:
      operationId: listPages
      summary: List Pages
      description: Returns all pages in the current Visio document. Each page includes its name, index, background status, and view settings.
      tags:
      - Pages
      responses:
        '200':
          description: Collection of pages
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PageCollection'
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
  /document/pages/{pageName}:
    get:
      operationId: getPage
      summary: Get Page
      description: Returns a specific page from the Visio document by its name. Includes page properties, view configuration, and associated shapes.
      tags:
      - Pages
      parameters:
      - name: pageName
        in: path
        required: true
        description: Name of the Visio page to retrieve
        schema:
          type: string
      responses:
        '200':
          description: Page object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page'
        '404':
          description: Page not found
        '500':
          description: Internal server error
  /document/getActivePage:
    get:
      operationId: getActivePage
      summary: Get Active Page
      description: Returns the currently active page in the Visio document embedded in the SharePoint page. Includes all shapes and view configuration for the page.
      tags:
      - Pages
      responses:
        '200':
          description: Active page object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page'
        '500':
          description: Internal server error
  /document/pages/{pageName}/view:
    patch:
      operationId: updatePageView
      summary: Update Page View
      description: Updates the view settings for a specific Visio page, including zoom level and scroll position.
      tags:
      - Pages
      parameters:
      - name: pageName
        in: path
        required: true
        description: Name of the Visio page
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PageViewUpdate'
      responses:
        '200':
          description: Updated page view
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PageView'
        '404':
          description: Page not found
        '500':
          description: Internal server error
components:
  schemas:
    Page:
      type: object
      description: Represents a page in the Visio document
      properties:
        id:
          type: integer
          description: Numeric page identifier
        name:
          type: string
          description: Name of the page
        index:
          type: integer
          description: Zero-based index of the page in the document
        isBackground:
          type: boolean
          description: Whether this page is a background page
        view:
          $ref: '#/components/schemas/PageView'
        shapes:
          $ref: '#/components/schemas/ShapeCollection'
    PageViewUpdate:
      type: object
      description: Partial update to page view settings
      properties:
        zoom:
          type: integer
          description: Zoom level as a percentage
    PageCollection:
      type: object
      description: A collection of Visio pages
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Page'
    Shape:
      type: object
      description: Represents a shape element on a Visio page
      properties:
        id:
          type: integer
          description: Numeric shape identifier
        name:
          type: string
          description: Name of the shape
        text:
          type: string
          description: Text content displayed inside the shape
        select:
          type: boolean
          description: Whether this shape is currently selected by the user
        view:
          $ref: '#/components/schemas/ShapeView'
        shapeDataItems:
          $ref: '#/components/schemas/ShapeDataItemCollection'
        hyperlinks:
          $ref: '#/components/schemas/HyperlinkCollection'
        comments:
          $ref: '#/components/schemas/CommentCollection'
        boundingBox:
          $ref: '#/components/schemas/BoundingBox'
    PageView:
      type: object
      description: View settings for a Visio page
      properties:
        zoom:
          type: integer
          description: Zoom level as a percentage (e.g. 100 for 100%)
    CommentCollection:
      type: object
      description: Collection of comments on a shape
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Comment'
    BoundingBox:
      type: object
      description: Bounding box coordinates of a shape
      properties:
        x:
          type: number
          description: X coordinate of the top-left corner
        y:
          type: number
          description: Y coordinate of the top-left corner
        width:
          type: number
          description: Width of the bounding box
        height:
          type: number
          description: Height of the bounding box
    Comment:
      type: object
      description: A comment associated with a Visio shape
      properties:
        author:
          type: string
          description: Name of the comment author
        date:
          type: string
          format: date-time
          description: Timestamp when the comment was created
        text:
          type: string
          description: Content of the comment
    Hyperlink:
      type: object
      description: A hyperlink attached to a Visio shape
      properties:
        address:
          type: string
          description: URL or file path the hyperlink points to
        description:
          type: string
          description: Display description for the hyperlink
        subAddress:
          type: string
          description: Sub-address within the target (e.g. page name)
        extraInfo:
          type: string
          description: Additional information passed with the URL
    HyperlinkCollection:
      type: object
      description: Collection of hyperlinks on a shape
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Hyperlink'
    ShapeCollection:
      type: object
      description: A collection of shapes on a Visio page
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Shape'
    Highlight:
      type: object
      description: Highlight decoration applied to a shape
      properties:
        color:
          type: string
          description: CSS color string for the highlight (e.g.
        width:
          type: integer
          description: Width of the highlight border in points
    ShapeView:
      type: object
      description: Visual presentation settings for a shape
      properties:
        highlight:
          $ref: '#/components/schemas/Highlight'
        tooltip:
          type: string
          description: Tooltip text shown on hover
    ShapeDataItemCollection:
      type: object
      description: Collection of data items associated with a shape
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/ShapeDataItem'
    ShapeDataItem:
      type: object
      description: A structured data item (label-value pair) associated with a shape
      properties:
        label:
          type: string
          description: Label or key for the data item
        value:
          type: string
          description: Value associated with the label
        format:
          type: string
          description: Optional display format for the value
        formattedValue:
          type: string
          description: Value after applying the format string
  securitySchemes:
    EmbeddedSession:
      type: apiKey
      in: header
      name: X-Embedded-Session
      description: Visio EmbeddedSession token obtained via OfficeExtension.EmbeddedSession initialization
externalDocs:
  description: Visio JavaScript API Documentation
  url: https://learn.microsoft.com/en-us/office/dev/add-ins/visio/visio-overview