Skip to content

Document

Navigate and manage Figma pages (canvases) in the document.

Type reference
// A Figma document contains pages — each page is an independent canvas with its own node tree.
// The "current page" is where all node operations happen. Use document.set to switch pages before working with nodes.
// Page IDs look like "0:1", "1:1", etc. The first page is always "0:1".
// get returns the current page with its top-level children as stubs. list returns all pages in the document.

5 methods available.

Get current page with top-level children

No parameters.

Response

FieldTypeDescription
idstring
namestring
backgroundColorstringCanvas background hex color (e.g. "#F5F5F5")
childrenarray

Get document name and list all pages

No parameters.

Response

FieldTypeDescription
namestringDocument name
currentPageIdstring
pagesobject[]
idstring
namestring

Switch to a page by ID or name. At least one of pageId or pageName must be provided.

ParameterTypeRequiredDescription
pageIdstringPage ID
pageNamestringPage name (case-insensitive, substring match)

Response

FieldTypeDescription
idstring
namestring

Create a new page

ParameterTypeRequiredDescription
namestringPage name (default: 'New Page')

Response

FieldTypeDescription
idstringNew page ID

Rename a page

ParameterTypeRequiredDescription
newNamestringNew page name
pageIdstringPage ID (default: current page)

Response

FieldTypeDescription
resultstringString result