# Timesheets

Manage timesheet approvals and submissions

## Get All Timesheets

 - [GET /timesheets](https://api-docs.webwork-tracker.com/api/timesheets/gettimesheets.md): Retrieve all timesheets for a specific workspace. Supports filtering by status, date range, user ID, and specific timesheet ID. Results are paginated and can be sorted by creation date.

Filters:
- id: Filter by specific encrypted timesheet ID
- status: Filter by timesheet status (e.g., open, submitted, approved, rejected)
- date_from / date_to: Filter by date range
- user_id: Filter by user ID
- order_by: Sort by creation date (asc or desc)

Response Structure:
- Totals: Each timesheet includes user information (user_id, member), date range (date_from, date_to), total_minutes, submission details, and status.
- Daily Breakdown: The daily_breakdown object contains daily tracked time grouped by date. Each date has an array of project entries showing project_id, project_name, contract_id, and total_minutes for that day.
- Amount Information: total_amount fields (both at timesheet level and in daily breakdown) are only included if the authenticated user has permission to see rates in the workspace.

Pagination:
- Results are paginated with configurable page size
- Default: 20 items per page, maximum: 100

## Approve Timesheet

 - [PUT /timesheets/{timesheetId}/approve](https://api-docs.webwork-tracker.com/api/timesheets/approvetimesheet.md): Approve a submitted timesheet. Only workspace owners and executive managers can approve timesheets. The timesheet must be in 'submitted' status to be approved.

## Reject Timesheet

 - [PUT /timesheets/{timesheetId}/reject](https://api-docs.webwork-tracker.com/api/timesheets/rejecttimesheet.md): Reject a submitted timesheet with a reason. Only workspace owners and executive managers can reject timesheets. The timesheet must be in 'submitted' status to be rejected. A reason must be provided.

## Submit Timesheet

 - [PUT /timesheets/{timesheetId}/submit](https://api-docs.webwork-tracker.com/api/timesheets/submittimesheet.md): Submit a timesheet for approval. The timesheet must be in 'pending' or 'rejected' status to be submitted. Once submitted, it will be reviewed by workspace owners or executive managers.

## Unsubmit Timesheet

 - [PUT /timesheets/{timesheetId}/unsubmit](https://api-docs.webwork-tracker.com/api/timesheets/unsubmittimesheet.md): Unsubmit a previously submitted timesheet. This returns the timesheet to 'pending' status, allowing the user to make changes before resubmitting.

