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
    • Variable Modes
  • Assets
      • Get Asset Name
      • Set Asset Name
      • Get Alt Text
      • Set Alt Text
      • Set Asset File
      • Get Asset MIME Type
      • Get Asset URL
      • Get folder of Asset
      • Set folder for Asset
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • asset.getName()
  • Syntax
  • Returns
  • Example
  • Designer Ability
AssetsManaging Assets

Get Asset Name

Was this page helpful?
Previous

Set Asset Name

Next
Built with

asset.getName()

Retrieve name of specified asset.

Syntax

1asset.getName(): Promise<string>

Returns

Promise<string>

A Promise that resolves to the name of the Asset

Example

1// Get Selected Element
2const el = await webflow.getSelectedElement()
3
4// Check if element is selected and its type
5if (!el || el.type !== 'Image') {
6 console.error('Please select an Image element on the canvas')
7 await webflow.notify({
8 type: 'Error',
9 message: 'Please select an Image element on the canvas',
10 })
11} else {
12 const asset = await el.getAsset() // Get Asset
13 const assetName = await asset?.getName() // Get Asset Name
14 console.log(`Asset Name: ${assetName}`)
15}

Try this example

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessAssetsanyanyanyany