Skip to main content
This page walks the lowest-friction path first: a real call against the live sandbox, no wallet or key required. Then the full SDK path with onboarding for real policies.

1. Sandbox first (zero wallet, zero key)

The fastest sanity check is a POST /sandbox/try — the relayer pays gas and pulls the USDC premium from a sandbox wallet, capped at $100 per IP, 10 attempts/hour. Useful for first-call demos and CI smoke tests.
curl https://lumina-api-production-ac85.up.railway.app/sandbox/info
# returns { enabled, sandboxWallet, defaultProductName: "FLASHBTC1H-001",
#           coverageCapUsdc: "100000000", rateLimit: { perIp: 10, windowSeconds: 3600 } }

curl -X POST https://lumina-api-production-ac85.up.railway.app/sandbox/try \
  -H "Content-Type: application/json" \
  -d '{ "productName": "FLASHBTC1H-001", "coverageAmount": "100000000" }'
Or via the SDK (zero-arg auto-uses the default product):
import { LuminaClient } from '@lumina-org/sdk'
const lumina = new LuminaClient({ apiKey: '' })   // sandbox endpoints are public
const info  = await lumina.sandbox.info()
const result = await lumina.sandbox.try()
console.log(result.policyId, result.txHash)
That’s a real on-chain policy. Move on when you want your own buyer wallet.

2. Install the SDK

npm install @lumina-org/sdk@^0.6.0 ethers
@^0.6.0 is the V5.4 minimum. Older versions still expose the retired FLASHBTC4H / MICRODEPEG / RATESHOCK names; 0.6.0 throws Unknown product on those, which is what you want.

3. Mint an API key (self-service)

Sign one message with your wallet — the API verifies and returns a fresh lk_… key. Caps: 3 active keys per wallet, 10 onboard attempts per hour per IP, ±5 minute timestamp window.
import { Wallet } from 'ethers'
import { LuminaClient } from '@lumina-org/sdk'

const wallet = new Wallet(process.env.PRIVATE_KEY!)
const lumina = new LuminaClient({ apiKey: '' })  // empty for onboard

const { apiKey } = await lumina.agent.onboard(wallet, { label: 'my-bot' })
console.log('Save this NOW (shown only once):', apiKey)
The signed message is Lumina onboarding for {address} at {timestamp}. The SDK builds it for you. Need test USDC? See Get test USDC for a one-call faucet that drops 10,000 mUSDC + 0.05 ETH (gas) into the wallet you pass.

4. Verify connectivity

const lumina = new LuminaClient({ apiKey: process.env.LUMINA_API_KEY! })
const health = await lumina.health()
console.log('chainId:', health.chain.chainId)              // 8453
console.log('contracts:', Object.keys(health.contracts))   // coverRouter, …

5. Buy a $1,000 policy

const policy = await lumina.policies.purchase({
  productName: 'FLASHBTC24-001',                // V5.4 — Flash BTC 24h, premium $52.60 / $1k
  buyer: '0xYourWalletAddress',                 // wallet that pays USDC premium
  coverageAmount: '1000000000',                 // $1,000 in 6-dec USDC
})

console.log('policyId:', policy.policyId, 'tx:', policy.txHash)
The relayer paid the gas, your buyer wallet paid the $52.60 USDC premium, and you got back a policyId you can reference for triggers and bonds. The SDK 0.6.0 resolves both the productId keccak hash and the per-shield asset literal (BTC or ETH) from productName. The six V5.4 products are listed at Products and assets.

Next: Browse strategies →