đźš§ Bloque documentation is under development
Before this
  • Node.js 22+, Bun 1+, or Deno
After this2 min
  • Installed SDK
  • Type-safe imports

Install

Add the SDK to your project.

npm
yarn
pnpm
bun
deno
npm add @bloque/sdk
Verify: import resolves without errors
import { SDK } from '@bloque/sdk' // No error = you're good

Configuration options

When you create an SDK instance, these are all the options available:

OptionTypeDefaultDescription
authAuthStrategy—Required. Auth method: apiKey, originKey, or jwt
originstring—Required for originKey and jwt auth
mode'production' | 'sandbox''production'Use 'sandbox' for testing
platform'node' | 'bun' | 'deno' | 'browser' | 'react-native''node'Runtime environment
timeoutnumber30000Request timeout in milliseconds
retry.enabledbooleantrueAuto-retry on 429, 503, network errors
retry.maxRetriesnumber3Maximum retry attempts
retry.initialDelaynumber1000Initial backoff delay (ms)
retry.maxDelaynumber30000Maximum backoff delay (ms)
tokenStorageTokenStoragelocalStorageJWT storage — required for react-native

Auth strategies at a glance

The SDK supports three auth models — pick one based on where your code runs:

apiKey — for backend services. Uses a sk_live_ or sk_test_ secret key. The SDK auto-exchanges it for a short-lived JWT.

new SDK({ auth: { type: 'apiKey', apiKey: process.env.BLOQUE_API_KEY! } })

originKey — for backends that manage user identities directly. Registers and connects users into your Origin.

new SDK({
  origin: 'your-origin',
  auth: { type: 'originKey', originKey: process.env.BLOQUE_ORIGIN_KEY! },
})

jwt — for browser and React Native apps where users authenticate directly.

new SDK({
  origin: 'your-origin',
  auth: { type: 'jwt' },
  platform: 'browser',
})
Keep keys out of client-side code

Never expose sk_ or originKey values in browser or React Native code. Use environment variables on the backend.


What's next

→ Register — create identities in your Origin