Getting Time Clocks
Retrieve a list of all time clocks in your account. Time clocks are the organizational units for time tracking - each can have its own settings, assigned users, jobs, and geofences.
Endpoint
| Method | Endpoint | Description |
|---|---|---|
| GET | /time-clock/v1/time-clocks | Get all time clocks |
Example Request
curl --request GET \
--url https://api.connecteam.com/time-clock/v1/time-clocks \
--header 'X-API-KEY: YOUR_API_KEY'Response
{
"requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"data": {
"timeClocks": [
{
"id": 12345,
"name": "Main Office Time Clock",
"isArchived": false
},
{
"id": 12346,
"name": "Warehouse Time Clock",
"isArchived": false
},
{
"id": 12347,
"name": "Old Location",
"isArchived": true
}
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
| id | integer | Unique identifier for the time clock |
| name | string | Display name of the time clock |
| isArchived | boolean | Whether the time clock is archived |
Archived Time ClocksArchived time clocks are returned in the list. You can still retrieve historical time activities from archived time clocks, but you cannot create new entries.
Common Use Cases
Filter Active Time Clocks
const response = await fetch('https://api.connecteam.com/time-clock/v1/time-clocks', {
headers: { 'X-API-KEY': 'YOUR_API_KEY' }
});
const data = await response.json();
const activeTimeClocks = data.data.timeClocks.filter(tc => !tc.isArchived);
console.log('Active time clocks:', activeTimeClocks);Store Time Clock IDs for Other Operations
// Get time clocks and store mapping
const timeClockMap = {};
data.data.timeClocks.forEach(tc => {
timeClockMap[tc.name] = tc.id;
});
// Use in subsequent API calls
const mainOfficeId = timeClockMap['Main Office Time Clock'];
await fetch(`https://api.connecteam.com/time-clock/v1/time-clocks/${mainOfficeId}/time-activities?startDate=2024-01-01&endDate=2024-01-31`, {
headers: { 'X-API-KEY': 'YOUR_API_KEY' }
});Updated 11 days ago
