/distributors/import/validate - Validate CSV for distributor import

POST /distributors/import/validate

Upload and validate a CSV file for bulk distributor import. Returns row-by-row validation report. CSV columns: name, description, vat, address, city, main_contact, email, phone, language, notes. Max 1000 rows, max 10MB.

multipart/form-data

Body Required

  • file string(binary) Required

Responses

  • 200 application/json

    Validation report

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object
      Hide data attributes Show data attributes object
      • import_id string(uuid)

        Session ID to use when confirming the import

      • total_rows integer
      • valid_rows integer
      • error_rows integer
      • duplicate_rows integer
      • rows array[object]
        Hide rows attributes Show rows attributes object
        • row_number integer

          CSV row number (1-indexed, excluding header)

        • status string

          Validation status for this row

          Values are valid, error, or duplicate.

        • data object

          Parsed row data

          Additional properties are allowed.

        • errors array[object]

          Validation errors (empty if status is valid)

          Hide errors attributes Show errors attributes object
          • field string

            Field name that failed validation

          • message string

            Error code

          • value string

            The value that failed validation

  • 400 application/json

    Bad request - validation error

    Hide response attributes Show response attributes object
    • code integer

      HTTP error code

    • message string

      Error message

    • data object
      Hide data attributes Show data attributes object
      • type string

        Type of error

        Values are validation_error or external_api_error.

      • errors array[object]
        Hide errors attributes Show errors attributes object
        • key string

          Field name that failed validation

        • message string

          Error code or message

        • value string

          Value that failed validation

      • details

        Additional error details

  • 401 application/json

    Unauthorized - invalid or missing token

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object | null
  • 403 application/json

    Forbidden - insufficient permissions

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object | null
POST /distributors/import/validate
curl \
 --request POST 'https://api.your-domain.com/api/distributors/import/validate' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: multipart/form-data" \
 --form "file=@file"
Response examples (200)
{
  "code": 200,
  "message": "distributors import validated",
  "data": {
    "import_id": "550e8400-e29b-41d4-a716-446655440000",
    "total_rows": 50,
    "valid_rows": 45,
    "error_rows": 3,
    "duplicate_rows": 2,
    "rows": [
      {
        "row_number": 2,
        "status": "valid",
        "data": {},
        "errors": [
          {
            "field": "email",
            "message": "required",
            "value": "not-an-email"
          }
        ]
      }
    ]
  }
}
Response examples (400)
{
  "code": 400,
  "message": "validation failed",
  "data": {
    "type": "validation_error",
    "errors": [
      {
        "key": "username",
        "message": "required",
        "value": "string"
      }
    ]
  }
}
Response examples (401)
{
  "code": 401,
  "message": "invalid token",
  "data": {}
}
Response examples (403)
{
  "code": 403,
  "message": "insufficient permissions",
  "data": {}
}