Update Content
update_contentModify existing content items in LightCMS by updating specific fields, preserving unchanged data, and automatically creating version history for tracking changes.
Instructions
Update an existing content item by ID. Creates a new version automatically. Only send fields you want to change.
For partial data updates, only the keys you include in "data" are changed — existing keys are preserved (merge semantics). Use clear_fields: ["field1", "field2"] to explicitly set fields to empty string. Set dry_run: true to validate the update without saving. To update by URL path instead of ID, use update_content_by_path. Always include version_comment so the version history is useful.
Up to 20 concurrent update_content calls are safe. For larger batches (>20 items), prefer bulk_update_content instead.
Example: {"id": "abc123", "data": {"body": "Updated text"}, "version_comment": "Revised intro paragraph"}
Content data fields support rich markup features:
[[Wikilinks]] and [[Page Title|display text]] — link to other pages by title or path; auto-update when paths change
[[include:snippet-name]] — embed a named snippet inline (reusable callouts, CTAs, disclaimers)
#hashtags — mention #tagname anywhere to automatically tag the page
Markdown fields (type "markdown") — GitHub Flavored Markdown converted to HTML at publish time Templates can use {{.lc_toc}} in their HTML layout to inject an auto-generated table of contents.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Content category | |
| clear_fields | No | Field names to clear to empty string (removes ambiguity about how to delete field content) | |
| data | No | Template field values | |
| dry_run | No | If true, validate the update without saving | |
| folder_path | No | Folder path | |
| id | Yes | Content ID (MongoDB ObjectID),required | |
| meta_description | No | SEO meta description | |
| og_image | No | Open Graph image URL | |
| raw_mode | No | Use raw HTML mode | |
| set_raw_mode | No | Set to true to explicitly update raw_mode (needed to set it to false) | |
| set_use_footer | No | Set to true to explicitly update use_footer (needed to set it to false) | |
| set_use_header | No | Set to true to explicitly update use_header (needed to set it to false) | |
| set_use_theme | No | Set to true to explicitly update use_theme (needed to set it to false) | |
| slug | No | URL slug | |
| tags | No | Tags for lc:query index pages | |
| template_id | No | Template ID (MongoDB ObjectID) | |
| title | No | Content title | |
| use_footer | No | Include site footer | |
| use_header | No | Include site header | |
| use_theme | No | Apply site theme/layout | |
| version_comment | No | Optional comment describing this version change |