Delivering CMS Content to External Applications
Liferay DXP 2026.Q3+ Liferay CMS 2026.Q4+
External applications, such as websites and mobile apps, can read your Liferay Content Management System content through REST or GraphQL APIs. Because CMS content is stored as objects, your content uses the object APIs. Use an OAuth 2 application to authorize each request with only the necessary scopes.
Before you begin, you must have administrator access and a space with content. For demonstration, this article reads CMS Blog entries.
In standalone Liferay CMS, remote access to the headless delivery API (/o/headless-delivery) is off. Here, you use object APIs to read Liferay CMS content.
Creating an OAuth 2 Application
External applications should authorize their requests through an OAuth 2 application. Once authorized, each request returns only the entries that the authorizing user has permission to view. These steps use client credentials, where the application acts as one fixed user.
-
Open the Global Menu (
) and go to Control Panel → OAuth 2 Administration under Security. -
Click New.
-
Set these fields:
- Name: Enter a name for the application.
- Client Profile: Select Headless Server.
- Allowed Authorization Types: Keep Client Credentials selected.
- Client Credentials User: Select a user who can view the content in the spaces the application reads. Requests return only the content that this user can view.

-
Click Save. The Client ID and Client Secret fields appear at the top of the form.
-
Copy the client ID.
-
Click Edit next to the Client Secret field. Copy the client secret from the window that opens and then click Cancel. The token request in Getting an Access Token uses both values.
-
On the Scopes tab, expand the entry for each API the application calls and check read data on your behalf. This table names the entry and the scope for each endpoint:
Endpoint Path Scopes Tab Entry Scope /o/headless-asset-library/v1.0/asset-librariesLIFERAY.HEADLESS.ASSET.LIBRARYLiferay.Headless.Asset.Library.everything.read/o/cms/blogsCMSBLOGcmsblog.everything.read/o/cms/basic-web-contentsCMSBASICWEBCONTENTcmsbasicwebcontent.everything.read/o/cms/basic-documentsCMSBASICDOCUMENTcmsbasicdocument.everything.read/o/c/[plural]C_[STRUCTURE]c_[structure].everything.readFor a custom structure, the scope uses the structure’s name in lowercase, with the
c_prefix. For example, a structure named Recipe usesc_recipe.everything.read. A request to an endpoint whose scope the application doesn’t have returns a403response. -
Click Save.
To deliver content based on each signed-in reader’s roles, authorize requests as that reader with the authorization code flow instead. Browser and native applications use the authorization code flow with PKCE. See Using OAuth 2.0 for more information on OAuth 2 applications and scopes.
Configuring CORS for Your Application
If your application runs in a browser (e.g., a JavaScript frontend on another domain), you must add a CORS entry for the application’s origin. Without it, the browser rejects its API requests:
-
Open the Global Menu (
) and go to Control Panel → System Settings → Security Tools → Portal Cross-Origin Resource Sharing (CORS). -
Click Add.
-
Set these fields:
- URL Pattern: Add patterns that cover the endpoints the application calls, such as
/o/oauth2/token,/o/headless-asset-library/*,/o/c/*,/o/cms/*, and/o/graphql. - CORS Response Headers: Add an
Access-Control-Allow-Originheader with the application’s origin, such asAccess-Control-Allow-Origin: https://www.example.com.
- URL Pattern: Add patterns that cover the endpoints the application calls, such as
-
Click Save.
Keep the client secret on a server. Request the access token from a server-side component, never from browser code.
See Setting Up CORS for information on the other fields in a CORS entry.
Getting an Access Token
To request an access token, you must send the client ID and secret to /o/oauth2/token. This example command requests one:
curl \
"http://localhost:8080/o/oauth2/token" \
--data "client_id=[client-id]&client_secret=[client-secret]&grant_type=client_credentials" \
--header "Content-Type: application/x-www-form-urlencoded" \
--request "POST"
Replace [client-id] and [client-secret] with your OAuth 2 application’s values. Replace http://localhost:8080 with your installation’s address.
The response contains the access token:
{
"access_token": "[access-token]",
"expires_in": 600,
"token_type": "Bearer"
}
Use this access token to authenticate your API requests. Pass it in the Authorization header (e.g., Authorization: Bearer [access-token]). After expires_in seconds, the token expires, and you must request a new one.
The default service access policy for the object APIs rejects unauthenticated requests to the scoped endpoints in this article.
Finding a Space’s Scope Key
The content endpoints take a space’s scope key in their path. To find the scope key, list the spaces:
curl \
"http://localhost:8080/o/headless-asset-library/v1.0/asset-libraries" \
--header "Authorization: Bearer [access-token]"
The response lists each space. This excerpt shows the fields you need:
{
"items": [
{
"id": 36582,
"name": "My Space",
"siteId": 36583,
"type": "Space"
}
]
}
Find the space by its name. Use its siteId as the {scopeKey}, not its id. In this example, the scope key is 36583.
See Asset Libraries API Basics for the other operations on spaces.
Reading Content with REST
Every content structure has dedicated REST endpoints for reading its entries in a space. These are the endpoints for the built-in structures:
GET /o/cms/blogs/scopes/{scopeKey}/approvedGET /o/cms/basic-web-contents/scopes/{scopeKey}/approvedGET /o/cms/basic-documents/scopes/{scopeKey}/approved
A custom structure uses these endpoints:
GET /o/c/[plural]/scopes/{scopeKey}/approvedreads the structure’s published entries in the space.GET /o/c/[plural]/scopes/{scopeKey}/approved/by-external-reference-code/{externalReferenceCode}reads one published entry by its external reference code.
Replace [plural] with the plural name in the structure’s API path. The API Explorer lists the available APIs.
An /approved endpoint returns the latest approved version of each entry. An entry that has an unpublished draft returns its published content. The by-external-reference-code variant returns an entry only when the entry’s latest version is approved.
Each endpoint also has a variant without /approved, such as GET /o/cms/blogs/scopes/{scopeKey}. That variant returns the latest version of each entry in any status the caller can view, including draft, pending, scheduled, and expired entries. To deliver only published content, use the /approved endpoints.
This request reads the published CMS Blog entries in a space:
curl \
"http://localhost:8080/o/cms/blogs/scopes/[scope-key]/approved" \
--header "Authorization: Bearer [access-token]"
Replace [scope-key] with the space’s siteId. The response lists the space’s published CMS Blog entries.
To request a localized response, add an Accept-Language header with the language, such as Accept-Language: es-ES.
These endpoints accept the common query parameters fields, filter, page, pageSize, search, and sort.
A file field, such as a CMS Blog’s Cover Image, can return URLs for the image’s preview and thumbnail versions. Request them as nested fields, such as nestedFields=coverImage.previewURL,coverImage.thumbnailURL. The previewURL serves the original image. By default, the thumbnailURL serves a copy scaled to fit within 300x300 pixels.
Reading Content with GraphQL
The same content is available through GraphQL at /o/graphql, under the c namespace. See Consuming GraphQL APIs for how to send GraphQL requests.
This query reads the title and the Cover Image of a space’s CMS Blog entries:
query {
c {
cMSBlogs(scopeKey: "[scope-key]") {
items {
title
coverImage {
id
name
}
}
}
}
}
Send the query in a POST request to /o/graphql with the access token:
curl \
"http://localhost:8080/o/graphql" \
--data '{"query": "[query]"}' \
--header "Authorization: Bearer [access-token]" \
--header "Content-Type: application/json" \
--request "POST"
Replace [query] with the query, on one line.
In GraphQL, a file field such as Cover Image returns only the file’s ID and name. To get the file’s URLs, use the REST endpoints’ nested fields.
GraphQL queries return the latest version of each entry in any status. To read only published content, use the REST /approved endpoints.
The GraphQL type for a Liferay CMS entry does not include the entry’s categories or keywords. To read them, use the REST endpoints, whose responses include taxonomyCategoryBriefs and keywords.
In standalone Liferay CMS, /o/graphql doesn’t include the headless delivery queries.
Exploring the APIs
The API Explorer at /o/api lists the APIs available in your installation. See Using Liferay as a Headless Platform for more information on the API Explorer.