Add the #DF24 Developer Keynote to your agenda. Join us in-person on 9/18 at 2:30 p.m. PT or on Salesforce+ at 5 p.m. PT for the must-see session built just for developers.

generateUrl

Generates and returns a URL for downloading a file in an LWR site in Experience Cloud.

recordID—(Required) The record ID of the file (ContentDocument, ContentVersion, Attachment, or Document) to be downloaded.

A URL for downloading a file.

Authenticated users can download files they have access to. Guest users can download only ContentDocument files that they have access to through Library membership.

This code sample generates a URL for downloading a file.