Skip to main content
PATCH
/
v2
/
imports
/
{import_id}
/
rows
Patch Import Rows
const options = {
  method: 'PATCH',
  headers: {
    'x-api-key': '<x-api-key>',
    'x-organization-id': '<x-organization-id>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({corrections: {}})
};

fetch('https://api.dcycle.io/v2/imports/{import_id}/rows', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "updated_rows": {},
  "total_errors_remaining": 123
}

Patch Import Rows

Apply corrections to individual cells in the import session. The backend revalidates the corrected rows and returns updated row data with the remaining error count. Use this to fix validation errors without re-uploading the file.
Corrections are applied cell-by-cell. Each correction targets one row and one column. You can send up to 10,000 corrections per request.

Request

Headers

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Path Parameters

import_id
string
required
UUID of the import sessionExample: "11111111-1111-1111-1111-111111111111"

Body Parameters

corrections
array[object]
required
List of cell-level corrections (max 10,000)

Response

updated_rows
array[object]
The corrected rows after revalidation, each with row_index, data, and errors
total_errors_remaining
integer
Total number of rows with errors remaining in the entire session after applying corrections

Example

curl -X PATCH "https://api.dcycle.io/v2/imports/11111111-1111-1111-1111-111111111111/rows" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}" \
  -H "Content-Type: application/json" \
  -d '{
    "corrections": [
      {"row_index": 14, "column": "weight", "value": 800},
      {"row_index": 87, "column": "date", "value": "2024-03-20"}
    ]
  }'

Successful Response

{
  "updated_rows": [
    {
      "row_index": 14,
      "data": {
        "origin": "Valencia",
        "destination": "Sevilla",
        "weight": "800",
        "vehicle_type": "van",
        "date": "2024-03-16"
      },
      "errors": {}
    },
    {
      "row_index": 87,
      "data": {
        "origin": "Bilbao",
        "destination": "Madrid",
        "weight": "1200",
        "vehicle_type": "truck",
        "date": "2024-03-20"
      },
      "errors": {}
    }
  ],
  "total_errors_remaining": 1
}

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
{"detail": "Not Found"}

422 Unprocessable Entity

Cause: Invalid corrections format or missing required fields
{
  "detail": [
    {
      "loc": ["body", "corrections"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

Get Import Rows

View rows and identify errors

Delete Rows

Remove rows instead of fixing them

Submit Import

Submit once all errors are resolved