Developers
Public REST API (/v1/public/*) + outbound webhooks. Lihat docs di /api-docs.
Node.js / TypeScript
@danum-ai/sdk-node - typed client, auto-retry, pagination helpers.
npm install @danum-ai/sdk-node
import { DanumClient } from '@danum-ai/sdk-node';
const danum = new DanumClient({
apiKey: process.env.DANUM_API_KEY!,
});
const page = await danum.conversations.list({
status: 'OPEN',
limit: 20,
});
await danum.conversations.sendMessage(
page.data[0]!.id,
{ text: 'Hello!' },
{ idempotencyKey: crypto.randomUUID() },
);Create a key at Settings → API Keys with the minimum scopes you need.
Error handling
Specific error types for retry / auto-refresh.
import {
DanumAuthError,
DanumRateLimitError,
DanumScopeError,
} from '@danum-ai/sdk-node';
try {
await danum.account.get();
} catch (err) {
if (err instanceof DanumAuthError) {
// rotate key + retry
} else if (err instanceof DanumScopeError) {
// request user to add scope read:usage
} else if (err instanceof DanumRateLimitError) {
await new Promise((r) =>
setTimeout(r, err.retryAfter * 1000)
);
} else {
throw err;
}
}Pagination helper
Auto-follow cursor.
for await (const conv of danum.conversations.iterate({
status: 'OPEN',
})) {
console.log(conv.id);
}curl
No SDK - straight from shell.
curl https://api.danum.ai/v1/public/conversations \ -H "Authorization: Bearer dnm_live_xxxxxxxx" \ -H "Idempotency-Key: $(uuidgen)"