Documentation Index
Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
Use this file to discover all available pages before exploring further.
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.Required form fields:template_id— backend template identifier (e.g.logistics_requests)upload_file— the source CSV/XLSX file
numeric_locale— locale for decimal parsing (e.g.es_ES)date_locale—DateLocaleEnumvalue for date parsing when the source uses a non-ISO formatsheet_name— sheet to read for multi-sheet XLSX uploadsproject_id/folder_id— UUIDs scoping the import to a project or folderraw_file_id— UUID of a previously uploaded raw file to link the session to
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. Each suggestion includes a column_confidence, a value_confidence (category targets only), and a restored_from_history flag indicating when the match was lifted from a prior import rather than re-scored. Clients can accept these suggestions as-is or adjust them before validation.3. Confirm mapping (optional but recommended)
Call
POST /v2/imports/{import_id}/mapping with the mapping the user accepted.This persists the mapping on the session and transitions its status from parsed to mapped. It is optional because validate also accepts a mapping in the body, but confirming has two benefits:GET /v2/imports/sessionssurfaces the chosen mapping so a user can resume the session later- downstream calls (unique-values, validate) behave consistently with what the user saw
4. 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, each annotated with an auto-resolved canonical value and a matched / unmatched status. This is the right moment to build a value-mapping UI before row-level validation starts.5. Validate rows
Call
POST /v2/imports/{import_id}/validate with the chosen mapping. Optionally include value_mappings to pre-resolve category values the user remapped by hand.Query parameters:page,page_size— paginate the returned rowserrors_only=true— return only rows that still have validation issues
valid_rowserror_rowserrors_by_column- paginated row-level validation output
6. Review rows
Call Decoded:
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.Sort by any column with sort_by=<column_key> and sort_direction=asc|desc. When sort_by is omitted rows come back in original row_index order.Filter rows server-side with filters, a JSON-encoded object mapping column keys to allowed values:{"country": ["Spain", "France"], "fuel": ["diesel"]}.Semantics:- AND across columns, IN within a column. A row is returned when every listed column matches any of its listed values.
- Whitespace-insensitive. Values are compared after trimming, matching what the dropdown surfaces.
- Empty value list = no filter on that column. Sending
{"country": []}is equivalent to omittingcountry. To get zero rows, omit the request — there is no “match nothing” sentinel. - Caps: at most 20 filter keys per request, 500 values per key. Beyond either cap returns
422. - Allowed key characters:
[a-zA-Z0-9_]+.
GET /v2/imports/{import_id}/rows/column-values?column=<column_key>&filters=<json>. The endpoint returns the distinct values present in column under the other columns’ filters (the filter for column itself is automatically excluded so the user keeps seeing the full list available for that column):truncated is true when the unique-value count exceeds the server cap (currently 1000); total_unique always reports the real count of the filtered dataset.7. Patch corrections
If some rows are invalid, call
PATCH /v2/imports/{import_id}/rows with row-level corrections (max 500 per request).The backend revalidates the corrected rows and returns updated row data plus the remaining error count.8. Submit import
Once the session is valid, call
POST /v2/imports/{import_id}/submit with the x-partner header set to your partner identifier.Submission creates the downstream processing artifact and starts the heavy processing pipeline.9. Check status
Call
GET /v2/imports/{import_id}/status to retrieve the session status and processing summary.Recommended Client Behavior
For most clients, the safest workflow is:- Create the session.
- Request mapping suggestions.
- Confirm the chosen mapping so the session is resumable.
- Inspect distinct values for mapped category columns.
- Validate with the chosen mapping (and any user-supplied
value_mappings). - 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. Confirm the user-selected mapping
4. Validate using a chosen mapping
5. Inspect distinct category values
6. Patch one bad row
7. 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.

