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
Cause: The session’s project is no longer one your organization can import into (for example, the organization was unlinked from it). Every step of the session answers this, not only the submit. Create a new session on a project you work in.
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
Path Parameters
Body Parameters
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
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"}
{"code": "PROJECT_NOT_FOUND", "detail": "Project with id='9a8b7c6d-5e4f-3a2b-1c0d-e9f8a7b6c5d4' 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?