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.getVariable(id)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
Variables & CollectionsVariablesCreating & Retrieving Variables

Get variable by ID

Was this page helpful?
Previous

Set variable value

Next
Built with

collection.getVariable(id)

Retrieve a variable by its ID.

Syntax

1collection.getVariable(id: VariableId): Promise<null | Variable>

Parameters

  • ID : string - ID of the variable you’d like to retrieve

Returns

Promise<Variable | null>

A promise that resolves to a Variable object, or null if not found

Example

1// Get Collection
2const collection = await webflow.getDefaultVariableCollection()
3
4// Get variable by ID
5const variableById = await collection?.getVariable('id-123')
6console.log(variableById)

Try this example

Designer Ability

Checks for Authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canReadVariablesAnyAnyAnyAny