Welcome to the Traballa API. This API allows you to interact with the Traballa system programmatically.
All API requests require authentication using a Bearer token, which you can obtain through the /api/auth endpoint.
https://traballa.me/api
Authenticates a user and returns an access token.
{
"email": "[email protected]",
"password": "your_password"
}
{
"status": "success",
"data": {
"token": "your_access_token",
"user": {
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"role": "user"
}
}
}
Returns a list of all users (admin only).
Authorization: Bearer your_access_token
{
"status": "success",
"data": {
"users": [
{
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"role": "user",
"created_at": "2025-01-01 12:00:00"
},
...
]
}
}
Returns details for a specific user (admin or self only).
Authorization: Bearer your_access_token
{
"status": "success",
"data": {
"user": {
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"role": "user",
"created_at": "2025-01-01 12:00:00"
}
}
}
Returns a list of projects the authenticated user has access to.
Authorization: Bearer your_access_token
{
"status": "success",
"data": {
"projects": [
{
"id": 1,
"name": "Project Name",
"description": "Project description",
"status": "active",
"organization_name": "Organization Name",
"is_manager": 1
},
...
]
}
}
Returns details for a specific project.
Authorization: Bearer your_access_token
{
"status": "success",
"data": {
"project": {
"id": 1,
"name": "Project Name",
"description": "Project description",
"status": "active",
"organization_id": 1,
"organization_name": "Organization Name"
}
}
}
Returns a list of organizations the authenticated user is a member of.
Authorization: Bearer your_access_token
{
"status": "success",
"data": {
"organizations": [
{
"id": 1,
"name": "Organization Name",
"description": "Organization description",
"is_admin": 1
},
...
]
}
}
Returns details for a specific organization.
Authorization: Bearer your_access_token
{
"status": "success",
"data": {
"organization": {
"id": 1,
"name": "Organization Name",
"description": "Organization description"
}
}
}
Returns work hours for the authenticated user with optional filters.
Authorization: Bearer your_access_token
start_date - Start date (format: YYYY-MM-DD)end_date - End date (format: YYYY-MM-DD)project_id - Filter by project IDorganization_id - Filter by organization ID{
"status": "success",
"data": {
"work_hours": [
{
"id": 1,
"user_id": 1,
"project_id": 1,
"clock_in": "2025-06-15 09:00:00",
"clock_out": "2025-06-15 17:00:00",
"status": "completed",
"total_hours": 8.00,
"project_name": "Project Name",
"organization_name": "Organization Name"
},
...
]
}
}
Clock in to a project.
Authorization: Bearer your_access_token
{
"project_id": 1
}
{
"status": "success",
"data": {
"message": "Successfully clocked in",
"work_hour_id": 1,
"clock_in": "2025-06-15 09:00:00"
}
}
Clock out from a work session.
Authorization: Bearer your_access_token
{
"status": "success",
"data": {
"message": "Successfully clocked out",
"work_hour_id": 1,
"clock_out": "2025-06-15 17:00:00",
"total_hours": 8.00
}
}
When errors occur, the API will return an appropriate HTTP status code along with a JSON error message:
{
"status": "error",
"message": "Error description"
}
400 Bad Request - Invalid request parameters401 Unauthorized - Missing or invalid authentication token403 Forbidden - Insufficient permissions404 Not Found - Resource not found405 Method Not Allowed - HTTP method not supported for this endpoint500 Internal Server Error - Server-side error