- EmDash
- Reference
- API routes
jobs/create
Create an import job, or a dry run, from an uploaded file or a URL source and a template.
/_emdash/api/plugins/fluximporter/jobs/createX-EmDash-Request: 1The route checks the template against the data and the collection, then saves a job with the status created. It writes no entries itself: drive the job with jobs/next until it finishes. Authentication and the response envelope are described on the jobs page.
Give the data as an uploadId, from the upload route or sources/paste, or as the sourceId of a URL source. With a sourceId the source is fetched first.
Request body
Section titled “Request body”application/json
| Field | Type | Required | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
uploadId | string | one of | — | An uploaded or pasted file, from the upload route or sources/paste. Set exactly one of uploadId and sourceId. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sourceId | string | one of | — | A saved URL source, fetched first. A real run is skipped when the feed and the template are unchanged since its last import. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
force | boolean | optional | false | With sourceId: fetch without the cached validators, and create the job even if nothing changed. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
template | object | one of | — | How source columns or paths map to fields. Set exactly one of template and templateId. See Template format. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Fields of | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
version | 1 | required | — | The template format version. Always 1. |
source | object | optional | { "format": "csv" } | How to read the data: format (csv, json, jsonl, xml or xlsx), and records, sheet, headerRow or filter where the format uses them. |
collection | string | required | — | The slug of the collection to import into. |
locale | string | required | — | The locale the entries are written in. |
key | object | required | — | The value that identifies each record, such as { "from": "sku" }. It matches a record to the entry it created before. |
slug | object | optional | — | Where each entry's slug comes from. |
fields | object | required | — | The field mappings, by field slug: where each value comes from and its type. Map at least one field. |
taxonomies | object | optional | — | Terms to assign, by taxonomy name. |
bylines | object | optional | — | Existing bylines to credit. |
publishAt | object | optional | — | Each record's publication time. Needs publish: true. |
translationOf | object | optional | — | The key of the entry each record translates. |
rules | object | optional | — | Record rules: write mode, update scope, edit protection, owner and missing entries. |
templateIdstring—templateRevisioninteger · ≥ 1—dryRunboolean—publishbooleantruebatchSizeinteger · 1–50050budgetMsinteger · 500–25,0004000journalbooleantrueorigin"wizard"—missingfalse | object—The body can be at most 2 MiB.
Examples
Section titled “Examples”Request
curl -X POST "https://example.com/_emdash/api/plugins/fluximporter/jobs/create" \ -H "Authorization: Bearer $EMDASH_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "uploadId": "01JDQ7M3X8K4N2P5R6S7T8V9WA3f9c2a7e5b1d4c6a8e0f2b4d6a8c0e1f", "templateId": "01JDQ6Y2B9C4D7E1F3G5H8J0KM", "dryRun": true }'// From the admin, signed in as an Administrator.const res = await fetch( "/_emdash/api/plugins/fluximporter/jobs/create", { method: "POST", headers: { "Content-Type": "application/json", "X-EmDash-Request": "1", }, body: JSON.stringify({ uploadId, template: { version: 1, collection: "products", locale: "en", key: { from: "sku" }, fields: { title: { from: "Name", type: "text" }, price: { from: "Price", type: "number" }, }, }, dryRun: false, batchSize: 100, }), },);const { data: job } = await res.json();Response 200
{ "success": true, "data": { "id": "01JDQ8B5ZK3W9Y7C2M4N6P8R0T", "status": "created", "templateId": "01JDQ6Y2B9C4D7E1F3G5H8J0KM", "templateRevision": 3, "dryRun": true, "publish": true, "batchSize": 50, "budgetMs": 4000, "columns": ["sku", "Name", "Price"], "warnings": [], "counters": { "created": 0, "updated": 0, "unchanged": 0, "locked": 0, "conflict": 0, "failed": 0, "filtered": 0 }, "error": null, "createdAt": "2026-11-27T09:14:02.511Z", "updatedAt": "2026-11-27T09:14:02.511Z" }}The answer is the whole job row, which also holds the template, the upload ID and the cursor. When a real run from a sourceId finds the feed and the template unchanged since the source’s last import, no job is created and the answer is { "skipped": "unchanged", "sourceId": "…", "uploadId": "…" }. Pass force: true to import anyway.
Errors
Section titled “Errors”| Code | HTTP status | Meaning |
|---|---|---|
VALIDATION_ERROR | 400 | The body doesn't match the schema, or sets both or neither of uploadId and sourceId, or of template and templateId. |
INVALID_TEMPLATE | 400 | The template is invalid, or doesn't fit the source or the collection. details.problems lists why. |
INVALID_OPTIONS | 400 | An option is out of range or doesn't fit the template, such as missing without rules.missing. |
INVALID_SOURCE | 400 | The upload is gone or can't be read as the template's format. details.code has the reader's code. |
TEMPLATE_NOT_FOUND | 404 | No saved template has this templateId. |
TEMPLATE_CHANGED | 409 | The saved template isn't at templateRevision. details.revision has the current one. |
NOT_FOUND | 404 | No URL source has this sourceId. |
CREDENTIAL_MISSING | 409 | The source's credential no longer exists. |
URL_BLOCKED | 400 | The source's address can't be fetched from the site. |
FETCH_FAILED | 502 | The source's address couldn't be reached. HTTP_ERROR, TOO_MANY_REDIRECTS and LENGTH_REQUIRED are 502 too. |
TOO_LARGE | 413 | The fetched feed, or an XLSX file, is over the size limit. |
INVALID_PLUGIN_REQUEST | 413 | The request body is over 2 MiB. |
Not an agent tool
Section titled “Not an agent tool”jobs/create is not an MCP tool. Agents create jobs with fluximporter__dry_run (the jobs/plan route) and fluximporter__start_import (jobs/start), which only take saved templates and always keep a journal. See Agent tools.