What You’ll Build
In this quickstart, you’ll:- Install the Bloque SDK
- Configure authentication
- Register a new user
- Create a virtual account
- Issue a virtual card
Before You Start
You’ll need:- Node.js 22+ (or Bun, Deno)
- A Bloque API key (contact Bloque to get started)
- Your origin identifier
Initialize the SDK
Create a new file and import the SDK:
index.ts
Start with
sandbox mode for testing. Switch to production when you’re ready to go live.Register a new user
Register a new user identity:The
register() method:- Creates a new identity with the given alias (email, phone, or custom ID)
- Returns a session object with access to all API clients
- Automatically authenticates the user
Complete Example
Here’s the full code for reference:Connecting to Existing Users
Once a user is registered, useconnect() instead of register():
Next Steps
Explore Accounts
Learn about card accounts, Polygon wallets, and more
Authentication
Understand API key and JWT authentication
Swap & Exchange
Add currency exchange and swap functionality
API Reference
Explore the complete API documentation
Common Issues
Authentication Error: Invalid API Key
Authentication Error: Invalid API Key
Make sure your API key is correct and has the proper format. Check that:
- The API key is set in your environment variables
- There are no extra spaces or quotes in the
.envfile - You’re using the correct key for sandbox vs production
Validation Error: Alias already exists
Validation Error: Alias already exists
The alias (email/phone) is already registered. Use
connect() instead of register():Network Error: Connection timeout
Network Error: Connection timeout
Check your internet connection and firewall settings. If you’re behind a corporate proxy, you may need to configure proxy settings.
TypeError: Cannot read property of undefined
TypeError: Cannot read property of undefined
Ensure you’ve installed all dependencies:And that you’re using Node.js 22 or higher.