How to search Confluence pages by content state

Hello people,

I’m trying to search Confluence pages with a particular content state.

Reviewing the Confluence search endpoint there is no direct option to search by the content state. So, as I have found the content state is stores as a content property, I’m trying to build a CQL for this content property.

The key of the content property for published content states is content-state-published as you can see if you try to get the content properties of a page using the endpoint {confluenceBaseURL}/wiki/rest/api/content/{pageId}/property

So, as it is said in the Content properties documentation, you can write a CQL using them. I’m trying to build something like[content-state-published] = {stateId}
but the search endpoint is always giving me a 400 error with an error message like “com.atlassian.confluence.api.service.exceptions.BadRequestException: Could not parse cql”. Take on count I’m writing %5B for [ character and %5D for ] to make it work. The search URL in my case is something like {confluenceBaseURL}/wiki/rest/api/search? ={stateId}&limit=25

  • Can you please tell me if the internal Content Properties (editor, content-state-published and content-state-draft in my case) for a page are indexed and you can search by them?
  • Am I writing something wrong in the CQL?
  • Is there any other way to search by content state?

We really need to be able to search by the content state to be able to develop the feature we are looking for.


1 Like

Hi @alvaro.aranda. Great question. I dig some digging in with some internal experts, and we came up with this CQL query using cqlcontext and contentStatuses:


(be sure to select all/scroll on that code block above)

contentStatuses is mentioned in the docs for CQL search. Valid arguments appear to be: draft, archived, and current (which I surmised from the Content State API docs).

1 Like

Hello @nmansilla,

First of all thanks a lot for going into this. For us is really important to unblock it to be able to develop something related to it.

Unfortunately I think we are talking about different things. I know we are able to search for pages looking at their content statuses (archived, current…) but here I’m trying to do it looking at states (rough draft, in progress, ready for review…). Statuses are related to a version of the page and states directly to the page. Statuses are static but new custom states can be added too.

I hope we can find a way to search looking at states.


1 Like

@alvaro.aranda, apologies for confusing those two! Unfortunately, there is not a way to select/filter content by custom state with CQL.

1 Like

@nmansilla , do we have an update on this limitation? I would like to vote and follow for the a ticket about this issue.

@ItaloModusCreate - you can create a suggestion / feature request issue on the CONFCLOUD project here. I suggest you reference this post in the description, and provide as many details as possible to avoid this being conflated with contentStatuses (as I did). Feel free to post the issue link here so that others can also vote on it and chime in.

FYI: is a public instance (with public issues) that various product and engineering teams make available for receiving / managing feature requests.

It appears that specifying contentStatuses with value of “draft” doesn’t return anything. Is there a way to get a user’s unpublished draft pages using CQL (or the regular rest API)? If so, I can’t find it; it appears that draft content is never returned by CQL.