Add Staff List to Salary Advance Employee/Staff API
Onboard Staff With CSV- POST REQUEST
Test API Endpoint
POST https://apitest.fedacash.com/api/salaryadvance/v1/test/upload-staff
Live API Endpoint
POST https://api.fedacash.com/api/salaryadvance/v1/test/upload-staff
Request Headers
Authorization: Bearer your_secret_keyContent-Type: application/json
Sample Curl Request Body
curl -X POST "https://apitest.fedacash.com/api/salaryadvance/v1/test/upload-staff" \-H "Content-Type: multipart/form-data" \-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \-F "csv_file=@/path/to/your/file.csv"Success Response
{ "success": true, "message": "CSV data uploaded successfully", "data": [ { "id": 1, "first_name": "John", "last_name": "Doe", "email": "john@example.com", "phone_number": "234123456789", "profile_id": "generated_profile_id", "password_string": "generated_password", "role": "salary advance staff", "user_type": "salary advance staff", "role_token": "Pif8ey3fwVt4dStD", "active_status": 1, "company_name": "John Doe", "salary_advance_company": "Example Company" }, { "id": 2, "first_name": "Jane", "last_name": "Smith", "email": "jane@example.com", "phone_number": "234987654321", "profile_id": "generated_profile_id", "password_string": "generated_password", "role": "salary advance staff", "user_type": "salary advance staff", "role_token": "Pif8ey3fwVt4dStD", "active_status": 1, "company_name": "Jane Smith", "salary_advance_company": "Example Company" } // ... other uploaded employees ]}Error Response
{ "error": true, "message": "Unauthorized"}{ "error": true, "message": "Validation Error", "errors": { "csv_file": ["The csv file field is required."] }}{ "error": true, "message": "Errors were found in the csv upload! Please check your email for the list of errors.", "data": [ { "row_number": 1, "employee_data": { "first_name": "John", "last_name": "Doe", "email": "john@example.com", "phone_number": "123456789" }, "errors": ["Row does not have the same number of columns as the header."] }, { "row_number": 2, "employee_data": { "first_name": "Jane", "last_name": "Smith", "email": "jane@example.com", "phone_number": "0987654321" }, "errors": { "email": ["The email has already been taken."], "phone_number": ["The phone number must be a valid Nigerian phone number."] } } // ... other errors ]}