Node SDK: Getting Started
Install the official package, @keito-ai/sdk. These guides require 0.1.2 or later, including the timer and receipt helpers. Check your installed version with npm ls @keito-ai/sdk before using them.
Install
npm install @keito-ai/sdk@^0.1.2
The client uses native fetch on Node.js 18 or later. Create a key with All permitted operations and copy the Company ID from Settings → API & Developers. A read-only sync key cannot write time or expenses.
Initialize
import { Keito } from '@keito-ai/sdk';
const keito = new Keito({
apiKey: process.env.KEITO_API_KEY,
accountId: process.env.KEITO_ACCOUNT_ID,
});
for await (const project of await keito.projects.list()) {
console.log(project.id, project.name);
}
The client reads KEITO_API_KEY and KEITO_ACCOUNT_ID when the corresponding option is omitted, so new Keito() works when both variables are set. Missing credentials produce a configuration error before a request is sent. Keep credentials in your local/server environment, never in browser-delivered code.
Configuration
| Option | Default | Meaning |
|---|---|---|
apiKey |
KEITO_API_KEY |
Your kto_... key |
accountId |
KEITO_ACCOUNT_ID |
Company ID sent as Keito-Account-Id |
baseUrl |
https://app.keito-test.com |
API origin; resource paths include /api/v2 |
maxRetries |
3 |
Maximum retries for replay-safe requests |
timeout |
30000 |
Request timeout in milliseconds |
Use the origin for a custom environment. An optional trailing /api/v2 is normalized by the client. Older packages defaulted to the retired .io hostname; upgrade instead of relying on that default.