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
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • Using assets on a site
  • Supported file types
  • Properties

Assets

Was this page helpful?
Previous

Create an Asset

Next
Built with

The Asset APIs enable you to manage and interact with your site’s media files through the Designer’s Assets panel.

These APIs let you:

  • Upload new assets to your Webflow site
  • Retrieve existing assets and their metadata
  • Update asset properties like names and alt text
  • Organize assets into folders
  • Get direct URLs to hosted assets

Using assets on a site

To display an asset on a page, you can:

  1. Create or select an asset
  2. Create an image element using the webflow.elementPresets.Image element preset
  3. Set the asset on the image element
  4. Optionally set additional properties like alt text for accessibility

Example

1// Get a file from a remote URL
2const response = await fetch("https://fastly.picsum.photos/id/336/200/300.jpg?hmac=FYvgN5rqQdtTh1q0wSE75sgfBRdhD-qNJwP12mTVXTc")
3const blob = await response.blob()
4const file = new File([blob], "bikelocks.jpg", { type: 'image/jpeg' });
5
6// Create an asset from the file and set alt text
7const asset = await webflow.createAsset(file)
8await asset.setAltText('Candid photo of Marvin the Paranoid Android')
9
10// Get Selected Element
11const selectedElement = await webflow.getSelectedElement()
12if (selectedElement) {
13
14 // Insert Image after selected Element
15 const newImage = await selectedElement.after(webflow.elementPresets.Image)
16
17 // Set the asset on the image element
18 await newImage.setAsset(asset)
19}

Supported file types

The Asset APIs support various file types including images, documents, and Lottie animations. Refer to the accepted MIME types listed below for compatibility. Pass Lottie files as application/json MIME types.

MIME Types
'image/jpeg'
'image/jpg'
'image/png'
'image/gif'
'image/svg+xml'
'image/bmp'
'image/webp'
'application/pdf'
'application/msword'
'application/vnd.ms-excel'
'application/vnd.ms-powerpoint'
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
'text/plain'
'text/csv'
'application/vnd.oasis.opendocument.text'
'application/vnd.oasis.opendocument.spreadsheet'
'application/vnd.oasis.opendocument.presentation'
'application/json'

Files upload to the Assets panel aren’t restricted. They’re publicly available and discoverable, but won’t necessarily be discovered or indexed by search engines if the file isn’t on a publicly viewable webpage or linked elsewhere. Learn more about asset privacy in Webflow.

Properties

PropertyDescription
idUnique identifier of the Asset