The TypeScript SDK (@fivexer/sdk) is the reference implementation for the /v1 API. It has zero runtime dependencies and runs anywhere with fetch.
Install
bashnpm install @fivexer/sdk
Quickstart
typescriptimport { Fivexer } from '@fivexer/sdk'; const client = new Fivexer({ baseUrl: 'https://api.fivexer.com', apiKey: 'sk_test_...', }); await client.workers.upsert({ id: 'agent_1', tags: ['english', 'billing'] }); const task = await client.tasks.create({ tags: ['english', 'billing'], priority: 90 }); console.log(task.id, task.status);
Errors and quotas
typescriptimport { FivexerApiError } from '@fivexer/sdk'; try { await client.tasks.create({ tags: ['english'] }); } catch (e) { if (e instanceof FivexerApiError) { console.log(e.status, e.code); console.log(e.quota?.taskRateRemaining); } }
Worker portal
typescriptimport { FivexerWorker } from '@fivexer/sdk'; const worker = new FivexerWorker({ baseUrl: 'https://api.fivexer.com' }); await worker.auth.login({ workspaceId: 'ws_1', workerId: 'agent_1', pin: '4821' }); await worker.tasks.accept(taskId);
Webhooks
Webhook verification is Node-only and lives at the @fivexer/sdk/webhook subpath so browser bundles don't pull node:crypto:
typescriptimport { verifyWebhookSignature, SIGNATURE_HEADER } from '@fivexer/sdk/webhook'; const ok = verifyWebhookSignature(secret, header, await request.text());