Skip to content

templates

Save import templates with revisions, move them between sites as files, and get a draft mapping suggested from a sample of your data.

Every route here is a POST to /_emdash/api/plugins/fluximporter/<route> with a JSON body, and needs an Administrator. See Before you call the API for authentication, the response envelope and the errors any route can return. For what goes inside a template, see Template format; for working with saved templates in the admin, see Templates.

Route What it does MCP tool
templates/list Lists saved templates fluximporter__list_templates
templates/get Reads a saved template fluximporter__get_template
templates/create Saves a new template none
templates/update Changes a template’s name, description or body none
templates/delete Deletes a template none
templates/export Returns a template as a file none
templates/import Saves a new template from a file none
templates/suggest Suggests a mapping from a sample none

A saved template has these fields:

Field What it holds
id The template’s ID: 1 to 64 characters from A-Z, a-z, 0-9, _ and -.
name 1 to 100 characters, unique among templates, with no leading or trailing whitespace and no control or format characters.
description Up to 2,000 characters; absent when empty.
template The template itself.
revision Starts at 1 and goes up by one with each change.
collection, locale, format Copied from the template, for lists and filters.
owner The template’s rules.owner, when it has one.
createdAt, updatedAt, createdBy, updatedBy When, and by which user ID.

Changes and deletes name the revision you read. When someone else saved a newer one, the route refuses with TEMPLATE_CHANGED (409) and the current revision in details.revision: read the template again and reapply your change.

Saving checks the template in two steps. A template that doesn’t parse is refused with INVALID_TEMPLATE (400), the reasons in details.problems. One that parses but doesn’t fit the site yet, say a field that doesn’t exist, is saved anyway, and the answer lists those problems and any warnings. So a create, update or import answers with:

{
"success": true,
"data": {
"template": { "id": "01JDQ6Y2B9C4D7E1F3G5H8J0KM", "name": "Supplier products", "revision": 1, "…": "…" },
"check": { "problems": [], "warnings": [] }
}
}

The errors any save can return:

Code Status Meaning
INVALID_TEMPLATE 400 The template doesn’t parse. details.problems says why.
UNSUPPORTED_TEMPLATE_VERSION 400 The template’s version isn’t 1.
TEMPLATE_TOO_LARGE 413 The template is over 256 KiB (262,144 bytes) of JSON.
NAME_TAKEN 409 Another template has this name. details.id names it.
INVALID_PLUGIN_REQUEST 413 The body is over 2 MiB.

POST /_emdash/api/plugins/fluximporter/templates/list · MCP tool fluximporter__list_templates

Lists saved templates in the order they were created, 8 a page, without their template body.

Field Type Required Notes
collection string no 1 to 63 characters. Only templates that import into this collection (its slug).
cursor string no 1 to 1,024 characters, from the previous page.

Response: { items, hasMore, cursor? }.

Terminal window
curl -X POST "https://example.com/_emdash/api/plugins/fluximporter/templates/list" \
-H "Authorization: Bearer $EMDASH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"collection":"products"}'

POST /_emdash/api/plugins/fluximporter/templates/get · MCP tool fluximporter__get_template

Takes { "id": "…" } and answers with the saved template, template body included, as stored. Errors: NOT_FOUND (404).

POST /_emdash/api/plugins/fluximporter/templates/create

Field Type Required Notes
name string yes 1 to 100 characters, unique.
description string no Up to 2,000 characters.
template object yes The template. See Template format.

Response: { template, check }, at revision 1. Errors: the save errors above.

Terminal window
curl -X POST "https://example.com/_emdash/api/plugins/fluximporter/templates/create" \
-H "Authorization: Bearer $EMDASH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Supplier products",
"template": {
"version": 1,
"collection": "products",
"locale": "en",
"key": { "from": "sku" },
"fields": {
"title": { "from": "Name", "type": "text" },
"price": { "from": "Price", "type": "number" }
}
}
}'
const res = await fetch("/_emdash/api/plugins/fluximporter/templates/create", {
method: "POST",
headers: { "Content-Type": "application/json", "X-EmDash-Request": "1" },
body: JSON.stringify({ name: "Supplier products", template }),
});
const { data } = await res.json();
if (data.check.problems.length > 0) console.warn(data.check.problems);

POST /_emdash/api/plugins/fluximporter/templates/update

Changes a template and raises its revision. Change at least one of name, description and template.

Field Type Required Notes
id string yes The template’s ID.
revision integer ≥ 1 yes The revision you read.
name string no 1 to 100 characters, unique.
description string or null no Up to 2,000 characters. null or "" removes it.
template object no A new template body.

Response: { template, check }. When schedules still run an older revision of this template, check.warnings names each one: update them to run the new revision.

Errors: NOT_FOUND (404); TEMPLATE_CHANGED (409); the save errors above.

POST /_emdash/api/plugins/fluximporter/templates/delete

Field Type Required Notes
id string yes The template’s ID.
revision integer ≥ 1 yes The revision you read.

Response: { "deleted": true }. Jobs made from it keep their own copy.

Errors: NOT_FOUND (404); TEMPLATE_CHANGED (409); TEMPLATE_IN_USE (409) when a schedule runs it, with the schedules’ IDs in details.scheduleIds.

POST /_emdash/api/plugins/fluximporter/templates/export

Takes { "id": "…" } and answers with a file name and the file to save, without the template’s ID, revision, dates or users. Errors: NOT_FOUND (404).

{
"success": true,
"data": {
"filename": "fluximporter-template-supplier-products.json",
"file": {
"format": "fluximporter.template",
"formatVersion": 1,
"exportedAt": "2026-11-27T10:02:41.118Z",
"generator": { "plugin": "fluximporter", "version": "0.8.0" },
"name": "Supplier products",
"template": { "version": 1, "collection": "products", "…": "…" }
}
}
}

POST /_emdash/api/plugins/fluximporter/templates/import

Saves a new template, at revision 1, from an exported file. It never replaces an existing template.

Field Type Required Notes
file object yes The parsed contents of the file, as templates/export returned it.
name string no Replaces the file’s name. Required when the file’s name isn’t a valid name.
owner string no Replaces the template’s rules.owner: 1 to 100 characters from A-Z, a-z, 0-9, ., _, : and -.
remap object no From version 0.9.0. Your answers to a REMAP_REQUIRED response, sent with the same file. See Templates from another platform.

Response: { template, check }.

Errors: the save errors above, and:

Code Status Meaning
INVALID_FILE 400 The file isn’t a Flux Importer template file, or its name or description isn’t valid.
UNSUPPORTED_FILE_VERSION 400 A newer version of the plugin wrote the file.
OWNER_IN_USE 409 The template removes missing entries, and another template or this site’s imported entries already use its owner. Import it again with owner set: a new name, or the same one to share it on purpose.
REMAP_REQUIRED 409 From version 0.9.0. The file was made on another platform and needs a collection, a locale, re-mapped fields or taxonomies. details says what to answer; send the same file again with remap; nothing is kept between the two calls. See Templates from another platform.

POST /_emdash/api/plugins/fluximporter/templates/suggest · strict

Drafts a template from a sample of your data, as the wizard’s Map step does: it matches source keys to fields by name, then, when a provider is set up in the plugin settings, asks it about the fields name matching didn’t settle. It saves nothing. See AI mapping for what is sent to the provider. The body can be at most 2 MiB.

Field Type Required Notes
collection string yes The collection’s slug: a-z first, then a-z, 0-9 and _, at most 63 characters.
locale string one of 1 to 35 characters. Required unless you pass a base template, which brings its own.
text string one of The data as text, at most 1 MiB. Not for XLSX.
uploadId string one of An upload. Set exactly one of text, uploadId and sourceId.
sourceId string one of A URL source: its stored copy, or a fresh fetch when it has none.
source object no The source block to read the sample with (default CSV). Not with a base template, which brings its own.
templateId string no A saved template to start from. Its mappings are kept.
templateRevision integer ≥ 1 no With templateId: refuse with TEMPLATE_CHANGED unless it’s at this revision.
template object no An unsaved template to start from. Set at most one of templateId and template.
ai boolean no false uses name matching only, even when a provider is set up.

Response: method (ai or fallback), ai ({ available, provider?, model? }), template (the draft, or null), key and slug (the suggested source keys), fields (one suggestion per field, with field, from, confidence, rationale and origin), unmapped ({ fields, keys }), check ({ problems, warnings }), warnings ({ code, count?, fields? }) and sent (what was sent to the provider, or null).

Terminal window
curl -X POST "https://example.com/_emdash/api/plugins/fluximporter/templates/suggest" \
-H "Authorization: Bearer $EMDASH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"collection":"products","locale":"en","uploadId":"01JDQ7M3X8K4N2P5R6S7T8V9WA3f9c2a7e5b1d4c6a8e0f2b4d6a8c0e1f"}'
Code Status Meaning
COLLECTION_NOT_FOUND 404 No collection has this slug.
NO_SOURCE_KEYS 400 The sample has no column or path to map.
INVALID_TEMPLATE 400 The base template has problems, in details.problems.
COLLECTION_MISMATCH 400 The base template imports into another collection.
TEMPLATE_NOT_FOUND 404 No saved template has this templateId.
TEMPLATE_CHANGED 409 The saved template isn’t at templateRevision.
SOURCE_NOT_FOUND 404 No URL source has this sourceId.
UPLOAD_NOT_FOUND 404 The upload is gone.
INVALID_FORMAT 400 text with an XLSX source block.
INVALID_SOURCE 400 The sample can’t be read.
EMPTY_BODY, TOO_LARGE 400, 413 text is empty, or over 1 MiB.

A provider that fails never fails the route: the answer falls back to name matching and says why in warnings. A fetch for a sourceId can also fail with the errors of sources/fetch.