Node SDK: Time Entries
Create a Time Entry
const entry = await keito.timeEntries.create({
project_id: 'prj_abc',
task_id: 'tsk_001',
spent_date: '2026-03-06',
hours: 1.5,
notes: 'Refactored authentication module',
source: 'agent',
metadata: {
agent_id: 'review-bot-01',
agent_type: 'claude-code',
session_id: crypto.randomUUID(),
model: 'claude-opus-4-6',
},
});
Start a Running Timer
const timer = await keito.timeEntries.create({
project_id: 'prj_abc',
task_id: 'tsk_001',
spent_date: new Date().toISOString().split('T')[0],
hours: 0,
is_running: true,
source: 'agent',
metadata: {
agent_id: 'review-bot-01',
session_id: crypto.randomUUID(),
},
});
Stop a Timer
await keito.timeEntries.update(timer.id, {
hours: 1.5,
is_running: false,
notes: 'Completed code review',
});
List Time Entries
// All agent entries for a project this week
const entries = await keito.timeEntries.list({
source: 'agent',
project_id: 'prj_abc',
from: '2026-03-01',
to: '2026-03-06',
});
for (const entry of entries.data) {
console.log(`${entry.spent_date}: ${entry.hours}h — ${entry.notes}`);
}
let cursor: string | undefined;
do {
const page = await keito.timeEntries.list({
project_id: 'prj_abc',
cursor,
limit: 50,
});
for (const entry of page.data) {
console.log(entry.id);
}
cursor = page.next_cursor ?? undefined;
} while (cursor);
Delete a Time Entry
await keito.timeEntries.delete('te_abc123');