Skip to content

Packaging & distribution explains what the import engine does at each stage, and Export, import and install apps walks the wizard as a builder sees it. This page documents the same surface as a wire contract, for a client driving an import programmatically: every session endpoint with its request and response bodies, the session state machine exactly as the service enforces it, and the concurrency rules that keep two writers from corrupting one session.

Everything here is served by packaging-service behind the gateway prefix /api/packaging; paths below are written from /v1/…. The shared conventions — routing, authentication, pagination, and the {success, result} response envelope — are owned by Calling the HTTP API and are not repeated here. Every response body on this page is the result member of that envelope, without exception. Two requirements apply to every call:

  • an authenticated request — every packaging controller is @authenticate-guarded with the Auth2 strategy — made by a space administrator (Since 1.10: every import, execution, override and mapping-profile route requires a system-level Admin grant, or a service call; anything less is a 403); and
  • a target space. You do not send it: the gateway derives the space from the request’s host and sets x-space-id itself, replacing any value a client sends (Tenancy and identity). Address the tenant host of the space you are importing into. A request that reaches packaging-service without the header — one that bypassed the gateway — is a 400, and addressing a session that belongs to a different space is a 403.

Sessions are not permanent. A TTL index deletes any session not updated for seven days; a client that parks a half-configured session longer than that will find it gone.

A session’s status is one of five values — validating, validated, importing, completed, failed (IMPORT_SESSION_STATUSES). There is no uploaded state: a session enters the lifecycle at validating while Phase-1 validation runs, and is normally first visible to a client as validated.

The transitions are not folklore. The service defines an explicit transition table, and code paths that write a status are expected to check it (assertValidTransition). The complete set:

TransitionFromToFired by
VALIDATEvalidatingvalidatedPhase-1 validation completing (POST /v1/import/validate)
START_IMPORTvalidatedimportingPOST /…/execute claiming the session
COMPLETEimportingcompletedthe import worker finishing all mappings — with or without per-resource errors
FAILvalidating, validated, importingfailedan unrecoverable error during validation or execution
RETRYfailed, completedimportingPOST /…/retry, or execute called on a terminal session
RECOVER_STUCKimportingfailedworker recovery, when a session has been stuck in importing past the recovery window (15 minutes, IMPORT_STUCK_THRESHOLD_MS)
CANCELvalidated, importingfailedPOST /…/cancel

Three consequences worth internalising before writing a client:

  • completed does not mean fully succeeded. COMPLETE fires when every mapping has been processed, possibly with per-resource errors; the truth is in importResult and the per-mapping status values. A completed session remains retryable.
  • failed is also where cancellation lands. There is no separate cancelled state; a cancelled session is failed with an errorMessage that begins Cancelled:.
  • failed is not always terminal-bad. Validation that produces a resource report but cannot proceed still creates a validated session (the report carries the blockers); only a validation that cannot produce a report at all — an unreadable package, an incompatible schema version — lands the new session directly in failed (createSession). Both failed and completed accept a retry.

The package ZIP is not posted to this endpoint. Upload it to the storage service first, then pass the resulting file id; the packaging service downloads the ZIP itself.

Body fieldRequiredMeaning
fileIdyes — its absence is a 400Storage-service id of the uploaded ZIP
fileNamenoOriginal file name, echoed in session listings
importStrategynoInitial bulk strategy: MERGE_NEW_ONLY, OVERWRITE_ALL or MANUAL (default)

The response is {sessionId, validationReport, updateIdentifier} (ImportValidateRequest / ImportValidateResponse). Keep the updateIdentifier — every later write must echo it (see the concurrency section). The shape and meaning of the validation report are covered on Packaging & Distribution; how the manifest’s schemaVersion gates this call is covered in Schema versioning. One member of the report is documented on this page instead, because acting on it is a wire operation of its own: mappedFields Since 1.10.

Validation always creates a new session; there is no in-place re-validation of an existing one. Re-uploading a corrected package means a new session and a fresh configuration.

Since 1.10 validation also reports, as blocking errors in the report:

  • TARGET_ARCHIVED — a package resource would match an archived target resource; it is not treated as Existing, so an archived record is never overwritten;
  • TARGET_INSTALLED — a resource the import would write is owned by a package installation; fork the installation first;
  • the INSTALL_* codes, when the ZIP is a published package version and the session is therefore an install — see Install mode; INSTALL_NAME_COLLISION now lists every collision (resourceType, name, displayName, scope of space or environment, targetId?, targetModuleId?), not only the first;
  • MAPPED_FIELD_SOURCE_UNDECIDED — a mapped field needs the client’s decision before the run (see Mapped-field decisions).

A published-version file exported before package ids existed is refused outright with 422 PACKAGE_FORMAT_OUTDATED.

Lists the current space’s sessions as summaries — {sessions: [{id, status, sourceEnvironment?, packageDescription?, packageFileName?, resourceCount?, createdAt, updatedAt, createdBy?, updatedBy?, updateIdentifier?}]} — newest activity first (updatedAt descending). Paging is by skip and limit query parameters; limit defaults to 50 and is clamped to 1–100, so a larger value is quietly reduced.

Returns the full session document: manifest, validation report, resource mappings, value-reference mappings (with their packaged entryData intact — the payload the wizard’s auto-create editor runs on), unmapped-dependency mappings, overrides and results. For a session in validated or failed, the service re-checks unresolved auto-create references on each read and stamps the fresh errors into the returned report — the response reflects the current target space, not a snapshot.

The lightweight polling endpoint for an import in flight: {status, importResult?, errorMessage?, resourceMappings?} (ImportStatusResponse). resourceMappings is included only once the session has left the configuration phase — while importing and in the terminal states — so a poller can render per-resource progress without fetching the whole session.

Configuration writes are accepted while the session is validated or failed; any other status is a 409. The one exception is the bulk strategy, which requires validated exactly. All of them are optimistic-locked — see the concurrency section.

The unified auto-save endpoint (SaveImportConfigRequest). Every section is optional; the client sends only what changed, and validation is deliberately relaxed — hard constraints are enforced at execute time, not here:

{
"mappings": [
{
"sourceType": "DataEntity",
"sourceId": "0b6d…",
"normalizedName": "invoice",
"action": "OVERWRITE",
"targetId": "9f2a…"
}
],
"valueReferences": [
{"entryId": "77c1…", "action": "REMAP", "remapTargetId": "a41b…"}
],
"unmappedDependencies": [
{"sourceId": "d305…", "targetId": "e77f…"}
],
"mappedFieldDecisions": [
{"entityId": "0b6d…", "fieldId": "f1…", "targetParentId": "9f2a…",
"decision": {"kind": "dontCopy"}}
],
"updateIdentifier": "58c0…"
}

Server-side behaviour a client should know about:

  • status, errorMessage and isHardDep on a submitted mapping are stripped — they are server-controlled; each saved mapping is re-stamped pending.
  • A mapping submitted without targetId for a resource that validation classified as existing gets the validation-resolved targetId back automatically, so a save cannot silently drop the source→target link.
  • In unmappedDependencies, targetId: null clears a previously chosen target.
  • Since dev a row of the report’s unmappedDependencies may carry hard: false: only page widgets use it, and left unmapped those widgets are cleared (no hard field means hard). See Page widgets pointing outside the package.
  • Value-reference choices are merged item-by-item; an entryId not already on the session is ignored, and remap targets are verified to exist — and to be live — before the save lands.
  • A save that would clear a required workflow-step owner on a resource the import will write is rejected with 400 — see required workflow-step owners.
  • Since 1.10 mappedFieldDecisions is the full list of mapped-field decisions and replaces the stored one; a malformed item is 400 MAPPED_FIELD_DECISION_INVALID. A save that changes mappings or unmapped-dependency targets recomputes the mapped-field statuses too, because either can move a field’s target parent (see Mapped-field decisions).
  • An empty body is a valid no-op: nothing is written and the token is not rotated, but the token is still checked, so a stale client learns it is stale.

The response is {updatedAt, updateIdentifier, dependencyImpact?, valueReferenceErrors?, mappingSummary?, mappedFields?, canProceed?} (SaveImportConfigResponse). dependencyImpact accompanies mapping changes (which resources lost hard dependencies, updated cascade-skip counts); valueReferenceErrors are advance warnings from the auto-create nested-reference guard — the save succeeded, but execution will gate on them; mappingSummary is the resolved/remaining principal count after a value-reference save; mappedFields and canProceed (Since 1.10) come back whenever the mapped-field statuses were recomputed.

Body {strategy, updateIdentifier} (ApplyStrategyRequest). Recomputes every mapping’s action from the chosen strategy — MERGE_NEW_ONLY creates new and skips existing, OVERWRITE_ALL creates new and overwrites existing, MANUAL leaves per-resource decisions to the client — while preserving user-chosen module remaps (a DataModule mapped by hand to a different target survives the sweep). Returns the full updated session. Only accepted in validated.

PATCH /v1/import/{sessionId}/suggestions/accept-exact

Section titled “PATCH /v1/import/{sessionId}/suggestions/accept-exact”

Body {updateIdentifier} (AcceptExactSuggestionsRequest). Converts every not-yet-actioned, exact-confidence principal suggestion into a remap to its suggested target, in one write, through the same merge-and-verify pipeline as /config. Fuzzy, ambiguous and already-resolved references are skipped, not failed. Returns {acceptedCount, mappingSummary, updateIdentifier}; with no qualifying suggestions it is a token-checked no-op that returns acceptedCount: 0.

GET / PATCH / DELETE /v1/import/{sessionId}/resource/{sourceType}/{sourceId}/payload read, replace and clear a single resource’s JSON payload for the next execution. sourceType must be a literal ResourceType enum value — anything else is a 400 — and the pair must have a mapping on the session, else 404. The GET returns the current override, or the packaged original — plus the packaged copy for diffing when an override exists. The save is a PATCH with {payload, updateIdentifier}; it validates the payload (a 400 for a bad payload or one that changes a structural field — immutability is checked against the per-resource fingerprints captured in the session’s structuralSnapshot — and 413 for an oversized one), stores the override on the session as a ResourceOverrideModel, and resets a previously failed mapping to pending so a retry picks it up. Every override write is optimistic-locked and audit-logged. The DELETE takes updateIdentifier as a query parameter and is an idempotent revert to the packaged payload. Reads are blocked while importing; writes while importing or validating.

When to reach for these — parameterising a package per environment rather than fixing one bad value — is the subject of Generating a package.

A mapped field is a DataEntityField carrying mapping.enabled — a field that copies a value from a parent entity, naming that parent’s field by UUID in mapping.sourceFieldId. Those UUIDs belong to the source environment, and the parent entity is usually mapped onto an entity that already exists in the target rather than written fresh, so the packaged id names nothing there. Import repairs this by matching the field’s fullNormalizedName instead; the sidecar that carries that name across the boundary is field-mapping-hints.json.

When that match cannot be made, the client decides what the field copies from, and the session cannot run until every such field is decided. The decisions ride the ordinary configuration save.

validationReport.mappedFields?: MappedFieldStatus[] (absent when the package has no mapped field the import writes) rides POST /v1/import/validate and GET /v1/import/{sessionId}, and PATCH /…/config answers with a fresh copy. There is one status per mapped field on an entity the import writes (mapped CREATE or OVERWRITE, plus fields that a skip-extension of an existing entity adds); fields whose parent is a core identity entity (users, groups, org units, working hours) are never listed, because those ids match everywhere.

type MappedFieldChoice =
| {kind: 'copyFrom'; targetFieldId: string}
| {kind: 'dontCopy'};
interface MappedFieldStatus {
entityId: string; entityName?: string; // the entity carrying the field (source-environment ids)
fieldId: string; fieldName: string; fieldLabel?: ILocalizedValue;
state: 'waiting' | 'matched' | 'unmatched' | 'unnamed' | 'decided' | 'unavailable';
updateMode: number; // 1 Never, 2 ParentOnly, 3 TwoWay (the default when absent)
sourceParentId: string; // the parent in the package's environment
targetParentId?: string; targetParentName?: string; targetParentLabel?: ILocalizedValue;
expectedSource?: {name: string; label?: ILocalizedValue; dataType?: number};
matchedField?: MappedFieldCandidate; // the field found on the target parent
decision?: MappedFieldChoice; // the standing decision, if any
candidates: MappedFieldCandidate[]; // may be EMPTY: then only dontCopy is offered
}
interface MappedFieldCandidate {
id: string; // target-parent field UUID
fullNormalizedName: string;
name?: Record<string, string | null>;
dataType: number;
}
stateMeaningClient action
waitingThe parent is created by this package; there is nothing to choose from yet.None.
matchedThe expected source field exists on the target parent (or the packaged parent is being written).None.
unmatchedThe package names the source field, but the target parent has no field with that name.Decide.
unnamedThe package cannot name the source field (no sidecar hint, parent snapshot not in the package).Decide.
decidedA valid decision stands for the current target parent.None (it may still be changed).
unavailableThe target parent could not be read.Retry later; a MAPPED_FIELD_SOURCE_UNAVAILABLE warning accompanies it.

candidates is not every field on the target parent. Three rules are mandatory — offering a candidate that fails any of them either silently produces wrong data or hard-fails the resource at data-service:

  1. Same data type. The candidate’s dataType must equal the mapped field’s.
  2. Relation targets must be a subset. For a reference field (dataType 7), every entity the candidate can point at must be one the local field already accepts. A superset would let a reference be copied into a field that cannot hold it; requiring exact equality would wrongly reject a safe narrower candidate. A candidate with no determinable target set is rejected, and a local field with no determinable target set empties the whole list — the rule fails closed.
  3. TwoWay must agree on required. When updateMode is TwoWay (3), the candidate’s validations.required must equal the mapped field’s, because data-service rejects the entire resource when a two-way source field disagrees.

Display-only fields (options.displayOnly.enabled) are excluded outright. A packaged mapping with no updateMode is treated as TwoWay, deliberately over-filtering rather than offering a candidate that would hard-fail later. candidates may legitimately be empty.

Send the decisions with PATCH /v1/import/{sessionId}/config as mappedFieldDecisions — the full list, which replaces the stored one (so send every decision you want to keep, not just the one that changed):

{
"mappedFieldDecisions": [
{"entityId": "0b6d…", "fieldId": "f1…", "targetParentId": "9f2a…",
"decision": {"kind": "copyFrom", "targetFieldId": "c7e3…"}},
{"entityId": "0b6d…", "fieldId": "f2…", "targetParentId": "9f2a…",
"decision": {"kind": "dontCopy"}}
],
"updateIdentifier": "58c0…"
}

A malformed item is 400 MAPPED_FIELD_DECISION_INVALID. The response adds mappedFields (the recomputed statuses) and canProceed. A decision is bound to the targetParentId it was made for and survives only while that is still the field’s target parent and the choice is still offered (dontCopy always; copyFrom only the matched field or a listed candidate). A save that changes what the parent maps to — a resource mapping or an unmapped-dependency target — therefore drops decisions that no longer fit, and its response already carries the new statuses.

What blocks. Each field in unmatched or unnamed without a decision is a validation error, MAPPED_FIELD_SOURCE_UNDECIDED (“Choose what ‘entity.field’ copies from before installing.”), the first 20 in full and one summary item after that, so canProceed is false until all are decided. Execute and retry re-check and refuse with 409 MAPPED_FIELD_SOURCE_UNDECIDED (naming up to ten fields) or, when a parent cannot be read, 503 MAPPED_FIELD_SOURCE_UNAVAILABLE.

What a decision does at execute. copyFrom sets mapping.sourceFieldId to the chosen field. dontCopy sets mapping.enabled = false and, when updateMode is Never (1) or ParentOnly (2) and the field carries a locked block, also clears locked.enabled — otherwise the field would import locked with nothing able to populate it. A field with no decision still goes through name matching: a match rewrites sourceFieldId, and a miss leaves the mapping as declared with an import warning that it will not copy until it is fixed. Nothing is ever disabled without a decision.

A headless store install or update cannot decide for the user: an undecided mapped field comes back among its unresolved choices (kind: 'mappedField'), and the run is refused until it is decided on the import page.

No body. The gatekeeping sequence, in order:

  1. If the session was cancelled, the call is refused with 409 IMPORT_SESSION_CANCELLED (Since 1.10) — start a new import. Otherwise, if the session is already failed or completed, the call delegates to retry — a client may treat execute as “run it” without tracking which of the two it needs.
  2. Every unmapped dependency required by a resource the import will actually write (action CREATE or OVERWRITE) must have a target — otherwise 400. Dependencies needed only by skipped resources do not block. At the development-line head (1.11.0-alpha.4) this check does not yet distinguish an optional hard: false row, although the import page lets Execute through with one unmapped — see the caution under Page widgets pointing outside the package.
  3. Since 1.10 every mapped field that needs a decision must have one — otherwise 409 MAPPED_FIELD_SOURCE_UNDECIDED, or 503 MAPPED_FIELD_SOURCE_UNAVAILABLE when a target parent cannot be read (see Mapped-field decisions).
  4. Every value reference consumed by an actively written resource must have an action. Safe defaults are applied first — a reference that exists in the target defaults to KEEP, one with a packaged payload to AUTO_CREATE — and only what remains unresolvable is a 400; Since 1.10 its code is VALUE_REFERENCE_ACTION_UNSET. An AUTO_CREATE whose identity key (a user’s email or username, for instance) already matches an entry in the target is refused for that reference with VALUE_REFERENCE_IDENTITY_COLLISION rather than creating a duplicate principal.
  5. Since 1.10 the tenant must have room for every entry the run will create: packaging asks data-service up front and refuses with 403 ENTRY_CAP_EXCEEDED (“…past its entries limit. Archive or delete entries, or upgrade the plan, then install again.”). Nothing has been written at that point. Any other failure of this check is logged and the run goes on, because each create is still checked on its own.
  6. The session is claimed by an atomic validated → importing transition. Losing that race — a concurrent execute, or a session that moved — is a 409, never a double execution.

The response is {jobId, sessionId} (ImportExecuteResponse): the work is queued, not done. Poll /status until the state machine reaches completed or failed.

No body. Accepted only in completed or failed (else 409) — and, Since 1.10, never on a cancelled session (409 IMPORT_SESSION_CANCELLED) — claimed atomically like execute. Since 1.10 it re-checks the mapped-field decisions and the entries limit exactly as execute does — the limit is counted against the rows the reset will re-open, so entries that only a cascade-skipped resource needed are included. Failed and cascade-skipped mappings are reset to pending — cascade-skipped ones get their original action back, recomputed from the session’s strategy — and failed or skipped value references are re-opened. Already imported resources are not re-imported; the retry re-attempts only what did not land. Returns {jobId, sessionId}.

No body. Accepted while validated or importing; any other status is a 400. The session is atomically flipped to failed with a Cancelled: … error message, and the queued job is removed; a worker already running notices the marker between resources and aborts. Resources written before the abort remain — cancellation stops the import, it does not undo it. Since 1.10 cancellation is also final: the session records cancelledAt, and execute or retry on it answers 409 IMPORT_SESSION_CANCELLED. Returns {outcome, state?}.

The result of a finished run (importResult on /status) gained importWarnings in 1.10. It reports what the import changed rather than fail on:

  • Index replacement. An imported entity’s custom indexes replace the target’s, and an index whose field path the target cannot index is dropped with a warning such as Dropped index "<name>": field path <path> not found instead of failing the entity.
  • Files that did not transfer. A resource still carrying a source-tenant file id (the export could not download it, or the import could not upload it) used to fail with FILE_EXPIRED; the file is now removed from the resource — cleared, dropped from an array, or removed as a thumbnail — with one warning per document. A file id that resolves in the target storage (a same-tenant import) is kept.
  • Mapped fields left as declared. A mapped field with no decision whose source the name match still cannot find at run time keeps its mapping as declared, with a warning that it will not copy until it is fixed.

Deletes an abandoned session. Refused with a 409 while the session is importing; carries the updateIdentifier as a query parameter so a stale tab cannot delete a session someone else has moved.

GET /v1/import/{sessionId} returns the ImportSession (persisted in the MongoDB collection ImportSession). Its key fields:

FieldPurpose
idUUID v4 (generated at validate).
spaceIdTarget space.
statusImportSessionStatus — see the state machine.
packageFileId / packageFileNameStorage-service reference to the ZIP (re-downloaded at execute).
manifestParsed package manifest.
validationReportPhase 1 output.
resourceMappingsPer-resource decisions (see ResourceMapping below).
valueReferenceMappingsEntry-level reference decisions.
unmappedDependencyMappingsTargets for external dependencies not in the package.
resourceOverridesUser-edited payloads applied at execute.
structuralSnapshotPer-resource immutable-field fingerprints.
importResultPhase 2 aggregate result.
importJobIdBullMQ job id (for cancel).
importStrategyBulk strategy; default MANUAL.
updateIdentifierOptimistic-concurrency token (UUID; rotated on each write — see below).
EnumValues
ImportSessionStatusvalidating, validated, importing, completed, failed
ImportStrategyMERGE_NEW_ONLY (CREATE new, SKIP existing), OVERWRITE_ALL (CREATE new, OVERWRITE existing), MANUAL (default; per-resource as-is)
MappingActionCREATE, OVERWRITE, SKIP — a SKIP on an existing resource still registers its id mapping, so other resources’ references resolve to it (this is the web app’s Map)
ResourceImportStatuspending, completed, failed, skipped, cascade_skipped
ValidationStatusNEW, EXISTING
ValueReferenceActionKEEP, REMAP, NULL, AUTO_CREATE
EntryReferenceSourceStatusFOUND, NOT_FOUND, ARCHIVED
ModuleConflictResolutionMOVE, KEEP

The user-editable decision per resource: sourceType, sourceId, normalizedName, displayName?, action, targetId? (existing target, or filled after CREATE), status?, errorMessage?, isHardDep?, moduleConflictResolution? (MOVE/KEEP for a remapped-module conflict), entityId?, moduleId?.

Persisted after Phase 2 and returned by GET /…/status: created, overwritten, skipped, cascadeSkipped, errors, resources[] ({sourceId, targetId, type, action}), importErrors[] ({sourceId, type, message}), valueReferenceResults[], importWarnings (Since 1.10, see above), plus the value-reference counters entriesAutoCreated, entriesAutoCreateFailed, entriesKept, entriesRemapped and entriesNulled.

Every mutating write on a session carries an optimistic-concurrency token. The session’s updateIdentifier is seeded at creation and rotated on every successful write; each write must echo the token the client last saw, and the response returns the new one, which the client must adopt.

A mismatch is a 409 whose error.code is STALE_UPDATE_IDENTIFIER — deliberately distinguishable from the status-gate 409s such as “cannot modify config for session in status: importing”, which share the HTTP status but not the code. On STALE_UPDATE_IDENTIFIER, reload the session and let the user reconcile; on a status-gate 409, re-read the status and follow the state machine.

No-op writes — an empty config save, an accept-exact with nothing to accept, a delete of an override that does not exist — still check the token but do not rotate it, so a client’s lock state stays consistent across them.

EndpointAccepted statusesOn violation
PATCH /…/configvalidated, failed409
PATCH /…/suggestions/accept-exactvalidated, failed409
PATCH /…/strategyvalidated409
GET /…/resource/…/payloadany except importing409
PATCH / DELETE /…/resource/…/payloadany except importing, validating409
POST /…/executevalidated (terminal states delegate to retry; never a cancelled session)409
POST /…/retrycompleted, failed (never a cancelled session)409
POST /…/cancelvalidated, importing400
DELETE /…/{sessionId}any except importing409

Reads (GET sessions, session, status) carry no status gate — only the space-ownership check.

Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27