-
-
Notifications
You must be signed in to change notification settings - Fork 0
Work Types
Read work type information in Teamleader Focus.
The Work Types resource provides read-only access to the work type definitions in your Teamleader account. Work types categorise time tracking entries and can carry hourly rates for billing purposes.
Work types cannot be created, updated, or deleted through the API. The info() method is not supported β use list() with an ids filter or the byIds() helper to retrieve specific work types.
workTypes
| Capability | Supported |
|---|---|
| Pagination | β Supported |
| Filtering | β Supported |
| Sorting | β Supported |
| Sideloading | β Not supported |
| Creation | β Not supported |
| Update | β Not supported |
| Deletion | β Not supported |
Note on
info(): Callinginfo()throws anInvalidArgumentException. UsebyIds(['uuid'])instead.
Returns work types matching the given filters, with optional sorting and pagination.
use McoreServices\TeamleaderSDK\Facades\Teamleader;
// All work types
$workTypes = Teamleader::workTypes()->list();
// Search by name
$workTypes = Teamleader::workTypes()->list([
'term' => 'consulting',
]);
// With pagination
$workTypes = Teamleader::workTypes()->list([], [
'page_size' => 50,
'page_number' => 1,
]);
// Sorted by name
$workTypes = Teamleader::workTypes()->list([], [
'sort' => [['field' => 'name', 'order' => 'asc']],
]);
// Combined
$workTypes = Teamleader::workTypes()->list(
['term' => 'development'],
['sort' => [['field' => 'name', 'order' => 'asc']], 'page_size' => 50]
);Shorthand for list(['term' => $term]).
$workTypes = Teamleader::workTypes()->search('design');Shorthand for list(['ids' => $ids]). Use this instead of info().
$workTypes = Teamleader::workTypes()->byIds(['uuid-1', 'uuid-2']);Returns work types sorted by name. Accepts an optional filters array.
// All work types AβZ
$workTypes = Teamleader::workTypes()->sortedByName();
// ZβA
$workTypes = Teamleader::workTypes()->sortedByName('desc');
// Filtered + sorted
$workTypes = Teamleader::workTypes()->sortedByName('asc', ['term' => 'consulting']);Explicit pagination shorthand. Accepts an optional filters array.
$workTypes = Teamleader::workTypes()->paginate(50, 1);
// With filters
$workTypes = Teamleader::workTypes()->paginate(50, 2, ['term' => 'design']);Filter by an array of work type UUIDs.
$workTypes = Teamleader::workTypes()->list([
'ids' => ['uuid-1', 'uuid-2'],
]);Search by work type name.
$workTypes = Teamleader::workTypes()->list([
'term' => 'development',
]);The only supported sort field is name.
| Field | Description |
|---|---|
name |
Sort alphabetically by work type name |
// Full array form
$workTypes = Teamleader::workTypes()->list([], [
'sort' => [['field' => 'name', 'order' => 'asc']],
]);
// String shorthand (also accepted)
$workTypes = Teamleader::workTypes()->list([], [
'sort' => 'name',
]);[
'data' => [
[
'id' => 'work-type-uuid',
'name' => 'Consulting',
],
],
'meta' => [
'page' => ['size' => 20, 'number' => 1],
'matches' => 8,
],
]$workTypes = Teamleader::workTypes()->sortedByName();
$options = array_column($workTypes['data'], 'name', 'id');
// ['uuid-1' => 'Consulting', 'uuid-2' => 'Development', ...]// info() is not supported β use byIds() instead
$result = Teamleader::workTypes()->byIds(['work-type-uuid']);
$workType = $result['data'][0] ?? null;Work types change infrequently. Cache them to avoid unnecessary API calls:
$workTypes = Cache::remember('tl_work_types', 3600, function () {
return Teamleader::workTypes()->sortedByName();
});$all = [];
$page = 1;
do {
$response = Teamleader::workTypes()->list([], [
'page_size' => 100,
'page_number' => $page,
]);
$all = array_merge($all, $response['data']);
$page++;
} while (count($response['data']) === 100);use InvalidArgumentException;
use McoreServices\TeamleaderSDK\Exceptions\TeamleaderException;
// info() throws immediately β use byIds() instead
try {
$workType = Teamleader::workTypes()->info('work-type-uuid'); // throws InvalidArgumentException
} catch (InvalidArgumentException $e) {
$result = Teamleader::workTypes()->byIds(['work-type-uuid']);
}
// Standard error handling for list()
try {
$workTypes = Teamleader::workTypes()->list(['term' => 'consulting']);
} catch (TeamleaderException $e) {
Log::error('Teamleader error', ['message' => $e->getMessage()]);
}- Time Tracking β Time entries are categorised by work type
- Users β Users can have an external rate per work type
- Filtering β Filter and pagination reference
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