The SDK includes comprehensive TypeScript definitions and supports all modern JavaScript environments including Node.js, Deno, and Bun.
Installation
Install the SDK using npm:Setup and Configuration
Import the SDK
Import the appropriate client based on your needs:
Initialize the Client
Create a new instance of the Straddle client:
Implementation Examples
- Straddle Account Customers
- Embed Customers
For account customers (non-platform), the flow is simpler as the account context is inferred from the API key:
Key Features
TypeScript Support
Complete TypeScript definitions for all request params and response fields, providing excellent IDE support.
Promise-Based
Modern promise-based API with async/await support for clean, readable code.
Automatic Pagination
Built-in support for automatic pagination, making it easy to handle large result sets.
Error Handling
Comprehensive error types and helpful error messages for better debugging and error recovery.
Error Handling
The SDK provides specific exception types for different error cases:Common Error Types
Common Error Types
BadRequestError(400)UnprocessableEntityError(422)AuthenticationError(401)PermissionDeniedError(403)NotFoundError(404)RateLimitError(429)InternalServerError(>500)
Timeout Configuration
Timeout Configuration
Configure request timeouts:
SDK Requirements
Node Version
Node.js 18 LTS or higher
TypeScript Version
TypeScript >= 4.5