Imports
The Imports API is our new in-house replacement for the Nuvo-style import flow. It is designed for structured tabular uploads where a client needs to:- upload a source file
- map source columns to a Dcycle template
- inspect distinct raw values for category fields
- validate rows before ingestion
- patch a subset of rows when validation fails
- submit the cleaned dataset into downstream processing
dcy.
The Imports API is a session-based workflow. You do not send one big “import everything” request. Instead, you create an import session, validate it, optionally correct rows, and only then submit it.
End-to-End Flow
1. Create session
Call
POST /v2/imports/sessions with a template_id and the source file as multipart form data.The backend parses the file and returns:import_id- detected source columns
- sample rows
- sheet/header metadata
2. Suggest mapping
Call
POST /v2/imports/{import_id}/mapping/suggest.This returns a best-effort mapping suggestion from source columns to template columns. Clients can accept these suggestions as-is or adjust them before validation.3. Inspect category values
Call
POST /v2/imports/{import_id}/unique-values with the current mapping.The backend returns distinct raw values for mapped category columns only. This is the right moment to build a value-mapping UI before row-level validation starts.4. Validate rows
Call
POST /v2/imports/{import_id}/validate with the chosen mapping.The response includes:valid_rowserror_rowserrors_by_column- paginated row-level validation output
5. Review rows
Call
GET /v2/imports/{import_id}/rows to page through the processed rows.Use errors_only=true when you only want rows that still need action.6. Patch corrections
If some rows are invalid, call
PATCH /v2/imports/{import_id}/rows with row-level corrections.The backend revalidates the corrected rows and returns updated row data plus the remaining error count.7. Submit import
Once the session is valid, call
POST /v2/imports/{import_id}/submit.Submission creates the downstream processing artifact and starts the heavy processing pipeline.Recommended Client Behavior
For most clients, the safest workflow is:- Create the session.
- Request mapping suggestions.
- Inspect distinct values for mapped category columns.
- Validate with the chosen mapping.
- If there are errors, fetch or display only invalid rows.
- Patch corrections until the session is clean.
- Submit the import.
- Poll status until downstream processing has clearly started.
Typical Session Example
1. Create the session
2. Ask for mapping suggestions
3. Validate using a chosen mapping
4. Inspect distinct category values
5. Patch one bad row
6. Submit the import
Template Metadata
UseGET /v2/imports/templates/{template_id} to retrieve the target template definition before or during mapping.
This is helpful when clients need to:
- render a column picker
- show required vs optional target fields
- display allowed category options
- apply defaults from the backend template definition
options_source instead of inline options, call
GET /v2/imports/options/{source_key} to fetch the resolved list of selectable
values and labels from the backend registry.
When a client needs to inspect the raw values present in the uploaded file before
validation, call POST /v2/imports/{import_id}/unique-values with the chosen mapping.
Typical examples:
countriesfor country fieldslogistics_tocsfor logistics vehicle typesfuelsfor logistics recharge fuel selection
Status Lifecycle
createdbriefly at session creation time before parsing metadata is persistedparsedafter session creationvalidatedafter a successful validation passsubmittedafter the import has been handed off for downstream processing
Best Practices
- Persist the
import_idon the client side so users can safely resume a session. - Use
errors_only=truewhen rendering review tables for large imports. - Use the unique-values endpoint before validation if your client supports category value mapping.
- Treat mapping suggestions as hints, not guaranteed matches.
- Do not submit until validation is clean unless you intentionally support
ignore_errors=true. - Use the template metadata endpoint to avoid hardcoding target columns in the client.

