Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lumina-org.com/llms.txt

Use this file to discover all available pages before exploring further.

This is the shortest path from zero to a real on-chain policy. Five minutes if your wallet is funded with Base Sepolia ETH (for the onboarding signature only — the protocol itself never asks the agent for gas).

1. Install the SDK

npm install @lumina-org/sdk ethers

2. Mint an API key (self-service)

Sign one message with your wallet — the API verifies and returns a fresh lk_… key.
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. Caps: 3 active keys per wallet, 10 onboard attempts per hour per IP, ±5 minute timestamp window.

3. Verify connectivity

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

4. Buy a $50 policy

import { keccak256, toUtf8Bytes } from 'ethers'

const policy = await lumina.policies.purchase({
  productId: keccak256(toUtf8Bytes('FLASHBTC24-001')),
  buyer: '0xYourWalletAddress',                 // wallet that pays USDC premium
  coverageAmount: '50000000',                   // $50 in 6-dec USDC
  asset: 'USDC',
})

console.log('policyId:', policy.policyId, 'tx:', policy.txHash)
That’s it. The relayer paid the gas, your buyer wallet paid the USDC premium, and you got back a policyId you can reference for triggers and bonds.

Next: Browse strategies →

Try it without an account

If you don’t even want to go through onboarding, hit the sandbox:
curl -X POST https://lumina-api-production-ac85.up.railway.app/sandbox/try
Server-fixed buyer + $1 coverage. Useful for first-call demos. 10 req/h/IP.