Query Regarding Unpublishing Headless Content After End Date via Scheduler

2025/11/20 10:17 AM

I am currently working with Headless content types in Xperience by Kentico, and I have a requirement where I need to automatically unpublish content items once their configured End Date has passed.

To achieve this, I am planning to create a scheduled task that checks all relevant headless content items, compares their End Date with the current date, and unpublishes the content if it is already past the End Date.

Could you please confirm:

  1. Is this approach recommended for headless content types?
  2. Is there any built-in API or best practice for programmatically unpublishing headless content items?
  3. Is there any sample implementation or documentation that can help with this scenario?

Environment

  • Xperience by Kentico version: [30.9.1]

  • .NET version: [8]

Tags:
Headless channels

Answers

2025/11/20 1:19 PM
Accepted answer

This question caught my eye and I researched it. Headless content items don't provide scheduling unpublish like reusable content items, so using a scheduled task with a custom EndDate field feels like a reasonable approach.

I tried using contentItemManager.TryUnpublish() for headless items and found this limitation:

Error unpublishing content item 82 in language en: Provided content item with id '82' is not defined as reusable. Implementation is limited to work only with reusable content items.

After researching the Kentico API Reference and documentation, I found no documented programmatic API for unpublishing headless items. Unlike pages and reusable content items, there doesn't appear to be a corresponding API for headless items.

I think you might need to rethink the solution. Perhaps the unpublishing logic should be based on linked reusable content, where you can rely on the native support provided by the XbyK APIs. Or you can keep the EndDate field on the headless item, and the app consuming the GraphQL API will simply treat the item as unpublished once that date has passed. This really depends on you project structure and requirements. And of course, you can also submit an idea on the roadmap.

2025/11/21 6:34 AM

Hi Milan,

Thank you for the detailed explanation — you are absolutely correct. For now, we’ve implemented the logic on the frontend to ignore any headless items whose EndDate has already passed, so the content behaves as “unpublished” from the application’s perspective.

However, we are also looking for a solution where these headless items can be truly unpublished on the admin side as well, similar to how reusable content items support programmatic unpublishing. This would help us maintain consistency across both admin and frontend, especially for content governance.

If there’s any workaround or upcoming support planned for programmatically unpublishing headless items, that would be very helpful. Otherwise, we will consider submitting this as an idea on the roadmap.

Thanks again for your guidance!

To response this discussion, you have to login first.