-
-
Notifications
You must be signed in to change notification settings - Fork 0
Timers
Manage the live running timer in Teamleader Focus.
Timers let you track work in real time. Starting a timer begins counting; stopping it automatically creates a completed time tracking entry. Only one timer can run at a time per account.
Access via Teamleader::timers().
work_type_id+subjectare both required onstart()β missing either throws before the request.
stop()creates a time tracking entry and returnsdata.time_tracking.idβ the new entry's UUID.The update method is
updateCurrent(), notupdate().No
delete()method β usestop()to end the timer instead.
isRunning()swallows exceptions β it returnsfalseon any API error.Subject types differ from Time-Tracking β
nextgenTaskis not a valid timer subject type.
timers
| Capability | Supported |
|---|---|
| Pagination | β Not supported |
| Filtering | β Not supported |
| Sorting | β Not supported |
| Sideloading | β Not supported |
| Creation | β
Via start()
|
| Update | β
Via updateCurrent()
|
| Deletion | β Use stop()
|
Both subject and work_type_id are required and validated. Subject type is validated against the list below.
use McoreServices\TeamleaderSDK\Facades\Teamleader;
$timer = Teamleader::timers()->start([
'work_type_id' => 'work-type-uuid',
'subject' => ['type' => 'company', 'id' => 'company-uuid'],
'description' => 'Client strategy session',
'invoiceable' => true,
'started_at' => '2025-05-12T09:00:00+02:00', // optional β defaults to now
]);Returns the running timer, or ['data' => []] if no timer is active.
$timer = Teamleader::timers()->current();
if (!empty($timer['data'])) {
echo "Running since: " . $timer['data']['started_at'];
}Stops the running timer and creates a time tracking entry. Returns data.time_tracking.id.
$result = Teamleader::timers()->stop();
$entryId = $result['data']['time_tracking']['id'];
// Fetch the full entry
$entry = Teamleader::timeTracking()->info($entryId);Updates the currently running timer. Throws if no timer is running.
Teamleader::timers()->updateCurrent(['description' => 'Updated: now doing code review']);
Teamleader::timers()->updateCurrent(['invoiceable' => false]);Returns true if a timer is active. Catches all exceptions internally β returns false on any API error.
if (Teamleader::timers()->isRunning()) {
// safe to call stop(), current(), or updateCurrent()
}Convenience wrapper for start(). Subject type validated.
Teamleader::timers()->startForSubject(
'ticket',
'ticket-uuid',
'support-work-type-uuid',
['description' => 'Fixing reported bug', 'invoiceable' => true]
);company, contact, event, todo, milestone, ticket
Note:
nextgenTaskis not a valid timer subject type (unlike Time-Tracking entries).
// start() / current()
[
'data' => [
'id' => 'timer-uuid',
'description' => 'Client session',
'started_at' => '2025-05-12T09:00:00+02:00',
'invoiceable' => true,
'user' => ['type' => 'user', 'id' => 'user-uuid'],
'subject' => ['type' => 'company', 'id' => 'company-uuid'],
'work_type' => ['type' => 'workType', 'id' => 'work-type-uuid'],
],
]
// stop()
[
'data' => [
'time_tracking' => ['type' => 'timeTracking', 'id' => 'entry-uuid'],
],
]
// current() when nothing is running
['data' => []]if (!Teamleader::timers()->isRunning()) {
Teamleader::timers()->start([
'work_type_id' => 'work-type-uuid',
'subject' => ['type' => 'milestone', 'id' => 'milestone-uuid'],
'description' => 'Feature development',
]);
} else {
// stop first, then start
Teamleader::timers()->stop();
Teamleader::timers()->start([...]);
}$result = Teamleader::timers()->stop();
$entryId = $result['data']['time_tracking']['id'];
$entry = Teamleader::timeTracking()->info($entryId);
$hours = $entry['data']['duration'] / 3600;
echo "Tracked {$hours} hours.";use InvalidArgumentException;
// Missing work_type_id
try {
Teamleader::timers()->start(['subject' => ['type' => 'company', 'id' => 'uuid']]);
} catch (InvalidArgumentException $e) {
// 'work_type_id is required'
}
// Invalid subject type
try {
Teamleader::timers()->start([
'work_type_id' => 'uuid',
'subject' => ['type' => 'nextgenTask', 'id' => 'uuid'],
]);
} catch (InvalidArgumentException $e) {
// 'Invalid subject type. Must be one of: company, contact, event, todo, milestone, ticket'
}- Time Tracking β The completed entries created when a timer is stopped
-
Work Types β
work_type_idrequired to start a timer
Last Updated: August 2026 β’ SDK Version: 2.2.2 β’ Made with β€οΈ by MCore Services
- Departments
- Users
- Teams
- Custom Fields
- Work Types
- Document Templates
- Currencies
- Notes
- Email Tracking
- Closing Days
- Day Off Types
- Days Off
- User Schedules
- Invoices
- Credit Notes
- Subscriptions
- Payment Methods
- Payment Terms
- Tax Rates
- Withholding Tax Rates
- Commercial Discounts
Next Gen Projects
Legacy Projects