Liferay’s REST APIs provide services for Liferay’s navigation menus. You can create and edit navigation menus with the API. Start by seeing an example of adding a new navigation menu.
Note
Liferay DXP 2025.Q2+ The Navigation Menus API now uses External Reference Codes (ERCs) to reference these elements, enabling consistent identification across instances and supporting batch export/import for improved content management and portability.
Important
Liferay 2026.Q1+The Navigation Menu endpoints moved fromheadless-deliverytoheadless-admin-site to better align with site-scoped operations and batch processing.
Deprecation: The headless-delivery endpoints are deprecated. Existing integrations continue to work for backward compatibility. Use the headless-admin-site API for new integrations.
ERC requirement: The new endpoints identify sites and navigation menus by external reference codes (ERCs).
Batch support: The headless-admin-site API supports Batch Engine import and export for navigation menus.
docker run -it -m 8g -p 8080:8080 liferay/dxp:2025.q1.6-lts
Sign in to Liferay at http://localhost:8080 using the email address test@liferay.com and the password test. When prompted, change the password to learn.
Use the cURL script to add a new navigation menu to your Site. On the command line, navigate to the curl folder. Execute the NavigationMenus_POST_ToSites.sh script with your site ID as a parameter.
./NavigationMenus_POST_ToSites.sh 1234
The JSON response shows a new navigation menu has been added:
Go to the Navigation Menus application by navigating to Administration Menu → Site Builder → Navigation Menus. See that a new navigation menu has been added.
The REST service can also be called using the Java client. Navigate out of the curl folder and into the java folder. Compile the source files with the following command:
javac -classpath .:* *.java
Run the NavigationMenus_POST_ToSites class with the following command. Replace the siteId value with your site ID:
The endpoint shown above uses the deprecated headless-delivery path for backward compatibility. For new integrations on 2026.Q1+, use the headless-admin-site endpoint instead.
Note
Basic authentication is used here for demonstration purposes. For production, you should authorize users via OAuth2. See Using OAuth2 to Authorize Users for a sample React application that uses OAuth2.
The other cURL commands use similar JSON arguments.
Calls the navigationMenuResource.postSiteNavigationMenu method and passes the data to post.
Note that the project includes the com.liferay.headless.delivery.client.jar file as a dependency. You can find client JAR dependency information for all REST applications in the API explorer in your installation at /o/api.
Note
The main method’s comment demonstrates running the class.
The other example Java classes are similar to this one, but call different NavigationMenuResource methods.
The Navigation Menus API supports batch export and import for migrating site navigation menus and related entities across Liferay instances. You can include associated permissions, apply user-defined filters based on creation/modification dates or other attributes, and configure how creator data is handled during import requests.
For details on using the batch engine, see Exporting and Importing Data using the Batch Engine API.
Manage navigation menu permissions using these API endpoints. Replace ${1} with the site ID or navigation menu ID in the examples.
Create Navigation Menu with Permissions
Assign custom permissions during creation by sending a POST request to the navigation menu endpoint. The specified roles must already exist in the system. If a specified role does not exist, the API returns a 404 error.
If you omit the permissions array, the navigation menu is created with default permissions.
If you include the permissions array, Liferay applies the specified roles and actions during creation.
This retrieves only navigation menus with Main in the name.
Export filtered navigation menus using the postSiteNavigationMenusPageExportBatch endpoint. Use the same filter syntax to limit which menus are included in the export file:
When importing navigation menus, you can use the importCreatorStrategy and creatorStrategy query parameters to control how creator information is handled.
Parameter
Description
creatorStrategy=INSERT
Adds a new user as the creator if the specified creator is missing in the target system. Required when using importCreatorStrategy=KEEP_CREATOR.
importCreatorStrategy=KEEP_CREATOR
Keeps the original creator from the exported data. The import fails if the creator does not exist unless creatorStrategy=INSERT is also set.
importCreatorStrategy=OVERWRITE_CREATOR
Replaces the original creator with the importing user. All imported navigation menus are assigned to the user performing the import. Defaults to this if omitted.
This website uses cookies and similar tools, some of which are provided by third parties (together “tools”). These tools enable us and the third parties to access and record certain user-related and activity data and to track your interactions with this website. These tools and the informationcollected are used to operate and secure this website, enhance performance, enable certain website features and functionality, analyze and improve website performance, and personalize user experience.
If you click “Accept All”, you allow the deployment of all these tools and collection of the information by us and the third parties for all these purposes.
If you click “Decline All” your IP address and other information may still be collected but only by tools (including third party tools) that are necessary to operate, secure and enable default website features and functionalities. Review and change your preferences by clicking the “Configurations” at any time.
Visit our Privacy Policy