跳转到内容

Annotations

读取和管理设计标注及标注分类。

Type reference
// Annotations are designer-authored notes attached to nodes — specs, intent, constraints.
// Every node-returning endpoint includes an annotation brief: { label, properties?, categoryId? }.
// Use this endpoint for full CRUD and to manage annotation categories.
// Workflow: read annotations on a node with get, add new ones with add, manage categories with categories/create_category.
// Batch: get/set/add/remove accept items:[{id, ...}] for multi-node operations, or single-item params (id, label, etc).
// properties: measurement indicators Figma displays on the canvas — validated per node type and state.
// labelMarkdown: rich text label supporting **bold**, *italic*, `code`, [links](url).
// categoryId: group annotations by category (e.g. "Spacing", "Typography"). Create categories first.
// ---
// AnnotationPropertyType values (node-type-dependent — invalid ones are rejected with the available list):
// Dimension: width, height, maxWidth, minWidth, maxHeight, minHeight
// Paint: fills, strokes, effects, strokeWeight, cornerRadius, opacity
// Text (TEXT nodes only): textStyleId, textAlignHorizontal, fontFamily, fontStyle, fontSize, fontWeight, lineHeight, letterSpacing
// Layout (auto-layout only): itemSpacing, padding, layoutMode, alignItems
// Instance (INSTANCE only): mainComponent
// Grid (grid layout only): gridRowGap, gridColumnGap, gridRowCount, gridColumnCount, gridRowAnchorIndex, gridColumnAnchorIndex, gridRowSpan, gridColumnSpan
// AnnotationCategoryColor values: yellow, orange, red, pink, violet, blue, teal, green.

9 methods available.

Read all annotations on a node (full detail with resolved category names)

ParameterTypeRequiredDescription
idstringNode ID
categoryIdstringFilter — only return annotations in this category
itemsobject[]Batch: [{id, categoryId?}, ...]
idstring
categoryIdstring

Response

FieldTypeDescription
resultsobject[]One entry per input item
idstring
namestring
annotationsobject[]
indexnumber
labelstring
labelMarkdownstring
propertiesstring[]
categoryobject
idstring
labelstring
colorstring

Search annotations across a subtree, optionally filtered by category

ParameterTypeRequiredDescription
parentIdstringRoot node to search within (default: current page)
categoryIdstringFilter by category ID
limitnumberMax items per page (default 100) (default: 100)

Response

FieldTypeDescription
resultsobject[]Annotations found across the subtree
nodeIdstring
nodeNamestring
nodeTypestring
indexnumber
labelstring
labelMarkdownstring
propertiesstring[]
categoryobject
idstring
labelstring
colorstring
countnumber
_truncatedboolean

Replace all annotations on a node

ParameterTypeRequiredDescription
idstringNode ID
annotationsobject[]Array of annotation objects to set (replaces all existing)
labelstringPlain text label
labelMarkdownstringRich text label (Markdown)
propertiesstring[]Measurement property types to display
categoryIdstringCategory ID
itemsobject[]Batch: [{id, annotations: [...]}, ...]
idstring
annotationsarrayAnnotations to set on this node

Response

FieldTypeDescription
resultsobject[]One entry per input item
idstring
countnumber

Add an annotation to a node

ParameterTypeRequiredDescription
idstringNode ID
labelstringPlain text label (use label or labelMarkdown, not both)
labelMarkdownstringRich text label with Markdown formatting
propertiesstring[]Measurement property types to display on canvas
categoryIdstringCategory ID to group this annotation
itemsobject[]Batch: [{id, label?, labelMarkdown?, properties?, categoryId?}, ...]
idstring
labelstring
labelMarkdownstring
propertiesstring[]
categoryIdstring

Response

FieldTypeDescription
resultsobject[]One entry per input item
idstring
indexnumber
countnumber

Remove an annotation from a node by index

ParameterTypeRequiredDescription
idstringNode ID
indexnumberAnnotation index to remove (from get response)
itemsobject[]Batch: [{id, index}, ...]
idstring
indexnumber

Response

FieldTypeDescription
resultsobject[]One entry per input item
idstring
removedboolean
countnumber

List all annotation categories in the file

No parameters.

Response

FieldTypeDescription
categoriesobject[]
idstring
labelstring
colorstring
isPresetboolean

Create a new annotation category

ParameterTypeRequiredDescription
labelstringCategory label
color"yellow" | "orange" | "red" | "pink" | "violet" | "blue" | "teal" | "green"Category color

Response

FieldTypeDescription
idstring
labelstring
colorstring

Update an annotation category’s label or color

ParameterTypeRequiredDescription
idstringCategory ID
labelstringNew label
color"yellow" | "orange" | "red" | "pink" | "violet" | "blue" | "teal" | "green"New color

Response

FieldTypeDescription
idstring
labelstring
colorstring

Delete an annotation category

ParameterTypeRequiredDescription
idstringCategory ID to delete

Response

FieldTypeDescription
deletedboolean