existing_id required default (empty string)An existing item ID to reuse. If this is a valid 32-character item ID, ensureitem returns it unchanged and stops - nothing is created or modified, and the remaining arguments are ignored. If it is empty or not a valid ID, ensureitem creates a new item from the template instead. Typically you pass the result of an ids lookup here so the item is reused when found and created when missing.
template_long_item_id optional default (none)ID of the template item to copy when a new item must be created (used only when existing_id is empty or invalid). The template is an ordinary item - you may keep it in a Holding or Trash bin - and it must live in a slice related to the current slice. The new item inherits the template field values except seo (cleared) and status_code (set active). If the template ID is missing or not found, no item is created and the result is empty.
field_id optional default (none)A field ID (16 characters, for example headline........) whose value to set on the newly created item. Append a plus sign to add a value instead of replacing it (relation........+). Field/value arguments come in pairs and repeat; they apply only on the create branch and are ignored when existing_id already points to an item.
new_value optional default (none)The value for the preceding field_id. A single value is plain text, multiple values are written as a JSON array, for example ["enviro","social"]. Paired with field_id and repeatable; ignored when an existing item is returned.
[{ensureitem:5726c2c6b035d7aab450d1794e9e90d7:any-template:headline........:Ignored}]
[{ensureitem:5726c2c6b035d7aab450d1794e9e90d7:any-template}]