Skip to content

Variable Collections

CRUD for variable collections — the document-level API for design tokens.

Type reference
// Variable collections group design tokens and define their modes (e.g. Light/Dark, Desktop/Mobile).
// All ID params accept both IDs and display names.
// ---
// valuesByMode: values keyed by mode name, e.g. {"Light": "#FFF", "Dark": "#111"}.
// Aliases: {type: "VARIABLE_ALIAS", name: "other/variable"}.
// scopes: see variables endpoint for full list.
// Deleting a collection deletes all variables inside it.
// The default mode cannot be removed. Use add_mode/remove_mode for additional modes.

8 methods available.

List variable collections

ParameterTypeRequiredDescription
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[]
idstring
namestring
modesstring[]Mode names
variableCountnumberNumber of variables

Get collection with all variables and values (full document)

ParameterTypeRequiredDescription
idstringCollection 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
idstring
namestring
modesstring[]Mode names (e.g. ['Light', 'Dark'])
variablesobject[]All variables in this collection
namestring
typestringCOLOR | FLOAT | STRING | BOOLEAN
valuesByModeobjectValues keyed by mode name
scopesstring[]
descriptionstring

Create a collection with modes and variables in one call

ParameterTypeRequiredDescription
itemsobject[]Array of collection documents
namestringCollection name
modesstring[]Mode names (e.g. ['Light', 'Dark']). Omit for single-mode collection.
variablesobject[]Variables to create inside this collection
namestringVariable name (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"})
descriptionstring
scopesstring[]Restrict where variable can be applied (default: ALL_SCOPES)

Response

FieldTypeDescription
resultsobject[]One entry per input item
idstring

Rename collections

ParameterTypeRequiredDescription
itemsobject[]Array of {id, name}
idstringCollection ID or name
namestringNew name

Response

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

Delete collections

ParameterTypeRequiredDescription
idstringCollection ID or name
itemsobject[]Batch: [{id}, ...]
idstring

Response

FieldTypeDescription
resultsstring[]Array of "ok" per item

Add a mode to a collection

ParameterTypeRequiredDescription
itemsobject[]Array of {collectionId, name}
collectionIdstringCollection ID or name
namestringMode name

Response

FieldTypeDescription
resultsobject[]One entry per input item
modeIdstring

Rename a mode

ParameterTypeRequiredDescription
itemsobject[]Array of {collectionId, modeId, name}
collectionIdstringCollection ID or name
modeIdstringMode ID or name (e.g. "Dark")
namestringNew name

Response

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

Remove a mode from a collection

ParameterTypeRequiredDescription
itemsobject[]Array of {collectionId, modeId}
collectionIdstringCollection ID or name
modeIdstringMode ID or name (e.g. "Dark")

Response

FieldTypeDescription
resultsstring[]Array of "ok" per item