Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Upload CSV to list API

Replace all rows of a Drivetrain list with the contents of a CSV file in a single POST request. Covers the endpoint, CSV format rules, the response, and error codes.

Use this API to replace all rows of an existing list in your Drivetrain tenant with the contents of a CSV file, in a single call. The changes are synced to the list's dataset before the API returns.

Method: POST

Path: https://{your_subdomain}.drivetrain.ai/drive/api/v1/public/lists/{listId}/csv

Headers:

  • apikey (MANDATORY)

  • Content-Type: text/csv (MANDATORY). Requests without it are rejected with 415 Unsupported Media Type.

Body: the raw CSV file.

Path parameters

Parameter
Description

listId (MANDATORY)

The numeric ID of the list whose rows you want to replace.

To find a list ID, see How to find a list ID.

CSV format

  • The first row must be the header row.

  • Headers must exactly match the list's columns.

  • Leave out formula columns. Don't include them in the CSV.

  • Quoted values, such as "Eng, Platform", are supported.

  • UTF-8 files with a byte order mark (BOM) are supported. This includes files exported from Excel as CSV UTF-8.

Curl command example

Sample response

Response fields

Field
Description

success

true when the upload is saved.

rowsUploaded

Number of rows from the CSV that were saved to the list.

How the upload works

  • Full replace: existing rows are deleted and replaced by the rows in the CSV. List settings, such as columns, scenarios, and overrides, are kept.

  • Idempotent: uploading the same file again gives the same result.

  • All-or-nothing: if anything in the CSV is invalid, nothing is saved.

  • No empty uploads: a CSV with headers but no data rows is rejected, because it would empty the list.

  • Sync timing: the list's dataset is synced before the response returns. Downstream datasets derived from the list rebuild asynchronously right after.

Validation rules & error handling

Condition
Result

CSV headers don't match the list's columns

400 Bad Request. The response lists the extra headers in newColHeaders and the missing ones in missingColHeaders.

One or more cells fail validation

400 Bad Request. The response includes rowErrors, with details for up to the first 100 rows that have errors.

CSV is empty, has no data rows, or can't be parsed

400 Bad Request

Missing or invalid apikey

401 Unauthorized

The apikey user doesn't have the Admin role

403 Forbidden

listId not found, or the list belongs to a non-current version

404 Not Found

Another edit to this list is in progress

409 Conflict. Retry the request.

Content-Type isn't text/csv or text/plain

415 Unsupported Media Type

Sample error responses

Column mismatch

Cell validation errors

rowIndex is 0-based and doesn't count the header row. For example, rowIndex: 1 is the second data row in the CSV.

Last updated

Was this helpful?