BloqueSDKConfig
Configuration object for initializing the Bloque SDK.Required Fields
Authentication strategy for the SDK.
Examples
- API Key
- JWT
Optional Fields
Origin identifier for scoping requests to a specific origin within the Bloque platform.
- Required for API key authentication
- Optional for JWT authentication (resolved during
authenticate())
SDK operation mode. Mutually exclusive with
baseUrl.'production'(default): Production environment'sandbox': Sandbox environment for testing
Cannot be specified if
baseUrl is provided.Custom base URL for the SDK. Mutually exclusive with
mode.When specified, the SDK will use this URL for all requests instead of the default endpoints.Cannot be specified if
mode is provided.Platform where the SDK is executed.
'node'(default): Node.js runtime'bun': Bun runtime'deno': Deno runtime'browser': Web browser environment'react-native': React Native (iOS/Android)
- Support API key authentication
- No token storage required
- Require JWT authentication
- Cannot use private API keys
JWT token storage strategy. Required for React Native with JWT authentication.Platform-specific behavior:
- Browser: Optional. JWT requests use
credentials: 'include'to send cookies. - React Native: Required. The SDK reads the JWT from
tokenStorageand sends it asAuthorization: Bearer <token>.
Default timeout for HTTP requests in milliseconds.
- Default:
30000(30 seconds) - Set to
0to disable timeouts globally (not recommended for production) - Can be overridden per-request
BloqueAPIError with code 'TIMEOUT_ERROR'.Retry configuration for failed requests.The SDK automatically retries failed requests with exponential backoff for:
- 429 (Too Many Requests)
- 503 (Service Unavailable)
- Network errors (timeouts, connection failures)
Retry-After header when present.Complete Examples
- Node.js (Production)
- Node.js (Sandbox)
- Browser (JWT)
- React Native
- Custom Endpoint
Type Definitions
Mode
'production': Uses live endpoints and real data (default)'sandbox': Uses isolated endpoints and mock data for development and testing
Platform
'node': Node.js runtime for APIs and backend services'deno': Deno runtime for serverless functions and edge services'bun': Bun runtime for high-performance backend services
'browser': Web browser environment, usescredentials: 'include'for cookies'react-native': React Native (iOS/Android), requirestokenStorage
AuthStrategy
- API Key: For backend platforms, provides a private API key
- JWT: For frontend platforms, uses JSON Web Tokens for authentication
TokenStorage
- Secure Storage (React Native)
- In-Memory (Browser)
Validation Rules
Mode and BaseURL are mutually exclusive
Mode and BaseURL are mutually exclusive
You cannot specify both
mode and baseUrl in the same configuration.Platform and Auth compatibility
Platform and Auth compatibility
Frontend platforms (
browser, react-native) cannot use API key authentication.Origin requirement
Origin requirement
API key authentication requires
origin to be specified.TokenStorage for React Native
TokenStorage for React Native
React Native with JWT authentication requires
tokenStorage.