Get Unique Category Values
Get Unique Category Values
Return capped distinct raw values for mapped category columns in an import session
POST
Get Unique Category Values
Get Unique Category Values
Use this endpoint after column mapping and before validation when your client needs to build a value-mapping step for category fields. Given the current column mapping, the backend returns:- category columns only
- the mapped source column name from the uploaded file
- distinct non-empty raw values found in that source column
- whether the distinct value list was truncated at the backend cap
logistics_recharges, where fields such as country, fuel, and toc may need user review before row-level validation starts.
Each value in the response includes a
resolved canonical value and a status field (matched or unmatched). Use these to pre-fill your value-mapping UI — matched values can be accepted automatically, while unmatched ones need user attention.Request
Path Parameters
UUID of the import session created with
POST /v2/imports/sessions.Headers
Your API key for authentication.
Your organization UUID. The import session must belong to this organization.
Body
The current source-to-template column mapping. This uses the same shape as
POST /v2/imports/{import_id}/validate.Keys are template column keys and values are source column names from the uploaded file.Response
Distinct values grouped by mapped category column, returned in template order.
Examples
Fetch unique values for mapped category columns
Successful response
Typical Usage In The Imports Flow
- Call
POST /v2/imports/{import_id}/mapping/suggest. - Let the user confirm or adjust the column mapping.
- Call
POST /v2/imports/{import_id}/unique-values. - For each returned category column, render a value-mapping UI. Pre-fill matched entries using the
resolvedfield — only unmatched values need user attention. - Use
GET /v2/imports/options/{source_key}or template inlineoptionsto present canonical choices for unmatched values. - Once value mapping is confirmed, pass it as
value_mappingstoPOST /v2/imports/{import_id}/validate.
Notes And Limits
- Only template columns with
type="category"are included. - Columns without a mapped source column are skipped.
- Empty values and whitespace-only values are excluded.
- Distinct values are capped to avoid oversized payloads.
- If
truncated=true, prompt the user to clean the source data or narrow the upload before relying on the full distinct set.
Common Errors
400 Bad Request
Cause: The mapping references unknown target columns, unknown source columns, or invalid duplicate mappings. Solution: Reuse the same validated mapping structure you would send to thevalidate endpoint.
403 Forbidden
Cause: The import session belongs to a different organization. Solution: Use the correctx-organization-id for the session you created.
404 Not Found
Cause: The import session or its template could not be found. Solution: Confirm theimport_id is valid and the session still exists.
