- EmDash
- Reference
Template format
A template is one JSON object that says how to read the source, which collection to write, and how each record becomes an entry. This page lists every key it accepts.
The wizard writes templates for you, and you can keep them on the Templates tab. You only need this page when you edit a template by hand, import one from a file, or send one to the API (jobs/create, templates/create) or an agent tool.
Every object in a template is strict: a key the format doesn’t define makes the template invalid, as does a value of the wrong type. Problems come back as a list, each one starting with the path of the key, such as fields.price: thousands must differ from decimal.
A complete example
Section titled “A complete example”This template imports a CSV of products into a products collection in English. It keeps only active rows, reads a European price, a day-first date, a yes/no flag and a colour, downloads a photo, converts an HTML description to Portable Text, and assigns categories, creating the ones that don’t exist.
{ "version": 1, "source": { "format": "csv", "filter": "status = 'active'" }, "collection": "products", "locale": "en", "key": { "from": "sku" }, "slug": { "from": "name" }, "fields": { "title": { "type": "text", "from": "name" }, "price": { "type": "number", "from": "price", "decimal": ",", "thousands": "." }, "released": { "type": "date", "from": "released", "format": "dd/MM/yyyy", "tz": "Europe/Paris" }, "in_stock": { "type": "boolean", "from": "in_stock" }, "colour": { "type": "select", "from": "colour", "map": { "Bordeaux": "red" } }, "label": { "type": "text", "expr": "name & ' (' & sku & ')'" }, "photo": { "type": "image", "from": "image_url", "alt": { "from": "name" } }, "body": { "type": "portableText", "from": "description", "format": "html" } }, "taxonomies": { "category": { "from": "categories", "separator": ";", "create": true } }, "rules": { "mode": "upsert", "protectEdited": true }}It fits a CSV whose header has the columns sku, name, status, price, released, in_stock, colour, image_url, description and categories, and a collection with the fields title, price, released, in_stock, colour, label, photo and body and the category taxonomy attached.
Top-level keys
Section titled “Top-level keys”| Key | Required | What it holds |
|---|---|---|
version |
Yes | Always 1. A template with another integer version is refused (UNSUPPORTED_TEMPLATE_VERSION). |
source |
No | How to read the source. Defaults to { "format": "csv" }. See Source block. |
collection |
Yes | The collection’s slug: a lowercase letter, then up to 62 lowercase letters, digits or _. |
locale |
Yes | The locale entries are written in. With i18n configured it must be one of the site’s locales (matched ignoring case); without i18n any valid locale code is kept. |
key |
Yes | The record’s import key. See Key and slug. |
slug |
No | Where the entry’s slug comes from. |
fields |
Yes | At least one field mapping, by field slug. See Field mappings. |
taxonomies |
No | Terms to assign, by taxonomy name. See Taxonomies. |
bylines |
No | Existing bylines to credit. See Bylines. |
translationOf |
No | The record this one translates. See Translations. |
publishAt |
No | When the entry goes live. See Publication time. |
target |
No | What a WordPress import writes. From version 0.9.0, EmDash accepts it and ignores it. See Templates from another platform. |
rules |
No | Write mode, update scope, edit protection and missing entries. See Record rules. |
Reading a value: from or expr
Section titled “Reading a value: from or expr”Every value the template reads (the key, the slug, each field, alt text, taxonomies, bylines, translationOf and publishAt) names exactly one of:
from: a path in the record. In CSV and XLSX it’s the column name exactly as the header has it, dots and spaces included. In JSON and JSON Lines it’s dot-separated keys (price.amount). In XML it’s/-separated element names, optionally ending in@attributeor#text(price/@currency). Source formats has the details.expr: a JSONata expression, evaluated on the whole record. See Expressions.
Setting both, or neither, is an error: Set exactly one of "from" and "expr".
A path that doesn’t exist reads as empty. An expression that returns nothing (undefined) reads as empty too, and its result goes through the same conversion as a path value.
Key and slug
Section titled “Key and slug”key is required. It’s what links a record to its entry across runs: the first import creates the entry, and later imports with the same key in the same collection and locale update it. The importer stores the key in a field it adds to the collection, flux_source_id. That name is reserved, so you can’t map a field to it.
The key is read as text and trimmed. A record fails with missing_key when it’s empty, key_too_long when it’s over 256 characters, and not_scalar when the value is an object or array.
slug is optional. The value is turned into a slug: accents removed, lowercased, every run of other characters replaced with -, and cut to 200 characters. A value with nothing left fails with empty_slug.
"key": { "from": "sku" },"slug": { "expr": "$lowercase(name & ' ' & sku)" }Field mappings
Section titled “Field mappings”fields maps each collection field slug to a mapping. Field slugs follow the same rule as collection slugs. Each mapping has a type, one of from or expr, and the options for that type.
In general an empty value (a missing path, null, or blank text) writes an empty field, and an object or array fails the record with not_scalar. multiSelect, json, reference and the link mappings accept arrays.
Each mapping type writes into certain EmDash field types. A mismatch is a template problem that stops the job before it starts:
Mapping type |
Writes into EmDash fields of type |
|---|---|
text |
string, text, url, slug |
number |
number, integer |
date |
datetime, string, text |
boolean |
boolean |
select |
select |
multiSelect |
multiSelect |
json |
json |
slug |
slug, string |
reference |
reference |
image |
image |
file |
file |
portableText |
portableText |
After conversion each value is checked against the field’s own rules, as EmDash checks them: required (fails with required), whole numbers for integer fields (invalid_integer), min and max (out_of_range), minLength and maxLength (too_short, too_long) and pattern (pattern_mismatch).
Text as given, not trimmed. Numbers and booleans become their text. Blank text is empty.
"title": { "type": "text", "from": "Name" }Like text, then turned into a slug as the top-level slug is. Fails with empty_slug when nothing is left.
number
Section titled “number”A JSON number is kept as it is. Text is trimmed and read as a number. Fails with invalid_number.
| Option | Values | Default | What it does |
|---|---|---|---|
decimal |
"." or "," |
"." |
The decimal separator. |
thousands |
",", ".", " ", "'" or "_" |
none | A separator that groups the integer part in threes. It must differ from decimal. " " also matches the non-breaking spaces spreadsheets write. |
"price": { "type": "number", "from": "Price", "decimal": ",", "thousands": "." }With these options 1.234,50 reads as 1234.5, and 12.34 fails, because . groups thousands here.
Reads a date or time and writes it in EmDash’s form.
| Option | Values | Default | What it does |
|---|---|---|---|
format |
a Luxon format, "unix" or "unixMs" |
ISO 8601 | How the source writes dates. "unix" reads seconds and "unixMs" milliseconds, as numbers or text. |
tz |
an IANA timezone, or "site" |
"UTC" |
The timezone for values that carry no offset. "site" uses the site’s timezone setting, read when the job is created. |
output |
a Luxon format, at most 100 characters | yyyy-MM-dd |
How the date is written into a string or text field. Not allowed for a datetime field. |
Into a datetime field the value is UTC with milliseconds (2026-03-01T09:30:00.000Z). Into a string or text field it’s formatted in tz with output.
A number is read as a date only with "unix" or "unixMs". A local time the clocks skip (a daylight-saving gap) fails with invalid_date; a time that happens twice takes the earlier one. Years outside 0000 to 9999 fail too.
"released": { "type": "date", "from": "Released", "format": "dd/MM/yyyy", "tz": "site" }boolean
Section titled “boolean”JSON true and false, and the numbers 1 and 0, are kept. Text is trimmed, lowercased and looked up in two token lists. Fails with invalid_boolean.
| Option | Default | What it does |
|---|---|---|
true |
["true", "yes", "y", "1", "on"] |
The words that mean true. A list you set replaces the default list. |
false |
["false", "no", "n", "0", "off"] |
The words that mean false. |
Each list holds 1 to 50 tokens of 1 to 100 characters, none blank. No token can be in both lists, counting the default list for one you leave out.
"featured": { "type": "boolean", "from": "Featured", "true": ["ja"], "false": ["nein"] }select
Section titled “select”One option of the field. The value is trimmed, then looked up in map, then matched against the field’s options. Fails with invalid_option, naming the options.
| Option | Default | What it does |
|---|---|---|
map |
none | Source values to options, such as { "Bordeaux": "red" }. Up to 1,000 entries, keys and values of 1 to 200 characters. Every value must be one of the field’s options. |
ignoreCase |
true |
Matches map keys and options ignoring case. An option is only matched this way when exactly one option has that spelling. |
A select field without options takes any non-empty text.
multiSelect
Section titled “multiSelect”Several options. An array is taken item by item; text is split on separator. Items are trimmed, empty items dropped, each one matched as for select, and duplicates dropped. At most 1,000 items (too_many_items).
| Option | Default | What it does |
|---|---|---|
separator |
"," |
Splits text into items. 1 to 10 characters. |
map, ignoreCase |
as for select |
Objects, arrays, numbers and booleans are stored as they are.
| Option | Default | What it does |
|---|---|---|
parse |
true |
Parses text as JSON. With false, text is stored as a JSON string. |
Either way, a string that starts with { or [, or that looks like a number, is refused with invalid_json, because EmDash would read it back as parsed JSON or as a number. A value is at most 1 MiB as JSON (value_too_large).
reference
Section titled “reference”Links the entry to entries in the collection the reference field points to. The field must be bound to a relation, and that collection must exist. An array is taken item by item; text is split on separator.
| Option | Values | Default | What it does |
|---|---|---|---|
match |
"id", "slug", "key" |
"id" |
How each item finds its entry: by entry ID, by slug, or by the import key an earlier import gave it. "key" needs entries imported into that collection, unless it’s the collection this template writes. |
separator |
1 to 10 characters | "," |
Splits text into items. |
A field that takes one entry takes one item; others take up to 50. Each item is at most 200 characters (256 with "key"). An item that finds no entry fails with reference_not_found.
image and file
Section titled “image and file”The value is the URL of an image or file to download, upload to the media library and link. It must be an absolute http or https URL as text. A template maps at most 5 image and file fields together. Media explains downloads, size limits and reuse.
| Option | Types | Default | What it does |
|---|---|---|---|
alt |
image |
none | Alt text, from { "from": … } or { "expr": … }. Trimmed, at most 1,000 characters (alt_too_long). |
refresh |
both | false |
A URL the site already downloaded is reused. With true the importer asks the server whether the file changed and downloads it again if so, at most once per job. |
"photo": { "type": "image", "from": "image_url", "alt": { "expr": "name & ' photo'" } }portableText
Section titled “portableText”Converts HTML, Markdown or plain text to Portable Text. A template maps at most 3 portableText fields.
| Option | Values | Default | What it does |
|---|---|---|---|
format |
"html", "markdown", "text" |
required | What the source text is. |
baseUrl |
an absolute http or https URL |
none | Resolves relative links and image URLs. |
images |
"import", "skip" |
"import" |
Downloads the images the text contains, or leaves them out. |
imageErrors |
"drop", "fail" |
"drop" |
What an image that can’t be imported does: it’s left out with a warning, or the record fails. |
unknownMarkup |
"warn", "fail" |
"warn" |
What markup with no Portable Text equivalent does: a warning, or the record fails. |
Only text is accepted; a number or boolean fails with not_scalar. The limits per record: 512 KiB of source text per field (128 KiB for Markdown) and in total, 1 MiB of Portable Text, and 50 distinct image URLs.
Taxonomies
Section titled “Taxonomies”taxonomies maps a taxonomy name to the terms each entry gets. A record’s terms replace the entry’s terms of that taxonomy. At most 20 taxonomies, each attached to the collection. Taxonomies explains matching and term creation.
| Option | Values | Default | What it does |
|---|---|---|---|
match |
"slug", "label" |
"slug" |
Finds terms by slug or by label. |
separator |
1 to 10 characters | "," |
Splits text into terms. |
hierarchy |
1 to 10 characters | "/" |
Splits a term into levels in a hierarchical taxonomy, as in Clothing/Shoes. Must differ from separator. A flat taxonomy ignores it, so a tag like AC/DC stays one term. |
create |
true, false |
false |
Creates the terms that don’t exist. Without it a missing term fails the record with term_not_found. |
At most 100 terms per record, 10 levels each, 200 characters per level.
"taxonomies": { "category": { "from": "Categories", "separator": ";", "create": true }, "tag": { "from": "Tags", "match": "label" }}Bylines
Section titled “Bylines”bylines credits existing bylines, in order, and replaces the entry’s bylines. Flux Importer never creates bylines.
| Option | Values | Default |
|---|---|---|
match |
"slug", "name" |
"slug" |
separator |
1 to 10 characters | "," |
At most 50 bylines per record. One that isn’t found fails the record with byline_not_found.
Translations
Section titled “Translations”translationOf makes each record a translation of an entry imported in another locale. It reads the import key of the source record, plus:
| Option | What it does |
|---|---|
locale |
The source entry’s locale. Defaults to the site’s default locale, and must differ from the template’s locale. |
It needs i18n with at least two locales. A record whose value is blank is imported as an entry of its own. Fields EmDash shares across a translation group (fields that aren’t translatable, reference fields and taxonomies) aren’t written by a record that names a source. See Translations.
"translationOf": { "from": "source_sku", "locale": "en" }Publication time
Section titled “Publication time”publishAt reads when the entry goes live, with the format and tz options of a date mapping. A time in the future schedules the entry; a past or empty time publishes it now. It needs the job option publish: true (the default).
From version 0.9.0, when the collection doesn’t allow scheduling (EmDash’s no-scheduling), a record with a future time is saved as a draft with the warning scheduling_disabled, instead of failing.
"publishAt": { "from": "go_live", "tz": "site" }Record rules
Section titled “Record rules”rules controls how each record treats the entry it matches. All keys are optional. Record rules and Missing entries explain them in full.
| Key | Values | Default | What it does |
|---|---|---|---|
mode |
"upsert", "create", "update" |
"upsert" |
create only creates entries and skips records whose entry exists; update only updates and skips records with no entry. A skipped record counts as unchanged, with a warning. |
updateFields |
1 to 200 mapping names | all | Updates only these mappings when the entry exists; a new entry still gets every mapping. Names are field slugs, slug, taxonomies.<name> and bylines, each mapped by the template and listed once. |
protectEdited |
true, false |
false |
Leaves a value alone when someone changed it outside the import since the import last wrote it (field_edited warning). |
owner |
1 to 100 of A-Z a-z 0-9 . _ : - |
none | Names the entries this template’s jobs create, so a later run can tell which entries it owns. |
missing |
{ "action", "maxPercent" } |
none | Acts on owned entries a later feed no longer has. Needs owner. |
missing.action is "trash" or "unpublish". missing.maxPercent, 0 to 100 and 25 by default, is the most of the owner’s entries a run may act on; a run that finds more missing leaves them all alone. updateFields and protectEdited can’t be used with mode: "create", which never updates.
"rules": { "mode": "upsert", "updateFields": ["price", "in_stock", "taxonomies.category"], "owner": "shop-feed", "missing": { "action": "unpublish", "maxPercent": 10 }}Source block
Section titled “Source block”| Key | Formats | What it does |
|---|---|---|
format |
all | "csv" (the default), "json", "jsonl", "xml" or "xlsx". |
records |
json, xml |
Where the records are. JSON: a dot path to an array, such as data.products; leave it out for a top-level array. XML: required, the element path from the root, such as feed/item. |
sheet |
xlsx |
The sheet, by name (1 to 100 characters, matched ignoring case) or number from 1. Defaults to the first sheet. |
headerRow |
xlsx |
The row that holds the column names, from 1. Defaults to 1. |
filter |
all | A JSONata expression run on each record. Only records it’s true for are imported. |
A key used with a format that doesn’t take it is refused (source.sheet is only allowed for xlsx). Source formats describes each format.
The filter must return true or false. false or no result skips the record, which counts as filtered. Any other result fails the record with filter_not_boolean, and an error in the expression with filter_error.
Expressions
Section titled “Expressions”The filter and every expr are JSONata expressions, evaluated on one record at a time. The record’s keys are the names: in CSV, the column names (put names with spaces in backticks, as in `Unit price`).
"price": { "type": "number", "expr": "$round($number(price) * 1.2, 2)" },"name": { "type": "text", "expr": "first & ' ' & last" },"slug": { "expr": "$lowercase($replace(title, ' ', '-'))" }Expressions must give the same result on every run and finish in bounded time, so they’re limited:
- At most 4,096 bytes each.
- Only these functions:
$string,$substring,$substringBefore,$substringAfter,$lowercase,$uppercase,$length,$trim,$pad,$contains,$replace,$split,$join,$encodeUrlComponent,$encodeUrl,$decodeUrlComponent,$decodeUrl,$number,$floor,$ceil,$round,$abs,$sqrt,$power,$formatBase,$sum,$max,$min,$average,$boolean,$not,$exists,$type,$count,$map,$filter,$single,$reduce,$append,$reverse,$lookup,$keys,$toMillisand$fromMillis. $now,$millis,$randomand$shuffleare refused, as is every other JSONata function ($sort,$match,$evaland so on).- Functions can only be called, not passed as values, bound to variables or partially applied. Write a lambda instead:
$map(tags, function($t) { $trim($t) }). - Not supported: regular expressions (
/…/;$contains,$replaceand$splittake plain text patterns), the transform operator|…|, the wildcards*and**, grouping (items{…}), and the@and#bindings. The order-by operator^(…)and object constructors are allowed. $padwidths are capped at 10,000 characters, and$fromMillispictures at 256 characters.$toMillisreads ISO 8601 only; use a date mapping’sformatfor other layouts.
Each evaluation also has a step budget. A record whose expression runs over it, or nests arrays more than 32 deep, fails with expr_limit. An expression that throws fails the record with expr_error; the message names the JSONata error code. Syntax errors are found before the job starts, with the character position.
Size and name limits
Section titled “Size and name limits”- A saved template is at most 262,144 bytes of JSON (
TEMPLATE_TOO_LARGE). - A saved template’s name is 1 to 100 characters, with no leading or trailing spaces and no control characters, and unique. Its description is at most 2,000 characters.
Template files
Section titled “Template files”Export on the Templates tab, or the templates/export route, downloads a saved template as a file named fluximporter-template-<name>.json:
{ "format": "fluximporter.template", "formatVersion": 1, "exportedAt": "2026-11-16T10:00:00.000Z", "generator": { "plugin": "fluximporter", "version": "0.8.0" }, "name": "Shop feed", "description": "Nightly", "template": { "version": 1, "collection": "products", "…": "…" }}| Key | What it holds |
|---|---|
format |
Always "fluximporter.template". |
formatVersion |
The file format version, 1. |
exportedAt |
When the file was written, in UTC. |
generator |
The plugin ID and version that wrote it. |
name |
The template’s name. |
description |
Its description, when it has one. |
template |
The template, as stored. |
The file leaves out the template’s ID, revision, timestamps and users.
Import a template on the same tab, or the templates/import route, never overwrites a saved template: it creates a new one when the file is accepted. It reads only the keys above. You can give a new name, which you need when the file’s name is taken or isn’t a valid name, and a new owner, which replaces rules.owner. The import is refused with:
INVALID_FILEwhenformatisn’t"fluximporter.template",formatVersionisn’t the integer1, or the template, name or description is missing or invalid.UNSUPPORTED_FILE_VERSIONfor a file written by a newer Flux Importer with a higherformatVersion.NAME_TAKENwhen a template with that name exists.REMAP_REQUIRED(from version 0.9.0) when the file was made on another platform and needs a re-map. See Templates from another platform.OWNER_IN_USEwhen the template hasrules.missingand its owner is already used in the same collection and locale. Import it with a newowner, or with the same one to share it on purpose.
The template inside goes through every check a saved template does. Error codes lists the rest.
Templates from another platform
Section titled “Templates from another platform”A template made by the WordPress version of Flux Importer can carry a target block, which says what a WordPress import writes (posts of a post type, users, or terms of a taxonomy). EmDash accepts target, checks its shape, otherwise ignores it, and keeps it in the template when you save or export.
Such a template can’t run on EmDash as it is. Its field keys are WordPress’s (post_title, meta:price), and it may have no collection or locale, or a blocks mapping that EmDash has no equivalent for. So Import a template answers REMAP_REQUIRED (409) instead of saving it, and lists what needs your answer:
- the
collectionand thelocale, when the template has none. For a file another platform wrote (generator.pluginisn’t"fluximporter"), also when its collection doesn’t exist on this site; - each field to re-map: the collection field it should write to, or a different mapping type, or drop it. A
blocksmapping must be re-mapped as another type or dropped; - each taxonomy name EmDash doesn’t accept, which you re-map to an EmDash taxonomy or drop;
- when dropping fields leaves
rules.updateFieldsempty, which fields to update instead. RemovingupdateFieldswould widen updates to every field, so the importer asks.
The admin’s Import template dialog asks for these in its Re-map this template step; see Import a template. Through the API, the answer is in the details of the 409 response, and you send the same file again with remap: collection, locale, fields (the old key to a collection field, to null to drop it, or to { "to", "mapping" } to replace the mapping), optionally taxonomies (the old name to an EmDash taxonomy, or null to drop it) and updateFields. Nothing is kept between the two calls. The re-mapped template then goes through every check a saved template does. An answer for a field the template doesn’t map, or a field that was asked and left unanswered, is refused with VALIDATION_ERROR.
A file that EmDash wrote keeps the earlier behaviour: fields the site doesn’t have yet are reported by the site check, so you can import the template before adding them.