MIB API

Embedded insurance, in a few lines.

Quote across carriers, bind policies, host checkout, and reconcile money — without an insurance licence. Build with mib_test_… keys, then flip to mib_live_…. Get your keys

Authentication

Every request carries your secret key as a bearer token. Keep it server‑side.

Authorization: Bearer mib_live_xxxxxxxxxxxxxxxx

Test vs live. A test key binds sandbox policies — no real money or carrier. Swap to a live key (after KYB) and nothing else changes.

Hosted Checkout (recommended)

Create a session server‑side, then send the customer to its URL. MIB runs quote → pay → bind and returns them.

curl https://api.myinsurebank.com/api/v1/checkout-sessions \
  -H "Authorization: Bearer $MIB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "product_type": "auto",
    "customer": { "email": "buyer@example.com" },
    "success_url": "https://yourapp.com/done"
  }'
# → { "id": "cs_…", "url": "https://app.myinsurebank.com/checkout/pay?token=cs_…" }
// Node
const session = await mib.createCheckoutSession({
  product_type: "auto",
  customer: { email: "buyer@example.com" },
  success_url: "https://yourapp.com/done",
});
// front-end: MIBCheckout.open(session.url)

Quote + bind (direct)

If you collect payment yourself: compare carriers, then bind the chosen offer.

POST https://api.myinsurebank.com/api/v1/quotes
{ "product_type": "auto", "attributes": { "cover_type": "third party" } }

POST https://api.myinsurebank.com/api/v1/policies        (header: Idempotency-Key: <your-id>)
{ "product_type": "auto", "insurer": "tangerine", "premium": 50000,
  "payment_reference": "PSTK_REF", "customer": { "email": "buyer@example.com" } }

Send an Idempotency-Key on writes so a retry never double‑binds.

Webhooks

MIB POSTs signed events — policy.bound, payment.success, claim.updated — to your endpoint. Verify the X-MIB-Signature header (HMAC‑SHA256) with your secret.

const ok = MIB.verifyWebhook(rawBody, req.header("X-MIB-Signature"), secret);
if (!ok) return res.sendStatus(401);
const { event, data } = JSON.parse(rawBody);

SDKs

npm install @myinsurebank/mib      # Node
composer require myinsurebank/mib  # PHP
pip install mib-insure             # Python

Sandbox playground

Try it live against the sandbox.

Paste a test key (mib_test_…) and run a real quote against the sandbox.