user_code are updated in place, while unrecognized user codes create new records. All processing happens inside a single database transaction, so a failure on any row rolls back the entire batch.
Endpoint
customer:add permission required.
multipart/form-data
Form Fields
The CSV file to upload. Must be a valid
.csv file with at least 3 data columns. The first row is treated as a header and is skipped during processing.The UUID of the courier organization to assign the imported customers to. Required for admin and manager roles. Courier role users have this field auto-set to their own account — passing it explicitly is not necessary and will be ignored.
CSV Format
The file must follow this column order. The first row (header row) is always skipped.| Column | Required | Description |
|---|---|---|
user_code | Yes | Unique customer identifier within the courier account |
first_name | Yes | Customer’s first name |
last_name | Yes | Customer’s last name |
branch | No | Branch or pickup location (leave blank if not applicable) |
Example CSV
The
branch column is optional. You may omit it entirely or leave the value blank for individual rows — both are handled correctly.Example Request
Response
Success
"success" when all rows in the file were processed without error.A human-readable summary indicating how many records were processed.
Upsert Behavior
The import usesuser_code as the unique key to determine whether a row creates a new customer or updates an existing one.
- New Customer (INSERT)
- Existing Customer (UPDATE)
If no customer with the provided
user_code exists in the courier account, a new customer record is created with the supplied first_name, last_name, and optional branch.Validation and Error Handling
The following rows are silently skipped and do not trigger a rollback:- Rows with fewer than 3 columns (missing
user_code,first_name, orlast_name) - The header row (first row of the file)
Role-Based Access
Courier role users do not need to provide
target_courier_id — all imported customers are automatically assigned to their own courier account. Admin and manager users must supply target_courier_id to specify which courier the customers belong to.| Role | target_courier_id |
|---|---|
| Courier | Auto-set; field is ignored if provided |
| Manager | Required |
| Admin | Required |