Create a new time booking
Creates a new time booking entry to record working hours spent on a task or project.
What is a Time Booking? A time booking is a record of working hours that you have spent on a specific task or project. Time bookings are used for retroactive time tracking - documenting work that has already been completed.
Two types of time bookings:
- Task-based: Time logged to a specific task within a project. Use this when you want to track time for a particular work item (e.g., “Fix bug in login form”). The time automatically counts toward the parent project.
- Project-based: Time logged directly to a project without a specific task. Use this for general project activities that are not tied to a particular task (e.g., “Marketing research for Q1 campaign”).
Required information:
- Type: Either “task” or “project”
- Task ID (if type is “task”): The UUID of the task you worked on
- Project ID (if type is “project”): The UUID of the project
- Activity ID: The type of work performed (e.g., development, design, management). Activities are defined in your workspace settings.
- Hours: The amount of time spent (decimal format, e.g., 2.5 for 2 hours 30 minutes)
- Date: The date when the work was performed (ISO date format: YYYY-MM-DD)
Optional information:
- Minutes: Additional minutes (0-59) to add to the hours. If you provide both hours and minutes, they are combined (e.g., hours: 2, minutes: 30 = 2.5 hours total).
- Comment: Notes about what was accomplished during this time
How it works:
- Time bookings are always created for the authenticated user (you cannot log time for other users)
- When logging time to a task, the system automatically links it to the task’s parent project
- The time entry is immediately available in time tracking reports and project analytics
- Hours and minutes are combined: if you provide hours: 2 and minutes: 30, the total is 2.5 hours
Example use cases:
- Documenting time spent on a completed feature
- Recording billable hours for client projects
- Tracking time for internal projects and activities
- Completing time logs at the end of the day or week
Note: For real-time time tracking while working, use the Time Tracker feature instead of manual time bookings.
POST
/timebookingsAuthorization
AuthorizationOAuth2 access token · headerrequiredScopes:
api:writeor
AuthorizationBearer token (JWT) · headerrequiredRequest body
requiredapplication/jsonactivityIdstringrequiredUUID of the activity type that describes the work performed. Activities are defined in your workspace settings (e.g., "Development", "Design", "Management", "Research"). Activities help categorize time for reporting and analysis. Use GET /administration/task-settings/activities.
commentstringOptional comment describing what was accomplished during this time. Useful for documentation and later reference. Can be searched in the time tracking grid.
datestring<date>requiredDate when the work was performed. Must be in ISO 8601 date format (YYYY-MM-DD). This is the date the time is attributed to, not necessarily when the booking was created. You can log time retroactively for past dates.
hoursnumberrequiredNumber of hours logged. Must be a positive number. Can be a decimal (e.g., 2.5 for 2 hours 30 minutes). If you also provide minutes, they will be added to this value. Required if minutes is not provided or is 0.
idstringUUID of the task to log time to. Required when type is "task". The task must exist in your workspace and be linked to a project. Use GET /tasks/grid or GET /tasks/{identifier}.
minutesnumberAdditional minutes to add to the hours. Must be between 0 and 59. These minutes are converted and added to the hours value (e.g., hours: 2, minutes: 30 = 2.5 hours total). Optional - if not provided, defaults to 0.
projectIdstringUUID of the project to log time to. Required when type is "project". The project must exist in your workspace. Use GET /projects.
typestringrequiredType of time booking. Use "task" to log time to a specific task, or "project" to log time directly to a project. Task-based bookings are linked to both the task and its parent project. Project-based bookings are only linked to the project.
Allowed:
taskprojectResponses
201Time booking created successfully
successboolean400Invalid request data
401Unauthorized - Invalid or missing authentication token
403Missing permission to log time
Request
curl -X POST "https://leadtime.app/api/public/timebookings" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"activityId": "550e8400-e29b-41d4-a716-446655440004",
"comment": "Worked on feature implementation",
"date": "2025-01-15",
"hours": 2.5,
"id": "550e8400-e29b-41d4-a716-446655440001",
"minutes": 30,
"projectId": "550e8400-e29b-41d4-a716-446655440002",
"type": "task"
}'const response = await fetch("https://leadtime.app/api/public/timebookings", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"activityId": "550e8400-e29b-41d4-a716-446655440004",
"comment": "Worked on feature implementation",
"date": "2025-01-15",
"hours": 2.5,
"id": "550e8400-e29b-41d4-a716-446655440001",
"minutes": 30,
"projectId": "550e8400-e29b-41d4-a716-446655440002",
"type": "task"
})
});import requests
response = requests.post(
"https://leadtime.app/api/public/timebookings",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
json={
"activityId": "550e8400-e29b-41d4-a716-446655440004",
"comment": "Worked on feature implementation",
"date": "2025-01-15",
"hours": 2.5,
"id": "550e8400-e29b-41d4-a716-446655440001",
"minutes": 30,
"projectId": "550e8400-e29b-41d4-a716-446655440002",
"type": "task"
},
)Response
{
"success": true
}Invalid request data
Unauthorized - Invalid or missing authentication token
Missing permission to log time