create_time_entry
Create time entries in FreshBooks to track billable hours for clients and projects. Specify start time, duration, and optional details like notes.
Instructions
Create a time entry. started_at as ISO8601 (e.g. '2026-03-20T09:00:00'). Duration in seconds.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| started_at | Yes | ||
| duration_seconds | Yes | ||
| client_id | No | ||
| project_id | No | ||
| note | No | ||
| billable | No |
Implementation Reference
- src/mcp_freshbooks/server.py:381-406 (handler)The implementation of the create_time_entry MCP tool, which creates a new time entry in FreshBooks.
async def create_time_entry( started_at: str, duration_seconds: int, client_id: int | None = None, project_id: int | None = None, note: str = "", billable: bool = True, ) -> str: """Create a time entry. started_at as ISO8601 (e.g. '2026-03-20T09:00:00'). Duration in seconds.""" data = { "started_at": started_at, "duration": duration_seconds, "is_logged": True, "billable": billable, } if client_id: data["client_id"] = client_id if project_id: data["project_id"] = project_id if note: data["note"] = note result = await client.projects_create("time_entries", "time_entry", data) te = result.get("time_entry", result) hours = duration_seconds // 3600 mins = (duration_seconds % 3600) // 60 return f"Time entry created (ID: {te.get('id')}). Duration: {hours}h{mins}m"