Skip to content

Variables

Search and update design variables within a collection.

Type reference
// Search and update variables within a collection. collectionId is required on all methods.
// Use variable_collections to create full token sets (collection + modes + variables in one call).
// ---
// query: prefix match first, then substring. "bg/" matches bg/canvas, bg/surface, etc.
// valuesByMode: values keyed by mode name. On create, value sets all modes; on update, value sets the default mode only.
// Aliases: {type: "VARIABLE_ALIAS", name: "other/variable"}.
// scopes: ALL_SCOPES, TEXT_CONTENT, WIDTH_HEIGHT, GAP, CORNER_RADIUS, ALL_FILLS, FRAME_FILL, SHAPE_FILL,
// TEXT_FILL, STROKE_COLOR, STROKE_FLOAT, EFFECT_FLOAT, EFFECT_COLOR, OPACITY, FONT_FAMILY, FONT_STYLE,
// FONT_WEIGHT, FONT_SIZE, LINE_HEIGHT, LETTER_SPACING, PARAGRAPH_SPACING, PARAGRAPH_INDENT

5 methods available.

Search variables within a collection

ParameterTypeRequiredDescription
collectionIdstringCollection ID or name
querystringSearch query — prefix match first, then substring fallback
type"COLOR" | "FLOAT" | "STRING" | "BOOLEAN"Filter by variable type
fieldsstring[]Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.
offsetnumberSkip N items for pagination (default 0) (default: 0)
limitnumberMax items per page (default 100) (default: 100)

Response

FieldTypeDescription
totalCountnumberTotal matching items
returnednumberItems in this page
offsetnumber
limitnumber
itemsobject[]
namestring
typestringCOLOR | FLOAT | STRING | BOOLEAN
valuesByModeobjectValues keyed by mode name
scopesstring[]
descriptionstring

Get variable detail by name

ParameterTypeRequiredDescription
namestringVariable name (unique within collection)
collectionIdstringCollection ID or name
fieldsstring[]Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass ["*"] for all.

Response

FieldTypeDescription
namestring
type"COLOR" | "FLOAT" | "STRING" | "BOOLEAN"
collectionIdstringCollection display name
valuesByModeobjectValues keyed by mode name (e.g. "Light", "Dark")
descriptionstringVariable description
scopesstring[]Where this variable can be applied

Create variables in a collection. Use valuesByMode for per-mode control, or value to set all modes at once.

ParameterTypeRequiredDescription
collectionIdstringCollection ID or name
itemsobject[]Array of variables to create
namestringVariable name (must be unique within collection)
type"COLOR" | "FLOAT" | "STRING" | "BOOLEAN"Variable type
valueanySets all modes to this value. Use valuesByMode for per-mode control.
valuesByModeobjectValues keyed by mode name (e.g. {"Light": "#FFF", "Dark": "#111"}). Takes precedence over value.
descriptionstringVariable description
scopesstring[]Restrict where variable can be applied (default: ALL_SCOPES)

Response

FieldTypeDescription
resultsobject[]One entry per input item
namestringName of the created variable

Update variable metadata and/or set values

ParameterTypeRequiredDescription
collectionIdstringCollection ID or name
itemsobject[]Array of variable updates
namestringVariable name
renamestringRename the variable
descriptionstringSet description
scopesstring[]Update scopes
valueanyShorthand — sets the default mode value. Use valuesByMode for multi-mode.
valuesByModeobjectValues keyed by mode name. Takes precedence over value.

Response

FieldTypeDescription
resultsany[]Array of "ok" or {error} per item

Delete variables

ParameterTypeRequiredDescription
collectionIdstringCollection ID or name
namestringVariable name
itemsobject[]Batch: [{name}, ...]
namestring

Response

FieldTypeDescription
resultsstring[]Array of "ok" per item