Confirm Mapping
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({mapping: {}})
};
fetch('https://api.dcycle.io/v2/imports/{import_id}/mapping', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v2/imports/{import_id}/mapping"
payload = { "mapping": {} }
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v2/imports/{import_id}/mapping \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '{
"mapping": {}
}'{
"import_id": "<string>",
"mapping": {},
"status": "<string>"
}Confirm Mapping
Persist the user-chosen column mapping on the import session
POST
/
v2
/
imports
/
{import_id}
/
mapping
Confirm Mapping
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({mapping: {}})
};
fetch('https://api.dcycle.io/v2/imports/{import_id}/mapping', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v2/imports/{import_id}/mapping"
payload = { "mapping": {} }
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v2/imports/{import_id}/mapping \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--data '{
"mapping": {}
}'{
"import_id": "<string>",
"mapping": {},
"status": "<string>"
}← Imports
Persist the column mapping the user accepted (or adjusted) after reviewing suggestions. This transitions the session status from
parsed to mapped and makes the session resumable.
Confirming is optional — the Validate endpoint also accepts a mapping in the request body. However, confirming has two benefits: the mapping is persisted on the session (visible via List Sessions), and downstream calls behave consistently with what the user saw.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faPath Parameters
string
required
UUID of the import sessionExample:
"11111111-1111-1111-1111-111111111111"Body Parameters
object
required
Map of
{target_column: source_column | suggestion_object | null}. Each key is a template column key. The value can be:- A string (source column name)
- A suggestion object from Suggest Mapping (the
source_columnis extracted automatically) nullto leave the target unmapped
{"origin": "origin", "destination": "destination", "weight": "weight_kg", "date": "date"}Response
string
UUID of the import session
object
The normalized flat mapping persisted on the session (
{target: source_column | null})string
Updated session status (typically
mapped)Example
curl -X POST "https://api.dcycle.io/v2/imports/11111111-1111-1111-1111-111111111111/mapping" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "Content-Type: application/json" \
-d '{
"mapping": {
"origin": "origin",
"destination": "destination",
"weight": "weight_kg",
"vehicle_type": "vehicle_type",
"date": "date"
}
}'
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
"Content-Type": "application/json",
}
import_id = "11111111-1111-1111-1111-111111111111"
response = requests.post(
f"https://api.dcycle.io/v2/imports/{import_id}/mapping",
headers=headers,
json={
"mapping": {
"origin": "origin",
"destination": "destination",
"weight": "weight_kg",
"vehicle_type": "vehicle_type",
"date": "date",
}
},
)
result = response.json()
print(f"Status: {result['status']}")
print(f"Mapping: {result['mapping']}")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
'Content-Type': 'application/json',
};
const importId = '11111111-1111-1111-1111-111111111111';
axios.post(`https://api.dcycle.io/v2/imports/${importId}/mapping`, {
mapping: {
origin: 'origin',
destination: 'destination',
weight: 'weight_kg',
vehicle_type: 'vehicle_type',
date: 'date',
},
}, { headers })
.then(response => {
console.log(`Status: ${response.data.status}`);
});
Successful Response
{
"import_id": "11111111-1111-1111-1111-111111111111",
"mapping": {
"origin": "origin",
"destination": "destination",
"weight": "weight_kg",
"vehicle_type": "vehicle_type",
"date": "date"
},
"status": "mapped"
}
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
403 Forbidden
Cause: The authenticated user is not a member of the organization{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
404 Not Found
Cause: The import session does not exist or belongs to another organization. Both cases return the same response, so a session id from another organization is indistinguishable from one that does not exist.{"code": "NOT_FOUND", "detail": "ImportSessionModel with id='1b2c3d4e-5f60-7182-93a4-b5c6d7e8f901' not found"}
422 Unprocessable Entity
Cause: Invalid or missing mapping object{
"detail": [
{
"loc": ["body", "mapping"],
"msg": "field required",
"type": "value_error.missing"
}
]
}
Related Endpoints
Suggest Mapping
Get auto-suggested mappings first
Validate Import
Validate rows with the chosen mapping
Was this page helpful?