Skip to main content

Employees

List All Employees

curl -X GET "${VITE_BASE_URL}/employee" \
  -H "Authorization: Bearer <token>"
Retrieves a list of all employees. Authentication Required: Yes

Response

data
array
Array of employee objects
id
number
Employee unique identifier
first_name
string
Employee first name
last_name
string
Employee last name
email
string
Employee email address
phone
string
Employee phone number
position
string
Job position or title
department
string
Department name
hire_date
string
Date of hire
status
string
Employment status (active, inactive)
photo_url
string
URL to employee photo
{
  "data": [
    {
      "id": 1,
      "first_name": "Juan",
      "last_name": "Pérez",
      "email": "[email protected]",
      "phone": "+52 55 1234 5678",
      "position": "Sales Manager",
      "department": "Sales",
      "hire_date": "2023-01-15",
      "status": "active",
      "photo_url": "https://example.com/photos/juan.jpg"
    }
  ]
}

Get Employee by ID

curl -X GET "${VITE_BASE_URL}/employee/1" \
  -H "Authorization: Bearer <token>"
Retrieves a single employee by ID. Authentication Required: Yes

Path Parameters

id
number
required
Employee ID

Response

id
number
Employee unique identifier
first_name
string
Employee first name
last_name
string
Employee last name
email
string
Employee email
phone
string
Employee phone
position
string
Job position
department
string
Department
hire_date
string
Hire date
salary
number
Employee salary (if authorized)
status
string
Employment status
user
object
Associated user account if exists
{
  "id": 1,
  "first_name": "Juan",
  "last_name": "Pérez",
  "email": "[email protected]",
  "phone": "+52 55 1234 5678",
  "position": "Sales Manager",
  "department": "Sales",
  "hire_date": "2023-01-15",
  "salary": 50000.00,
  "status": "active",
  "photo_url": "https://example.com/photos/juan.jpg",
  "user": {
    "id": 10,
    "email": "[email protected]",
    "role_id": 3
  }
}

Create Employee

curl -X POST "${VITE_BASE_URL}/employee" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: multipart/form-data" \
  -F "first_name=María" \
  -F "last_name=García" \
  -F "[email protected]" \
  -F "phone=+52 55 9876 5432" \
  -F "position=Marketing Coordinator" \
  -F "department=Marketing" \
  -F "hire_date=2024-03-01" \
  -F "salary=35000" \
  -F "photo=@/path/to/photo.jpg"
Creates a new employee record. Authentication Required: Yes
Content-Type: multipart/form-data

Request Body

first_name
string
required
Employee first name
last_name
string
required
Employee last name
email
string
required
Employee email address
phone
string
Employee phone number
position
string
required
Job position or title
department
string
Department name
hire_date
string
required
Date of hire (YYYY-MM-DD format)
salary
number
Employee salary
status
string
Employment status (default: “active”)
photo
file
Employee photo file

Response

id
number
Created employee ID
message
string
Success message
{
  "id": 15,
  "message": "Employee created successfully"
}

Update Employee

curl -X PUT "${VITE_BASE_URL}/employee/1" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: multipart/form-data" \
  -F "position=Senior Sales Manager" \
  -F "salary=60000"
Updates an existing employee record. Authentication Required: Yes
Content-Type: multipart/form-data

Path Parameters

id
number
required
Employee ID to update

Request Body

Same fields as Create Employee (all optional for updates)

Response

message
string
Success message
{
  "message": "Employee updated successfully"
}

Delete Employee

curl -X DELETE "${VITE_BASE_URL}/employee/1" \
  -H "Authorization: Bearer <token>"
Deletes an employee record. Authentication Required: Yes

Path Parameters

id
number
required
Employee ID to delete

Response

message
string
Success message
{
  "message": "Employee deleted successfully"
}

Build docs developers (and LLMs) love