For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
        • Create number variable
        • Create color variable
        • Create font family variable
        • Create size variable
        • Create percentage variable
        • Get all variables
        • Get variable by name
        • Get variable by ID
    • Variable Modes
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • collection.getAllVariables()
  • Syntax
  • Returns
  • Example
  • Designer Ability
Variables & CollectionsVariablesCreating & Retrieving Variables

Get all variables

Was this page helpful?
Previous

Get variable by name

Next
Built with

collection.getAllVariables()

Get all variables in a collection

Syntax

1collection.getAllVariables(): Promise<Array<Variable>>

Returns

Promise<Variable>

A Promise that resolves to an array of Variable objects

Example

1// Fetch the default variable collection
2const defaultVariableCollection = await webflow.getDefaultVariableCollection();
3
4if (defaultVariableCollection) {
5
6 // Print Collection ID
7 console.log("Default Variable Collection ID:", defaultVariableCollection.id);
8
9 // Fetch all variables within the default collection
10 const variables = await defaultVariableCollection.getAllVariables();
11
12 if (variables.length > 0) {
13
14 console.log("List of Variables in Default Collection:");
15
16 // Print variable details
17 for (var i in variables) {
18 console.log(`${i}. Variable Name: ${await variables[i].getName()}, Variable ID: ${variables[i].id}`);
19 };
20 } else {
21 console.log("No variables found in the default collection.");
22 }
23} else {
24 console.log("Default Variable Collection not found.");

Try this example

Designer Ability

Checks for Authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canReadVariablesAnyAnyAnyAny