Export time entries to your BI tool
Page through /v1/time-entries and land rows in a warehouse.
BI/payroll export is the primary v1 use case. Use a server-side job with an org API key that has time_entries.read (and clients.read / users.read if you want labels).
Walk the cursor
const MAX_RATE_LIMIT_RETRIES = 5;
async function exportTimeEntries({ baseUrl, apiKey, since }) {
const rows = [];
let cursor;
let rateLimitRetries = 0;
for (;;) {
const url = new URL("/v1/time-entries", baseUrl);
url.searchParams.set("limit", "200");
url.searchParams.set("startDate", since); // YYYY-MM-DD
if (cursor) url.searchParams.set("cursor", cursor);
const res = await fetch(url, {
headers: { Authorization: `Bearer ${apiKey}` },
});
if (res.status === 429) {
rateLimitRetries += 1;
if (rateLimitRetries > MAX_RATE_LIMIT_RETRIES) {
throw new Error("Rate limit retries exhausted");
}
const wait = Number(res.headers.get("Retry-After") || "1");
await new Promise((r) => setTimeout(r, wait * 1000));
continue;
}
rateLimitRetries = 0;
if (!res.ok) throw new Error(await res.text());
const page = await res.json();
rows.push(...page.data);
if (!page.hasMore || !page.nextCursor) {
break;
}
cursor = page.nextCursor;
}
return rows;
}A 429 must retry the same page. Do not continue a do…while (cursor) loop on the first request — cursor is still unset, so the loop exits and the export is empty. Cap retries so a stuck limiter cannot spin forever.
hours and billableHours are strings. date is YYYY-MM-DD. userId is the Pulse user who created the entry.
Load
Write rows to your data warehouse as-is. Join userId to GET /v1/users/{id} and clientId to GET /v1/clients/{id} if you need names. Cache those lookups; they are org-scoped and change slowly.
Do not run this from a browser. Store the key in your scheduler or orchestrator's secret store.