-
-
Notifications
You must be signed in to change notification settings - Fork 0
Users
Read user information in Teamleader Focus.
The Users resource provides read-only access to users in your Teamleader account. Beyond the standard list() and info() methods, it exposes me() for the currently authenticated user, getWeekSchedule() for working hour schedules, and listDaysOff() for leave records.
Users cannot be created, updated, or deleted through the API.
users
| Capability | Supported |
|---|---|
| Pagination | β Supported |
| Filtering | β Supported |
| Sorting | β Supported |
| Sideloading | β
Supported (external_rate only) |
| Creation | β Not supported |
| Update | β Not supported |
| Deletion | β Not supported |
Returns a paginated list of users with optional filtering and sorting.
use McoreServices\TeamleaderSDK\Facades\Teamleader;
// All users
$users = Teamleader::users()->list();
// Active users only
$users = Teamleader::users()->list([
'status' => ['active'],
]);
// With pagination and sorting
$users = Teamleader::users()->list(
['status' => ['active']],
[
'page_size' => 50,
'page_number' => 1,
'sort' => [['field' => 'last_name', 'order' => 'asc']],
]
);Returns a single user by UUID. Optionally includes external_rate.
// Basic info
$user = Teamleader::users()->info('user-uuid');
// With external rate β string form
$user = Teamleader::users()->info('user-uuid', 'external_rate');
// With external rate β fluent form
$user = Teamleader::users()
->withExternalRate()
->info('user-uuid');Returns the currently authenticated user. Takes no parameters.
$me = Teamleader::users()->me();
$firstName = $me['data']['first_name'];
$email = $me['data']['email'];Returns the weekly working schedule for a user. Only available if the Weekly working schedule feature is enabled on the Teamleader account.
$schedule = Teamleader::users()->getWeekSchedule('user-uuid');Returns leave records for a user, with optional date range filters and pagination.
Filter keys:
-
starts_afterβ include days off starting after this value -
ends_beforeβ include days off ending before this value
// All days off for a user
$daysOff = Teamleader::users()->listDaysOff('user-uuid');
// Filtered by date range
$daysOff = Teamleader::users()->listDaysOff('user-uuid', [
'starts_after' => '2025-01-01',
'ends_before' => '2025-12-31',
]);
// With pagination
$daysOff = Teamleader::users()->listDaysOff(
'user-uuid',
['starts_after' => '2025-01-01'],
['page_size' => 100, 'page_number' => 1]
);Shorthand for list(['status' => ['active']]).
$users = Teamleader::users()->active();Shorthand for list(['status' => ['deactivated']]).
$users = Teamleader::users()->deactivated();Shorthand for list(['term' => $term]). Searches across first name, last name, email, and function.
$users = Teamleader::users()->search('Sarah');
$users = Teamleader::users()->search('sarah@example.com');Shorthand for list(['ids' => $ids]).
$users = Teamleader::users()->byIds(['uuid-1', 'uuid-2']);Fluent method to include external_rate in the next info() call.
$user = Teamleader::users()
->withExternalRate()
->info('user-uuid');
$amount = $user['data']['external_rate']['amount'];
$currency = $user['data']['external_rate']['currency'];Filter by an array of user UUIDs.
$users = Teamleader::users()->list([
'ids' => ['uuid-1', 'uuid-2'],
]);Search across first name, last name, email, and function.
$users = Teamleader::users()->list([
'term' => 'developer',
]);Filter by status. Must be passed as an array.
| Value | Description |
|---|---|
active |
Active users |
deactivated |
Deactivated users |
$users = Teamleader::users()->list([
'status' => ['active'],
]);
// Both statuses
$users = Teamleader::users()->list([
'status' => ['active', 'deactivated'],
]);Pass a sort array in the options argument. Available sort fields:
| Field | Description |
|---|---|
first_name |
Sort by first name |
last_name |
Sort by last name |
email |
Sort by email address |
function |
Sort by job function / role |
$users = Teamleader::users()->list([], [
'sort' => [['field' => 'last_name', 'order' => 'asc']],
]);String shorthand is also accepted and normalised to the array format:
$users = Teamleader::users()->list([], [
'sort' => 'last_name',
]);The only available include is external_rate.
| Include | Description |
|---|---|
external_rate |
The user's external hourly rate |
See Sideloading for general sideloading patterns.
[
'data' => [
[
'id' => 'user-uuid',
'first_name' => 'Sarah',
'last_name' => 'De Smedt',
'email' => 'sarah@example.com',
'function' => 'Developer',
'status' => 'active', // 'active' or 'deactivated'
'avatar_url' => 'https://...',
],
],
'meta' => [
'page' => ['size' => 20, 'number' => 1],
'matches' => 14,
],
][
'data' => [
'id' => 'user-uuid',
'first_name' => 'Sarah',
'last_name' => 'De Smedt',
'email' => 'sarah@example.com',
'function' => 'Developer',
'status' => 'active',
'avatar_url' => 'https://...',
// Only present when external_rate is included:
'external_rate' => [
'amount' => 95.00,
'currency' => 'EUR',
],
],
]Same structure as info().
[
'data' => [
[
'starts_at' => '2025-07-14T08:00:00+02:00',
'ends_at' => '2025-07-14T17:00:00+02:00',
],
],
'meta' => [
'page' => ['size' => 20, 'number' => 1],
'matches' => 3,
],
]$users = Teamleader::users()->active();
$options = [];
foreach ($users['data'] as $user) {
$options[$user['id']] = $user['first_name'] . ' ' . $user['last_name'];
}
// ['uuid-1' => 'Sarah De Smedt', 'uuid-2' => 'Jan Peeters', ...]$me = Teamleader::users()->me();
$myId = $me['data']['id'];$all = [];
$page = 1;
$pageSize = 100;
do {
$response = Teamleader::users()->list(
['status' => ['active']],
['page_size' => $pageSize, 'page_number' => $page]
);
$all = array_merge($all, $response['data']);
$page++;
} while (count($response['data']) === $pageSize);Users change infrequently. Cache them to avoid unnecessary API calls:
$users = Cache::remember('tl_active_users', 3600, function () {
return Teamleader::users()->active();
});$daysOff = Teamleader::users()->listDaysOff('user-uuid', [
'starts_after' => now()->toDateString(),
'ends_before' => now()->addMonths(3)->toDateString(),
]);use McoreServices\TeamleaderSDK\Exceptions\NotFoundException;
use McoreServices\TeamleaderSDK\Exceptions\TeamleaderException;
try {
$user = Teamleader::users()->info('user-uuid');
} catch (NotFoundException $e) {
// User does not exist or UUID is wrong
Log::warning('User not found', ['id' => 'user-uuid']);
} catch (TeamleaderException $e) {
Log::error('Teamleader error', ['message' => $e->getMessage()]);
}- Departments β Departments users belong to
- Teams β Teams users are members of
- Deals β Deals assigned to users
- Time Tracking β Time entries logged by users
- Filtering β Filter and sort reference
- Sideloading β Loading related data
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