Quick start
You’ll go from nothing to a selected cyber quote, using the raw client against the mock API. This page follows examples/cyber.ts.
-
Install the SDK.
Terminal window npm install @partner-sdk/coreTerminal window bun add @partner-sdk/coreTerminal window pnpm add @partner-sdk/core -
Run the mock API. It replays a recorded cyber journey, so you don’t need credentials.
Terminal window git clone git@github.com:simplybusiness/partner-sdk.gitcd partner-sdk && bun installcd mock-api && bun start # http://localhost:3000 -
Create a client and start a questionnaire.
quote.ts import { apiKey, createClient } from '@partner-sdk/core';const client = createClient({baseUrl: 'http://localhost:3000',auth: apiKey('your-api-key'), // only needed behind the API Gateway});let q = await client.start('cyber'); // one POSTqis aQuestionnaire: an immutable snapshot.q.questionslists what the server wants next. -
Answer the first questions. Each call sends one PATCH and returns a new snapshot.
q = await q.answer({ 'Business owner': 'yes', 'US state': 'Ohio' });console.log(q.errors); // [] — rejected values come back here, not as exceptions -
Answer the trade. Trade has no fixed options: search, then answer with a result’s
value.const { results } = await q.searchTrade('handyman');q = await q.answer('Primary trade', results[0].value); -
Answer the rest. Send wire values: dates as
YYYY-MM-DD, phones in E.164.q = await q.answer({'Policy effective date': '2026-10-20','Policy start date': '2026-10-20','Business name': 'Cleveland Handy Services','Business street': '3201 West 140th Street','Business city': 'Cleveland','US zipcode': '44111','Customer[first_name]': 'Sam','Customer[last_name]': 'Smith','Customer[email_address]': 'sam@example.com','Customer[telephone_number]': '+12165550123',}); -
Get quotes.
readynarrows the type: only a ready snapshot hasquotes.if (q.ready) {const quoteSet = await q.quotes.wait({ timeoutMs: 60_000 });const [first] = quoteSet.quotes;const detail = await first.detail(); // covers, insurer responses, referenceawait first.select(); // choose it// Send the customer here to buy:console.log(quoteSet.quoteComparisonUrl);}
Run the example
Section titled “Run the example”The SDK repo runs every example against the mock:
bun run examples cyberNext steps
Section titled “Next steps”- Build a quote form: drive a real UI with session + view-model.
createClientandQuestionnairereference.