How to retrieve Collection elements by the Collection's name using headless APIs
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- Using Liferay's headless-delivery API, is it possible retrieve the elements of a Collection (called a ContentSet in APIs) based on the Collection's name?
Environment
Resolution
- Headless Delivery APIs at 2026.q1.0+ can retrieve a collection's elements by its key instead of its ID:
- Liferay creates the key from the collection's title by making it lowercase and replacing spaces with dashes (for example, "My Collection" becomes
my-collection). If another collection in the site already has that key, Liferay adds a numeric suffix.
Additional Information
- Because the key comes from the name, it is the same in every environment where you create the collection with the same title (assuming no duplicate titles), so you can store it in an environment variable. Renaming the collection generates a new key.
- You can also use External Reference Codes (ERCs) as stable identifiers across multiple environments.
Did this article resolve your issue ?