JavaScript SDK Reference
The official JavaScript SDK provides a type-safe client for all Connectbase APIs with built-in retry logic, request batching, and streaming support.
Installation
npm install @connectbase/sdk\n# or\nyarn add @connectbase/sdk
Quick Start
import { ConnectbaseClient } from '@connectbase/sdk';\n\nconst client = new ConnectbaseClient({\n apiKey: process.env.CONNECTBASE_API_KEY,\n timeout: 30000,\n});\n\n// Building lookup\nconst building = await client.buildings.get('bld_abc123');\nconsole.log(building.address, building.coordinates);
TypeScript Support
Full TypeScript definitions are included. All response types are strongly typed for excellent IDE auto-completion.
Error Handling
try {\n const result = await client.addresses.validate(address);\n} catch (err) {\n if (err instanceof ConnectbaseRateLimitError) {\n // Automatic retry is built-in, but you can handle manually\n await delay(err.retryAfter);\n }\n}
Streaming
For large batch operations, use the streaming API:
const stream = client.buildings.stream({ filter: 'state:CA' });\nfor await (const building of stream) {\n process.stdout.write(building.id + '\n');\n}