DFlowClient
Configure and initialize the DFlow SDK client
DFlowClient
The DFlowClient is the main entry point for all SDK operations. It provides access to all APIs through a single unified interface.
Basic Usage
Configuration Options
Options
| Property | Type | Default | Description |
|---|---|---|---|
environment | 'development' | 'production' | 'development' | Environment to use. Development requires no API key. |
apiKey | string | - | API key for authenticated endpoints (required for production) |
metadataBaseUrl | string | Based on environment | Custom base URL for Metadata API (overrides environment) |
tradeBaseUrl | string | Based on environment | Custom base URL for Trade API (overrides environment) |
wsOptions | WebSocketOptions | See below | WebSocket configuration |
Environment Details
| Environment | API Key | Endpoints | Use Case |
|---|---|---|---|
development | Not required | dev-*.dflow.net | Testing with real capital against Kalshi |
production | Required | *.dflow.net | Production deployments |
WebSocket Options
| Property | Type | Default | Description |
|---|---|---|---|
url | string | Based on environment | WebSocket server URL |
reconnect | boolean | true | Auto-reconnect on disconnect |
reconnectInterval | number | 5000 | Milliseconds between reconnect attempts |
maxReconnectAttempts | number | 10 | Maximum reconnection attempts |
Available APIs
Once initialized, the client provides access to all APIs:
Metadata APIs
Trade APIs
WebSocket
Setting API Key Later
Environment Selection
The SDK defaults to development environment, which is ideal for testing:
Development environment uses dev-*.dflow.net endpoints and allows testing with real capital against Kalshi without an API key. Production environment uses *.dflow.net endpoints and requires an API key.
Type Exports
The SDK exports all types for TypeScript users: