# Bunchkey Complete Documentation Corpus --- id: quickstart categoryId: getting-started title: "10-Minute Quickstart: Two-App Core Loop" badge: "Two-App Core Loop" summary: "Connect two apps (Doodle Notes & Pixel Hop) to Bunchkey with passkey auth and shared entitlements in 10 minutes." lastUpdated: "October 2026" readTime: "10 min read" abstract: "Connect two apps (Doodle Notes and Pixel Hop) into a shared ecosystem. Learn how one user signs up with Touch ID or Face ID in Doodle Notes, purchases a Pro Pass, and is immediately recognized with unlocked entitlements when visiting Pixel Hop." status: "Stable" audience: "both" prevArticleId: "" nextArticleId: "architecture" prerequisites: - "Node.js 18+ or modern browser environment" - "Two registered client applications or local dev servers" - "Public WebAuthn support (Touch ID, Face ID, Windows Hello)" deflectionTags: - quickstart - getting started - doodle notes - pixel hop --- ## Step 1: Register Your Two Apps {#step-1-register-apps} In your Bunchkey Studio Console (`https://bunchkey.com/dashboard/products`), register your two portfolio applications: - App #1: **Doodle Notes** (`b0000000-0000-0000-0000-000000000010`) - App #2: **Pixel Hop** (`b0000000-0000-0000-0000-000000000011`) Configure each application with its permitted client origin: - Doodle Notes Origin: `http://localhost:5174` - Pixel Hop Origin: `http://localhost:5175` ```json label="Registered Products Payload" { "apps": [ { "app_id": "b0000000-0000-0000-0000-000000000010", "name": "Doodle Notes", "allowed_origins": ["http://localhost:5174"] }, { "app_id": "b0000000-0000-0000-0000-000000000011", "name": "Pixel Hop", "allowed_origins": ["http://localhost:5175"] } ] } ``` ## Step 2: Install Web SDK or Connect Directly {#step-2-install-sdk} Add the lightweight Bunchkey client SDK to both of your frontend projects, or use direct HTTP/JSON requests. ```bash label="npm" npm install @bunchkey/web ``` ```bash label="pnpm" pnpm add @bunchkey/web ``` ```bash label="cURL / Direct API" curl -X POST https://api.bunchkey.com/eclipse.v1.AuthService/BeginPasskeyLogin \ -H "Content-Type: application/json" \ -d '{"app_id": "b0000000-0000-0000-0000-000000000010"}' ``` ## Step 3: Initialize Client & Authenticate with Passkeys {#step-3-initialize-and-auth} In Doodle Notes, initialize `BunchkeyClient` with its App ID and call `loginWithPasskey()`. When the user completes biometric verification, Bunchkey returns a verified session. ```typescript label="Doodle Notes (App #1)" import { BunchkeyClient } from '@bunchkey/web'; const bunchkey = new BunchkeyClient({ appId: 'b0000000-0000-0000-0000-000000000010', endpoint: 'https://api.bunchkey.com', }); async function handleSignIn() { const user = await bunchkey.loginWithPasskey(); console.log('Signed in to Doodle Notes:', user.email, user.id); } ``` ```typescript label="Pixel Hop (App #2)" import { BunchkeyClient } from '@bunchkey/web'; const bunchkey = new BunchkeyClient({ appId: 'b0000000-0000-0000-0000-000000000011', endpoint: 'https://api.bunchkey.com', }); // Auto-recognize returning user on adjacent origin async function handleCrossAppSession() { const user = await bunchkey.loginWithPasskey(); console.log('Recognized in Pixel Hop without new password:', user.email); } ``` ## Step 4: Map Stripe Catalog & Verify Cross-App Entitlements {#step-4-stripe-and-entitlements} When the customer purchases a Pro Pass in Doodle Notes, the entitlement is recorded in your studio catalog. In Pixel Hop, simply check if the user holds the `pro` entitlement. ```typescript label="Client Feature Check" // Pixel Hop checks if user unlocked Pro in Doodle Notes if (await bunchkey.has('pro')) { grantInGameAccess(); } ``` ```bash label="Server Verification (ConnectRPC)" curl -X POST https://api.bunchkey.com/eclipse.v1.MonetizationService/CheckEntitlement \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sec_live_sample" \ -d '{"user_id": "usr_123", "entitlement_key": "pro"}' ``` --- id: agents categoryId: getting-started title: "Build with Coding Agents & MCP" badge: "Agent-Ready" summary: "Integrate Bunchkey using Claude Code, OpenAI Codex, Google Antigravity, or Cursor with 1-line MCP and skills." lastUpdated: "October 2026" readTime: "6 min read" abstract: "In today's engineering workflow, builders use coding agents. Bunchkey provides day-zero agent harnesses: a public read-only Streamable-HTTP Docs MCP Server, pre-built agent setup prompts, and an installable setup-bunchkey Skill." status: "Stable" audience: "both" prevArticleId: "quickstart" nextArticleId: "architecture" deflectionTags: - agents - mcp - claude code - codex - antigravity - cursor --- ## 1-Line Remote Docs MCP Server {#mcp-setup} Bunchkey hosts a public, read-only Streamable-HTTP Model Context Protocol (MCP) server at `https://bunchkey.com/mcp`. It exposes three high-utility tools: - `search_docs`: Search all documentation topics, endpoints, and error recipes. - `read_page`: Fetch clean markdown content for any documentation page. - `get_quickstart`: Generate tailored setup code for your specific stack. ```bash label="Claude Code CLI" claude mcp add --transport http bunchkey https://bunchkey.com/mcp ``` ```json label="Cursor / Windsurf (mcp.json)" { "mcpServers": { "bunchkey": { "url": "https://bunchkey.com/mcp" } } } ``` ## Ready-to-Paste Agent Prompts {#agent-prompts} Pass these prompts directly to your coding assistant to kick off integration: ### Prompt A: Evaluate Fit for Your Workspace ```text label="Evaluate Prompt" I want to try Bunchkey (https://bunchkey.com/llms.txt) for my products. Inspect my project workspace, identify where authentication and billing live today, and propose an integration plan for unified passkey login and shared entitlements. ``` ### Prompt B: Setup Bunchkey from Scratch ```text label="Setup Prompt" Help me integrate Bunchkey into this application. Read the Bunchkey quickstart documentation at https://bunchkey.com/docs/quickstart.md, configure the client SDK or direct HTTP API calls, and implement 1-tap passkey login. ``` ### Prompt C: Multi-Product Portfolio Integration ```text label="Multi-App Prompt" I have multiple applications in this workspace that I want to connect under Bunchkey. Review https://bunchkey.com/agents/setup-bunchkey/SKILL.md, design a shared SKU catalog, and show me how to check cross-app entitlements between them. ``` ## Single-Shot Agent Index (llms.txt) {#llms-txt} For LLM environments that ingest raw context or documentation maps: - Structured Index: `https://bunchkey.com/llms.txt` - Full Concatenated Corpus: `https://bunchkey.com/llms-full.txt` - Installable Skill: `https://bunchkey.com/agents/setup-bunchkey/SKILL.md` --- id: architecture categoryId: getting-started title: "Architecture & System Mental Model" badge: "Architecture" summary: "System topology, client edge layer, and high-performance cross-app entitlement flow." lastUpdated: "October 2026" readTime: "7 min read" abstract: "Bunchkey provides a unified backend fabric connecting disparate applications into a single creator studio. This document explains the system topology, consistency guarantees, and security layers from an integration perspective." status: "Stable" audience: "both" prevArticleId: "quickstart" nextArticleId: "concept-identity" deflectionTags: - architecture - topology - mental model - gateway --- ## System Topology {#system-topology} Bunchkey is engineered with a layered service fabric optimized for high concurrency, cryptographic security, and low-latency entitlement checks across multiple client apps. :::important Dual-Auth Gateway Layer All incoming traffic is validated at the ConnectRPC edge gateway. Client application requests require valid registered App IDs and allowed origins, while administrative operations require high-entropy API keys or authenticated bearer sessions. ::: ```json label="System Architecture Layers" { "client_edge": { "supported_clients": ["Web (TypeScript)", "Server (Go)", "iOS/macOS (Swift)", "Android (Kotlin)", "Unity (C#)", "Godot 4 (GDScript)"], "protocols": ["ConnectRPC", "gRPC-Web", "HTTP/JSON REST"] }, "gateway_layer": { "authentication": "Dual-Auth (API Key + User Session JWT)", "rate_limiting": "Adaptive Token Bucket per-client quotas", "cors_enforcement": "App-scoped origin verification" }, "service_fabric": { "auth_service": "FIDO2 / WebAuthn Level 3 + HMAC Email OTP", "identity_service": "Federated End-User Directory & Customer 360", "monetization_service": "Universal SKU catalog, Entitlement evaluator, Licensing engine" }, "data_fabric": { "persistence": "Multi-tenant isolated transactional storage", "entitlement_cache": "Low-latency in-memory cache with immediate invalidation", "async_messaging": "Transactional outbox event streaming for webhooks" } } ``` ## Data Consistency & Cache Invalidation {#data-consistency} Entitlement lookups demand extreme read performance to avoid degrading navigation in client applications. Bunchkey uses a multi-tier cache hierarchy: 1. **Local SDK In-Memory Cache**: Short-lived TTL caching at client edge for immediate UI gating. 2. **Gateway Cache**: Low-latency edge caching for high-volume status checks. 3. **Primary Store**: Authoritative transactional source of truth. When an entitlement is granted, upgraded, or revoked, Bunchkey broadcasts cache invalidation signals so client checks reflect the update within milliseconds. --- id: concept-identity categoryId: concepts title: "Multi-Origin Passkeys & Federated Identity Mesh" badge: "Identity Mesh" summary: "Understand how WebAuthn credentials work seamlessly across different domains without third-party redirects." lastUpdated: "October 2026" readTime: "7 min read" abstract: "Traditional OAuth identity providers force users off your domain onto third-party sign-in screens. Bunchkey implements a native multi-origin passkey mesh that allows users to register once with Touch ID, Face ID, or Windows Hello and be recognized across your entire studio portfolio." status: "Stable" audience: "both" prevArticleId: "architecture" nextArticleId: "concept-catalog" deflectionTags: - identity - passkeys - multi-origin - relying party --- ## The Cross-Domain Challenge {#cross-domain-challenge} WebAuthn authenticators bind credentials cryptographically to a single Relying Party ID (RP ID). Normally, a passkey created on `doodlenotes.com` cannot be read by `pixelhop.game`. Bunchkey solves this through an embedded identity mesh: 1. **Studio Identity Hub**: A unified Relying Party origin manages the credential registration ceremony. 2. **Federated Cross-Origin Sessions**: When a user navigates to an adjacent studio app, Bunchkey verifies their authenticated identity token without prompting for a new password. 3. **Zero Third-Party Redirects**: The entire ceremony happens inline inside your app's native UI using standard WebAuthn APIs. ## Email OTP Fallback {#email-otp-fallback} Not all devices have biometric authenticators available (e.g. desktop workstations without Windows Hello). Bunchkey provides a built-in, server-salted HMAC Email One-Time Password (OTP) fallback: - Short-lived 6-digit codes sent directly to the customer's email. - Expire automatically after 10 minutes. - Rate-limited and replay-protected. --- id: concept-catalog categoryId: concepts title: "Universal Catalog, SKUs & Shared Entitlements" badge: "Monetization" summary: "Structure products, define pricing SKUs, and evaluate cross-app access rules." lastUpdated: "October 2026" readTime: "6 min read" abstract: "In a multi-product studio, purchases in one application frequently unlock features in another. Bunchkey's universal catalog unifies products, pricing plans, and access grants across all your apps into a coherent monetization model." status: "Stable" audience: "both" prevArticleId: "concept-identity" nextArticleId: "concept-feature-status" deflectionTags: - catalog - entitlements - skus - credits --- ## Products, SKUs & Grants Hierarchy {#catalog-hierarchy} The Bunchkey monetization model is structured into three clear tiers: 1. **Product**: A registered application or portfolio asset (e.g. Doodle Notes, Pixel Hop). 2. **Catalog Item (SKU)**: A purchasable offering (e.g. `pro_monthly`, `studio_all_access`, `credits_500`). 3. **Entitlement Grant**: The specific capability granted to the user (e.g. `doodle:export_pdf`, `pixelhop:ad_free`, `ai_tokens:500`). ```json label="Universal Catalog Example" { "sku": "studio_all_access", "price_cents": 1900, "billing_interval": "month", "grants": [ { "app_id": "doodle_notes", "entitlement_key": "pro", "type": "feature" }, { "app_id": "pixel_hop", "entitlement_key": "all_characters", "type": "feature" }, { "app_id": "shared_wallet", "entitlement_key": "ai_tokens", "type": "credit", "quantity": 1000 } ] } ``` ## Atomic Consumable Credits {#atomic-credits} For generative AI, metering, or virtual currencies, Bunchkey supports atomic consumable credits: - **Idempotency Guarantee**: Every `ConsumeCredit` call accepts an `idempotency_key` to prevent double deductions on network retries. - **Race Condition Prevention**: Concurrent credit deductions are executed atomically so balances remain accurate under high volume. - **Negative Balance Guard**: Operations fail with `RESOURCE_EXHAUSTED` if the user's available balance is insufficient. --- id: concept-cross-sell categoryId: concepts title: "Explainable Cross-Sell Scoring & Adoption Signals" badge: "Audience Intelligence" summary: "Deterministic, transparent affinity heuristics based on verified activity, net spend, and peer crossover rates." lastUpdated: "October 2026" readTime: "5 min read" abstract: "In multi-app studio ecosystems, cross-selling customers to adjacent products drives organic expansion. Bunchkey evaluates cross-sell targets using explainable signals grounded in verified transactions, explicit rationale bullets, minimum sample safeguards, and privacy opt-out consent filters." status: "Beta" audience: "both" prevArticleId: "concept-feature-status" nextArticleId: "concept-analytics-synergy" deflectionTags: - cross-sell - audience - affinity - privacy --- ## Understanding Cross-Sell Affinity Tiers {#scoring-weights} Bunchkey categorizes prospective cross-sell targets into transparent affinity tiers (High, Medium, Low) based on observable customer engagement and transaction history: - **Activity Recency**: Customers active in your apps within the past 7 or 30 days are far more receptive to adjacent product introductions than dormant users. - **Verified Buyer Status**: Customers who have previously completed a verified transaction in any of your studio apps exhibit proven willingness to pay for software. - **Cross-App Velocity**: Customers who already use two or more of your applications show established studio loyalty. - **Peer Adoption Rate**: The baseline proportion of users in App A who naturally discover and install App B. ## Minimum Data Sample Safeguard {#minimum-data-safeguard} To prevent volatile or misleading recommendations in early-stage studios with low traffic, Bunchkey enforces a minimum sample rule: - Studios must have at least **50 cross-app users** and at least **20 verified buyers** before live recommendations are activated. - When sample thresholds are unmet, the dashboard displays an honest notice indicating current sample counts alongside preview mockups. :::important Privacy & Consent Enforcement Customers who have opted out of promotional communications (`consent.marketing = false` or `custom_metadata.marketing_opt_out = true`) are strictly excluded from recommendation lists and audience export feeds. ::: --- id: concept-analytics-synergy categoryId: concepts title: "Cross-App Synergy & Statistical N-Thresholds" badge: "Ecosystem Analytics" summary: "Mathematical definition of studio synergy rate with minimum sample safeguards (N >= 30) and zero synthetic bleed." lastUpdated: "October 2026" readTime: "5 min read" abstract: "Ecosystem synergy measures multi-product organic expansion. Bunchkey evaluates synergy strictly from verified tenant activity and enforces an N >= 30 sample size threshold to eliminate misleading percentages on sparse data." status: "Beta" audience: "both" prevArticleId: "concept-cross-sell" nextArticleId: "guide-passkeys" deflectionTags: - synergy - analytics - sample threshold --- ## Mathematical Synergy Definition {#synergy-definition} Synergy rate measures the proportion of customers active in multiple studio apps relative to all active users in the selected time window: | Metric Component | Type | Description | | :--- | :--- | :--- | | **Formula** | Ratio | Users active in 2 or more products in period ÷ Users active in 1 or more products. | | **Total Active Users (N)** | Denominator | Distinct unique humans active in at least 1 registered product during the window. | | **Multi-App Users (M)** | Numerator | Distinct unique humans active in 2 or more registered products during the window. | | **Absolute Count Standard** | Format Rule | Always displays absolute counts alongside percentage (e.g. 12 / 48 users · 25.0%). | ## Sample Threshold Safeguard (N >= 30) {#sample-threshold} To prevent misleading, volatile percentages on new workspaces: - If total active users during the selected window is fewer than 30 (`N < 30`), the dashboard hides percentage rates and displays an honest notice: *"Not enough data yet: N/30 active users"*. - Preview datasets for unconfigured studios are always clearly badged as *Sample Preview*. :::tip Strict Tenant Isolation Guarantee All studio analytics and synergy calculations run strictly against your verified tenant telemetry, completely isolated from system seed datasets. ::: --- id: concept-feature-status categoryId: concepts title: "Feature Status, Lifecycle Stages & Reliability Tiers" badge: "Lifecycle" summary: "Understand feature maturity levels across Stable, Beta, Preview, and Coming soon." lastUpdated: "October 2026" readTime: "4 min read" abstract: "Bunchkey classifies all capabilities, SDKs, and APIs with transparent status badges so engineering teams can assess production readiness at a glance." status: "Stable" audience: "both" prevArticleId: "concept-catalog" nextArticleId: "concept-cross-sell" deflectionTags: - lifecycle - feature status - stable - beta --- ## Lifecycle Stages {#lifecycle-stages} | Stage | Badge Class | Production Readiness | Description | | :--- | :--- | :--- | :--- | | **Stable** | Emerald | Full Production | Tested in high-throughput environments with backward compatibility guarantees. | | **Beta** | Blue | Candidate | Functionally complete with active customer testing; minor API refinements possible. | | **Preview** | Amber | Developer Preview | Functional proof of concept; feedback actively incorporated before stabilization. | | **Coming soon** | Zinc | In Development | Roadmap capability undergoing design and initial implementation. | :::tip Automated Status Alignment Every SDK, API endpoint, and dashboard module is labeled in accordance with Bunchkey's central feature registry. ::: --- id: guide-passkeys categoryId: how-to-guides title: "How-To: Implement Biometric WebAuthn Passkeys" badge: "Auth" summary: "Complete recipe for passwordless registration and login with biometric hardware authenticators." lastUpdated: "October 2026" readTime: "9 min read" abstract: "Learn how to implement a native, zero-redirect Passkey authentication ceremony in your web application using W3C WebAuthn Level 3 standards." status: "Stable" audience: "both" prevArticleId: "concept-analytics-synergy" nextArticleId: "guide-entitlements" deflectionTags: - passkeys - webauthn - biometric - login --- ## Understanding the Two-Phase Ceremony {#ceremony-overview} Passkey authentication operates in two distinct phases: 1. **Challenge Initiation**: The server issues a cryptographically secure 32-byte challenge. 2. **Attestation / Assertion Verification**: The device hardware enclave signs the challenge, and the server validates the signature against the registered public key. :::note Challenge Replay Prevention Every login challenge has a strict single-use 60-second validity window. Once verified, the challenge is immediately retired to eliminate replay attacks. ::: ## Passkey Registration Flow {#passkey-registration} Enroll a new user device. The browser prompts Touch ID / Face ID / Windows Hello to generate an asymmetric keypair. ```typescript label="TypeScript (Web SDK)" import { BunchkeyClient } from '@bunchkey/web'; const bunchkey = new BunchkeyClient({ appId: 'YOUR_APP_ID' }); async function handleEnrollPasskey() { try { const result = await bunchkey.registerPasskey('MacBook Pro Touch ID'); console.log('Registered credential ID:', result.credentialId); } catch (err) { console.error('Registration failed:', err); } } ``` ```swift label="Swift (iOS 16+)" import BunchkeyKit import AuthenticationServices let bunchkey = BunchkeyClient(config: BunchkeyConfig(appId: "YOUR_APP_ID")) func registerDevicePasskey(window: UIWindow) async throws { let credentialId = try await bunchkey.registerPasskey(anchor: window) print("Enrolled Passkey: \(credentialId)") } ``` ## Passkey Login Flow {#passkey-login} Authenticate returning users with a single biometric gesture. Supports discoverable credentials (resident keys) without requiring email input. ```typescript label="TypeScript (Web SDK)" async function handleBiometricLogin() { try { const user = await bunchkey.loginWithPasskey(); console.log('Logged in user:', user.email, user.id); } catch (err) { console.warn('Biometric cancelled or failed:', err); } } ``` --- id: guide-stripe categoryId: how-to-guides title: "How-To: Connect Stripe Checkout & Sync Entitlements" badge: "Payments" summary: "Map Stripe Price IDs to Bunchkey SKUs and grant cross-app access upon successful payment." lastUpdated: "October 2026" readTime: "8 min read" abstract: "Connect your Stripe account to Bunchkey so that subscription checkouts automatically grant cross-app access without custom billing webhook code." status: "Stable" audience: "both" prevArticleId: "guide-entitlements" nextArticleId: "guide-credits" deflectionTags: - stripe - checkout - billing - payments --- ## Hosted Checkout Integration {#checkout-session} Trigger the Bunchkey checkout modal or redirect users to Stripe Checkout. Bunchkey automatically associates the transaction with the user's unified identity. ```typescript label="TypeScript (Frontend)" import { openCheckoutModal } from '@bunchkey/web'; async function handleUpgradeClick() { await openCheckoutModal({ skuId: 'studio_pro_yearly', successUrl: 'https://myapp.com/dashboard?upgraded=true', cancelUrl: 'https://myapp.com/pricing', }); } ``` ## Automatic Cross-App Entitlement Sync {#webhook-entitlement-sync} When a Stripe checkout succeeds, Bunchkey's ledger engine immediately grants the mapped catalog entitlements across all registered studio apps. --- id: guide-credits categoryId: how-to-guides title: "How-To: Meter Consumable AI Tokens & Credits" badge: "Usage Metering" summary: "Maintain synchronized token wallets across web, mobile, and game products with idempotent deductions." lastUpdated: "October 2026" readTime: "7 min read" abstract: "Manage shared pools of generative AI tokens, compute units, or game credits across your entire application catalog." status: "Stable" audience: "both" prevArticleId: "guide-stripe" nextArticleId: "guide-webhooks" deflectionTags: - credits - tokens - metering - ai --- ## Metering Architecture {#metering-architecture} Bunchkey maintains a real-time ledger balance for each user and credit key: - Deductions are atomic. - Balances never fall below zero unless explicitly configured for overdraft. - Low balance notifications can be delivered via webhooks. ## Server-Side Consumption {#server-deduction-flow} ```go label="Go Server SDK" package main import ( "context" "fmt" "github.com/bunchkey/go" ) func DeductTokens(client *bunchkey.Client, userID string, tokenCost int64) error { res, err := client.ConsumeCredit(context.Background(), &bunchkey.ConsumeCreditRequest{ UserId: userID, CreditKey: "ai_tokens", Amount: tokenCost, IdempotencyKey: fmt.Sprintf("req_%s_%d", userID, tokenCost), }) if err != nil { return err } fmt.Printf("Deduction successful. New balance: %d\n", res.Balance) return nil } ``` --- id: guide-entitlements categoryId: how-to-guides title: "How-To: Gate Features & Consume Credits" badge: "Entitlements" summary: "Protect UI routes, server endpoints, and deduct token balances in real time." lastUpdated: "October 2026" readTime: "6 min read" abstract: "A comprehensive guide to gating premium capabilities and maintaining shared credit balances across products." status: "Stable" audience: "both" prevArticleId: "guide-passkeys" nextArticleId: "guide-stripe" deflectionTags: - entitlements - gating - credits - permissions --- ## Client-Side Feature Checks {#client-feature-check} Use `bunchkey.has(key, expectedValue)` to verify if the active user holds a specific entitlement tier. ```typescript label="TypeScript (Web)" // Check if user is a Pro subscriber if (await bunchkey.has('tier', 'pro')) { renderAdvancedExportOptions(); } else { renderUpgradeTeaser(); } ``` ```go label="Go (HTTP Middleware)" package middleware import ( "github.com/bunchkey/go" "github.com/gin-gonic/gin" "net/http" ) func RequireProMiddleware(client *bunchkey.Client) gin.HandlerFunc { return func(c *gin.Context) { userID := c.GetString("user_id") res, err := client.CheckEntitlement(c.Request.Context(), userID, "pro") if err != nil || !res.HasAccess { c.JSON(http.StatusForbidden, gin.H{"error": "Pro subscription required"}) c.Abort() return } c.Next() } } ``` ## Atomic Credit Consumption {#atomic-deduction} When a user triggers an AI operation, deduct credits atomically from their shared wallet balance using an `idempotency_key`. ```typescript label="TypeScript (Node.js)" import { BunchkeyClient } from '@bunchkey/web'; const bunchkey = new BunchkeyClient({ appId: 'YOUR_APP_ID' }); async function consumeAiTokens(userId: string, tokens: number) { const result = await bunchkey.consumeCredit({ userId, creditKey: 'ai_tokens', amount: tokens, idempotencyKey: `op_${Date.now()}_${userId}`, }); console.log('Remaining balance:', result.balance); } ``` --- id: guide-webhooks categoryId: how-to-guides title: "How-To: Receive & Verify HMAC Webhook Signatures" badge: "Webhooks" summary: "Cryptographically verify incoming Bunchkey-Signature headers using HMAC-SHA256." lastUpdated: "October 2026" readTime: "6 min read" abstract: "Ensure webhook payloads originate authentically from Bunchkey and have not been tampered with or delayed in transit." status: "Stable" audience: "both" prevArticleId: "guide-credits" nextArticleId: "api-overview" deflectionTags: - webhooks - hmac - signatures - events --- ## Webhook Event Lifecycle {#event-lifecycle} When key lifecycle events occur (e.g., `entitlement.granted`, `subscription.renewed`, `credit.balance_low`), Bunchkey posts an HTTP JSON payload to your registered endpoint with a `Bunchkey-Signature` header. ## Cryptographic Signature Verification {#verification-code} Every webhook delivery includes an HMAC-SHA256 signature calculated over the timestamp and raw payload bytes using your webhook secret: ```go label="Go Verification" package main import ( "net/http" "github.com/bunchkey/go" ) func WebhookHandler(w http.ResponseWriter, r *http.Request) { secret := "whsec_sample_secret_key" payload := []byte(`{"event":"entitlement.granted"}`) sigHeader := r.Header.Get("bunchkey-signature") if !bunchkey.VerifyWebhookSignature(payload, sigHeader, secret) { http.Error(w, "invalid signature", http.StatusUnauthorized) return } w.WriteHeader(http.StatusOK) } ``` ```typescript label="TypeScript (Node.js)" import { verifyWebhookSignature } from '@bunchkey/web'; function handleWebhook(req: any, res: any) { const secret = process.env.BUNCHKEY_WEBHOOK_SECRET!; const isValid = verifyWebhookSignature({ payload: req.rawBody, signatureHeader: req.headers['bunchkey-signature'], secret, }); if (!isValid) { return res.status(401).send('Invalid signature'); } res.status(200).send('OK'); } ``` --- id: api-overview categoryId: api-reference title: "API Conventions & ConnectRPC Protocols" badge: "Conventions" summary: "Protocol definitions, base URLs, dual authentication headers, and response formats." lastUpdated: "October 2026" readTime: "5 min read" abstract: "The Bunchkey API is built on ConnectRPC, supporting modern HTTP/2, gRPC-Web, and standard HTTP/1.1 JSON REST calls across all endpoints." status: "Stable" audience: "both" prevArticleId: "guide-webhooks" nextArticleId: "api-auth" deflectionTags: - api - conventions - connectrpc - rest --- ## Base URLs & Protocol Negotiation {#base-urls} - Production API: `https://api.bunchkey.com` - Test API: `https://test.bunchkey.com` All endpoints accept standard `application/json` payloads over HTTP POST. ## Authentication Headers {#auth-headers} | Auth Type | Header Format | Use Case | | :--- | :--- | :--- | | **App-Scoped Client** | `X-App-Id: b000...` | Public client calls from registered origins. | | **User Bearer Session** | `Authorization: Bearer ` | Authenticated end-user operations. | | **Server Secret Key** | `Authorization: Bearer sec_live_...` | Server-to-server administrative operations. | --- id: api-auth categoryId: api-reference title: "AuthService RPCs & WebAuthn Endpoints" badge: "AuthService" summary: "BeginPasskeyLogin, FinishPasskeyLogin, and session management RPCs." lastUpdated: "October 2026" readTime: "7 min read" abstract: "AuthService manages WebAuthn ceremonies, biometric credential validation, and JWT session issuance." status: "Stable" audience: "both" prevArticleId: "api-overview" nextArticleId: "api-identity" deflectionTags: - auth - passkeys - finishpasskeylogin - session --- ## FinishPasskeyLogin RPC {#finish-passkey-login} :::endpoint method: POST path: /eclipse.v1.AuthService/FinishPasskeyLogin service: AuthService rpc: FinishPasskeyLogin description: Verify WebAuthn passkey assertion signature and issue session token. authRequired: App ID ::: | Parameter | Type | Required | Description | | :--- | :--- | :--- | :--- | | `app_id` | string | Yes | Unique ID of your registered application. | | `credential_id` | string | Yes | WebAuthn credential ID returned by authenticator. | | `client_data_json` | string | Yes | Base64URL-encoded clientDataJSON from authenticator. | | `authenticator_data` | string | Yes | Base64URL-encoded authenticatorData payload. | | `signature` | string | Yes | Cryptographic assertion signature. | ```json label="FinishPasskeyLogin Request Example" { "app_id": "b0000000-0000-0000-0000-000000000010", "credential_id": "AQIDBAUGBwgJCgsMDQ4PEA==", "client_data_json": "eyJjaGFsbGVuZ2UiOiJ...", "authenticator_data": "SZYN5YgOjGh0NBcP...", "signature": "MEUCIQD123..." } ``` --- id: api-identity categoryId: api-reference title: "IdentityService RPCs & Customer 360 Endpoints" badge: "IdentityService" summary: "GetUser, ListAppMemberships, and profile management RPCs." lastUpdated: "October 2026" readTime: "6 min read" abstract: "IdentityService manages unified end-user profiles, cross-app memberships, and Customer 360 analytics." status: "Stable" audience: "both" prevArticleId: "api-auth" nextArticleId: "api-monetization" deflectionTags: - identity - user - profile - memberships --- ## GetUser RPC {#get-user} Retrieve authenticated profile information and active portfolio memberships for a customer. :::endpoint method: POST path: /eclipse.v1.IdentityService/GetUser service: IdentityService rpc: GetUser description: Retrieve user details by ID or active bearer token. authRequired: User Session or Server API Key ::: | Parameter | Type | Required | Description | | :--- | :--- | :--- | :--- | | `user_id` | string | Yes | Unique identifier of the user (e.g. `usr_123`). | --- id: api-monetization categoryId: api-reference title: "MonetizationService RPCs & Ledger Endpoints" badge: "MonetizationService" summary: "CheckEntitlement, ConsumeCredit, and universal catalog management RPCs." lastUpdated: "October 2026" readTime: "8 min read" abstract: "MonetizationService handles entitlement checks, credit wallet deductions, and payment ledger synchronizations." status: "Stable" audience: "both" prevArticleId: "api-identity" nextArticleId: "api-app" deflectionTags: - monetization - checkentitlement - consumecredit - ledger --- ## CheckEntitlement RPC {#check-entitlement} Verify whether a specific user holds access to an entitlement key across the studio portfolio. :::endpoint method: POST path: /eclipse.v1.MonetizationService/CheckEntitlement service: MonetizationService rpc: CheckEntitlement description: Evaluate user access for a given entitlement key. authRequired: Server API Key or User Session ::: | Parameter | Type | Required | Description | | :--- | :--- | :--- | :--- | | `user_id` | string | Yes | The unique identifier of the customer. | | `entitlement_key` | string | Yes | The entitlement identifier to evaluate (e.g. `pro`). | ```json label="CheckEntitlement Request Example" { "user_id": "usr_987654321", "entitlement_key": "pro" } ``` ## ConsumeCredit RPC {#consume-credit} Atomically deduct credits or metering units from a user's wallet. :::endpoint method: POST path: /eclipse.v1.MonetizationService/ConsumeCredit service: MonetizationService rpc: ConsumeCredit description: Deduct units from a consumable balance with idempotency guarantees. authRequired: Server API Key ::: | Parameter | Type | Required | Description | | :--- | :--- | :--- | :--- | | `user_id` | string | Yes | The unique identifier of the customer. | | `credit_key` | string | Yes | Credit wallet identifier (e.g. `ai_tokens`). | | `amount` | int64 | Yes | Number of units to deduct. | | `idempotency_key` | string | Yes | Unique idempotency token for safe retries. | --- id: api-app categoryId: api-reference title: "AppService RPCs & Product Registration" badge: "AppService" summary: "CreateApp, ListApps, and origin management RPCs." lastUpdated: "October 2026" readTime: "5 min read" abstract: "AppService registers studio applications, configures allowed client origins, and manages API keys." status: "Stable" audience: "both" prevArticleId: "api-monetization" nextArticleId: "sdk-web" deflectionTags: - app - createapp - origins - products --- ## CreateApp RPC {#create-app} Register a new application under your studio workspace. :::endpoint method: POST path: /eclipse.v1.AppService/CreateApp service: AppService rpc: CreateApp description: Register a new studio product and configure its allowed client origins. authRequired: Server API Key ::: | Parameter | Type | Required | Description | | :--- | :--- | :--- | :--- | | `name` | string | Yes | Display name of the application (e.g. Doodle Notes). | | `slug` | string | Yes | URL-safe slug for the application. | | `app_type` | string | Yes | Application type (`APP_TYPE_SAAS`, `APP_TYPE_MOBILE`, `APP_TYPE_GAME`). | | `allowed_origins` | string[] | No | Permitted client origin URLs (e.g. `http://localhost:5174`). | --- id: sdk-web categoryId: sdk-reference title: "Web / TypeScript SDK Reference" badge: "TypeScript" summary: "Lightweight, zero-dependency browser SDK for 1-tap passkey auth and cross-app entitlements." lastUpdated: "October 2026" readTime: "6 min read" abstract: "The @bunchkey/web library provides browser and client-side web applications with native WebAuthn passkey management, session storage, and instant entitlement checks." status: "Stable" audience: "both" prevArticleId: "api-app" nextArticleId: "sdk-go" deflectionTags: - sdk - web - typescript - npm --- ## Installation {#install-web} Install the client package from your package manager: ```bash label="npm" npm install @bunchkey/web ``` ```bash label="Direct cURL" curl -X POST https://api.bunchkey.com/eclipse.v1.AuthService/BeginPasskeyLogin \ -H "Content-Type: application/json" \ -d '{"app_id": "YOUR_APP_ID"}' ``` ## Initialization {#init-web} Initialize `BunchkeyClient` with your application ID: ```typescript label="TypeScript" import { BunchkeyClient } from '@bunchkey/web'; export const bunchkey = new BunchkeyClient({ appId: 'b0000000-0000-0000-0000-000000000010', endpoint: 'https://api.bunchkey.com', }); ``` ## Web SDK Client Methods {#web-methods} | Method | Return Type | Description | | :--- | :--- | :--- | | `loginWithPasskey()` | `Promise` | Triggers native biometric passkey prompt and establishes authenticated session. | | `registerPasskey(name)` | `Promise` | Enrolls a new hardware credential in the user device enclave. | | `hasEntitlement(key)` | `Promise` | Checks whether the active user holds access to the given entitlement key. | | `has(key, val?)` | `Promise` | Convenience helper for gating features in application UI. | | `logout()` | `Promise` | Clears local tokens and invalidates browser session. | ```typescript label="TypeScript" // Check active user's cross-app entitlement const isPro = await bunchkey.hasEntitlement('pro'); if (isPro) { enablePremiumFeatures(); } ``` --- id: sdk-go categoryId: sdk-reference title: "Server Go SDK Reference" badge: "Go Server" summary: "High-throughput server SDK for backend APIs, microservices, and webhook verification." lastUpdated: "October 2026" readTime: "7 min read" abstract: "The Bunchkey Go SDK provides typed ConnectRPC clients, atomic credit consumption, and cryptographic webhook verification." status: "Stable" audience: "both" prevArticleId: "sdk-web" nextArticleId: "sdk-swift" deflectionTags: - sdk - go - golang - server --- ## Installation {#install-go} ```bash label="go get" go get github.com/bunchkey/go ``` ```go label="Imports" import "github.com/bunchkey/go" ``` ## Go SDK Methods {#go-methods} | Method | Type | Description | | :--- | :--- | :--- | | `CheckEntitlement` | Method | Evaluates customer access rules with low-latency caching. | | `ConsumeCredit` | Method | Atomically deducts consumable tokens from customer wallets. | | `VerifyWebhookSignature` | Function | Cryptographically validates incoming HMAC-SHA256 headers. | ```go label="Go Server Example" package main import ( "context" "fmt" "github.com/bunchkey/go" ) func main() { client := bunchkey.NewClient(bunchkey.Config{ APIKey: "sec_live_sample", }) res, err := client.ConsumeCredit(context.Background(), &bunchkey.ConsumeCreditRequest{ UserId: "usr_123", CreditKey: "ai_tokens", Amount: 10, IdempotencyKey: "op_unique_123", }) if err != nil { panic(err) } fmt.Println("Remaining balance:", res.Balance) } ``` --- id: sdk-swift categoryId: sdk-reference title: "Apple Swift SDK Reference (iOS & macOS)" badge: "Swift" summary: "Native Swift package supporting ASAuthorizationPlatformPublicKeyCredential and Touch ID/Face ID." lastUpdated: "October 2026" readTime: "6 min read" abstract: "Integrate native iOS and macOS applications into your Bunchkey ecosystem using Apple's AuthenticationServices framework." status: "Beta" audience: "both" prevArticleId: "sdk-go" nextArticleId: "sdk-kotlin" deflectionTags: - sdk - swift - ios - macos --- ## Package Installation {#install-swift} Add BunchkeyKit to your Xcode project or `Package.swift`: ```swift label="Package.swift" dependencies: [ .package(url: "https://github.com/bunchkey/bunchkey-swift.git", from: "0.1.0") ] ``` ## Client Initialization {#init-swift} ```swift label="Swift" import BunchkeyKit import AuthenticationServices let bunchkey = BunchkeyClient(appId: "YOUR_APP_ID") func authenticate(in window: UIWindow) async throws { let session = try await bunchkey.loginWithPasskey(presentationContextProvider: window) print("User authenticated:", session.user.id) } ``` --- id: sdk-kotlin categoryId: sdk-reference title: "Android Kotlin SDK Reference" badge: "Kotlin" summary: "Android Credential Manager integration for seamless Passkey registration and login." lastUpdated: "October 2026" readTime: "6 min read" abstract: "The Bunchkey Android SDK bridges Android 14+ Credential Manager APIs into your studio's unified identity mesh." status: "Beta" audience: "both" prevArticleId: "sdk-swift" nextArticleId: "sdk-unity" deflectionTags: - sdk - kotlin - android --- ## Gradle Dependency {#install-kotlin} ```kotlin label="build.gradle.kts" dependencies { implementation("com.bunchkey.sdk:bunchkey-android:0.1.0") } ``` ## Android Credential Flow {#init-kotlin} ```kotlin label="Kotlin" import com.bunchkey.sdk.BunchkeyClient val bunchkey = BunchkeyClient(appId = "YOUR_APP_ID") suspend fun signIn(activity: ComponentActivity) { val result = bunchkey.loginWithPasskey(activity) println("Authenticated: ${result.userId}") } ``` --- id: sdk-unity categoryId: sdk-reference title: "Unity C# SDK Reference" badge: "Unity" summary: "Unity Package Manager (UPM) plugin for game entitlement checks and in-game token consumption." lastUpdated: "October 2026" readTime: "5 min read" abstract: "Connect your Unity games to your studio catalog to share memberships, characters, and credits across PC, mobile, and WebGL." status: "Preview" audience: "both" prevArticleId: "sdk-kotlin" nextArticleId: "sdk-godot" deflectionTags: - sdk - unity - csharp - games --- ## UPM Package Installation {#install-unity} ```json label="Packages/manifest.json" { "dependencies": { "com.bunchkey.unity": "https://github.com/bunchkey/bunchkey-unity.git" } } ``` ## Unity C# Entitlement Check {#init-unity} ```csharp label="C#" using UnityEngine; using Bunchkey; public class GameAuthManager : MonoBehaviour { private BunchkeyClient client; async void Start() { client = new BunchkeyClient("b0000000-0000-0000-0000-000000000010"); bool hasPro = await client.HasEntitlementAsync("pro"); Debug.Log($"Pro access: {hasPro}"); } } ``` --- id: sdk-godot categoryId: sdk-reference title: "Godot 4 GDScript Reference" badge: "Godot 4" summary: "Lightweight Godot 4 addon for cross-platform games on desktop, mobile, and web." lastUpdated: "October 2026" readTime: "5 min read" abstract: "Enable shared studio login and cross-game entitlements in Godot 4 engines using pure GDScript HTTP nodes." status: "Preview" audience: "both" prevArticleId: "sdk-unity" nextArticleId: "sec-webauthn" deflectionTags: - sdk - godot - gdscript - games --- ## Addon Installation {#install-godot} Extract the Bunchkey plugin to `addons/bunchkey/` in your Godot 4 project directory and enable it in Project Settings -> Plugins: ```bash label="Installation Layout" # Copy addon files to your Godot project: res://addons/bunchkey/plugin.cfg res://addons/bunchkey/bunchkey.gd ``` ## GDScript Entitlement Check {#init-godot} ```gdscript label="GDScript" extends Node var bunchkey: BunchkeyClient func _ready(): bunchkey = BunchkeyClient.new("YOUR_APP_ID") bunchkey.connect("entitlement_checked", _on_entitlement_checked) bunchkey.check_entitlement("pro") func _on_entitlement_checked(entitlement: String, has_access: bool): print("Entitlement %s: %s" % [entitlement, str(has_access)]) ``` --- id: sec-webauthn categoryId: security title: "WebAuthn Cryptography & Enclave Isolation" badge: "WebAuthn L3" summary: "Detailed cryptographic specifications for W3C WebAuthn Level 3 hardware attestation." lastUpdated: "October 2026" readTime: "8 min read" abstract: "This specification details the cryptographic protocols used by Bunchkey to achieve zero-password, zero-custody biometric authentication." status: "Stable" audience: "both" prevArticleId: "sdk-godot" nextArticleId: "sec-gateway" deflectionTags: - security - webauthn - cryptography - biometric --- ## Asymmetric Public-Key Cryptography {#asymmetric-cryptography} Passkeys use asymmetric public-key cryptography (ES256 / ECDSA over NIST P-256 or Ed25519). During enrollment, the hardware security enclave (Apple Secure Enclave, Android Titan M, TPM 2.0) generates a keypair. The private key never leaves the device hardware boundary, while the public key is registered with Bunchkey. :::important Statutory Data Protection Guarantee Bunchkey never receives, processes, or stores raw biometric prints, faces, or scans. The biometric verification is entirely local to the user hardware authenticator. ::: ## Challenge-Response Handshake {#challenge-signing} To prevent replay attacks, every login requires a cryptographically secure 32-byte pseudo-random challenge generated by the server. Challenges have a strict 60-second single-use lifetime. The authenticator signs this challenge alongside origin metadata. Bunchkey verifies the signature using the user registered public key. --- id: sec-gateway categoryId: security title: "Dual-Auth Gateway Security Architecture" badge: "Dual-Auth" summary: "Two-tier security topology separating client-side user sessions from administrative server API keys." lastUpdated: "October 2026" readTime: "6 min read" abstract: "Bunchkey implements a Dual-Auth API Gateway pattern to guarantee strict boundary isolation between end-user actions and privileged tenant management." status: "Stable" audience: "both" prevArticleId: "sec-webauthn" nextArticleId: "errors-catalog" deflectionTags: - gateway - dual-auth - security - api keys --- ## Two-Tier Authorization Model {#auth-tiers} Requests are classified into Tier 1 (End-User Bearer Sessions) and Tier 2 (Bunchkey Server API Keys). Tier 1 tokens are short-lived JWTs scoped strictly to the user identity. Tier 2 keys are high-entropy secrets restricted to explicit permission scopes (e.g. `entitlements:write`). | Tier | Header Format | Description | | :--- | :--- | :--- | | **Tier 1: User Bearer JWT** | `Authorization: Bearer ` | Scoped to a single user. Issued after passkey/OTP ceremony. Subject to 1-hour expiration with rotating refresh tokens. | | **Tier 2: Bunchkey API Key** | `Authorization: Bearer sec_live_...` | Server-to-server credential. Allows administrative entitlement grants, catalog updates, and domain binding. | --- id: errors-catalog categoryId: errors title: "Status Codes & Error Dictionary" badge: "Error Codes" summary: "Comprehensive catalog of ConnectRPC error codes, HTTP status mappings, and recovery actions." lastUpdated: "October 2026" readTime: "6 min read" abstract: "Bunchkey uses canonical ConnectRPC / gRPC status codes. Every error response returns a structured JSON envelope with a machine-readable code, human-readable message, and diagnostic details." status: "Stable" audience: "both" prevArticleId: "sec-gateway" nextArticleId: "diagnostics" deflectionTags: - errors - status codes - connectrpc - troubleshooting --- ## Canonical Status Codes Reference {#status-codes-table} The following table maps ConnectRPC codes to standard HTTP responses: | Code & Name | HTTP Equivalent | Required | Description | | :--- | :--- | :--- | :--- | | `INVALID_ARGUMENT (3)` | HTTP 400 Bad Request | Yes | Client specified an invalid argument. Check request parameter types and constraints. | | `UNAUTHENTICATED (16)` | HTTP 401 Unauthorized | Yes | Request does not have valid authentication credentials (expired JWT or missing API Key). | | `PERMISSION_DENIED (7)` | HTTP 403 Forbidden | Yes | Caller does not have permission to execute the specified operation or user is blocked in app. | | `NOT_FOUND (5)` | HTTP 404 Not Found | Yes | The requested resource (e.g. CatalogItem SKU or App ID) was not found. | | `ALREADY_EXISTS (6)` | HTTP 409 Conflict | Yes | Resource already exists (e.g. duplicate app slug or registered domain). | | `RESOURCE_EXHAUSTED (8)` | HTTP 429 Too Many Requests | Yes | Insufficient token wallet balance for atomic deduction, or rate limit quota exceeded. | | `FAILED_PRECONDITION (9)` | HTTP 400 Bad Request | Yes | Operation rejected because system is not in state required for execution. | | `INTERNAL (13)` | HTTP 500 Internal Server Error | Yes | Internal server error. Logged with trace ID for audit investigation. | | `UNAVAILABLE (14)` | HTTP 503 Service Unavailable | Yes | Service is undergoing maintenance or dependent storage connection is transiently unreachable. | ## Structured Error Envelope Format {#error-envelope} All API errors adhere to the standard ConnectRPC JSON envelope: ```json label="Error JSON Envelope" { "code": "resource_exhausted", "message": "insufficient wallet balance: required 500, available 120", "details": [ { "type": "type.googleapis.com/eclipse.v1.QuotaFailure", "value": { "entitlementKey": "ai_tokens", "requestedDelta": -500, "currentBalance": 120 } } ] } ``` --- id: diagnostics categoryId: errors title: "Health Checks & Diagnostics" badge: "Observability" summary: "Probe service health, monitor availability, and trace ConnectRPC requests." lastUpdated: "October 2026" readTime: "4 min read" abstract: "Bunchkey provides standard health and readiness observability endpoints to ensure continuous uptime." status: "Stable" audience: "both" prevArticleId: "errors-catalog" deflectionTags: - diagnostics - healthz - readyz - monitoring --- ## System Health Endpoints {#health-endpoints} Monitor system readiness and operational status via HTTP GET: | Endpoint | HTTP Status | Required | Description | | :--- | :--- | :--- | :--- | | `GET /healthz` | HTTP 200 OK | Yes | Lightweight liveness probe indicating the HTTP gateway is responding. | | `GET /readyz` | HTTP 200 OK | Yes | Readiness probe verifying core database and messaging backend connectivity. | --- id: help-billing-plans categoryId: help-center title: "Account, Plans & Billing Management" badge: "Billing" summary: "Manage your studio subscription, understand tier limits, upgrade or downgrade, and download tax invoices." lastUpdated: "October 2026" readTime: "5 min read" abstract: "Self-service management for your studio workspace subscription, payment cards, billing receipts, and legal tax invoicing." status: "Stable" audience: "customer" deflectionTags: - billing - plans - subscription - invoice - tax - receipt - downgrade - upgrade --- ## Studio Plan Tiers {#plans-overview} Bunchkey provides three transparent studio workspace plans with a 0% take-rate on your revenue: - **Starter (Free $0/mo)**: Up to 3 products and 5,000 monthly active users across your portfolio. - **Studio ($79/mo)**: Up to 10 products, 50,000 monthly active users, and custom domain mapping. - **Scale ($299/mo)**: Unlimited products, 500,000 monthly active users, and multi-region passkey redundancy. ## Upgrading & Downgrading {#plan-changes} To change your studio plan: 1. Navigate to **Settings -> Billing** in your Studio Console. 2. Select your desired plan tier and click **Update Subscription**. 3. Upgrades take effect immediately with prorated billing. Downgrades take effect at the end of your current billing period. ## Corporate Tax Invoices & VAT Receipts {#invoices-and-tax} All paid subscription receipts are automatically generated and available under **Settings -> Billing -> Invoice History**. - Enter your company title, Tax ID / VKN, and Tax Office in **Billing Information** to ensure statutory tax compliance. - Receipts include your full billing breakdown and payment transaction ID. --- id: help-team-roles categoryId: help-center title: "Team Members, Granular Roles & RBAC" badge: "Team Management" summary: "Invite co-builders, configure role permissions, and securely manage studio access." lastUpdated: "October 2026" readTime: "4 min read" abstract: "Manage who can configure products, issue API keys, view customer telemetry, and manage billing within your studio organization." status: "Stable" audience: "customer" deflectionTags: - team - roles - invite - rbac - permissions - members --- ## Role Permissions Matrix {#roles-matrix} Bunchkey enforces strict role-based access control across four tiers: | Role | Products & Keys | Audience & Telemetry | SKU Catalog & Pricing | Billing & Plans | | :--- | :---: | :---: | :---: | :---: | | **Owner** | Full Control | Full Control | Full Control | Full Control | | **Admin** | Full Control | Full Control | Full Control | View Only | | **Member** | View & Edit | View Only | View & Edit | No Access | | **Viewer** | View Only | View Only | View Only | No Access | ## Inviting Co-Builders {#inviting-members} To invite engineers or collaborators to your studio: 1. Navigate to **Settings -> Team** in the Studio Console. 2. Click **Invite Co-Builder**, specify their work email address, and select their role. 3. An invitation token is generated with a 72-hour validity window. --- id: help-custom-domains categoryId: help-center title: "Custom Domains, DNS Records & CORS Origin Whitelist" badge: "Domains" summary: "Configure custom auth and checkout domains, set DNS CNAME records, and resolve CORS origin blocks." lastUpdated: "October 2026" readTime: "5 min read" abstract: "Serve passkey authentication and hosted checkouts on your own branded domain (e.g. auth.yourstudio.com) with automated TLS provisioning and strict origin allowlists." status: "Stable" audience: "customer" diagnosticAction: cors deflectionTags: - domain - custom domain - cors - origin - dns - cname - ssl - tls --- ## DNS CNAME & TXT Configuration {#dns-records} To verify and route a custom domain: 1. In the Studio Console, open **Settings -> Custom Domains**. 2. Add your custom hostname (e.g. `auth.yourstudio.com`). 3. Create the following DNS records with your DNS provider: - **CNAME Record**: Host `auth`, Target `cname.bunchkey.com` - **TXT Verification**: Host `_bunchkey-challenge.auth`, Value `` ## Resolving CORS Origin Errors {#resolving-cors} If your browser console displays `CORS request blocked: Origin not allowed`: 1. Check that the calling website's exact origin (protocol + domain + port, e.g. `http://localhost:5173` or `https://myapp.com`) is added under **Product Settings -> Allowed Origins**. 2. Avoid trailing slashes in origin configurations (use `https://myapp.com`, not `https://myapp.com/`). 3. You can verify your origin instantly using the live **CORS Diagnostic Probe** in the Diagnostics & Support Drawer. --- id: help-troubleshooting categoryId: help-center title: "Self-Service Troubleshooting & Instant Diagnostics" badge: "Troubleshooting" summary: "Instant fixes for the top support issues: CORS errors, passkey RP ID mismatches, webhook failures, and invalid keys." lastUpdated: "October 2026" readTime: "6 min read" abstract: "Before opening a support ticket, follow these self-service diagnostic checklists to resolve configuration mismatches and test active connections with live probes." status: "Stable" audience: "customer" diagnosticAction: webhook deflectionTags: - troubleshooting - cors - passkey - webhook - api key - error - failure --- ## 1. CORS Origin Blocked {#troubleshoot-cors} **Symptoms**: Browser network calls to `api.bunchkey.com` fail with HTTP 403 or `Access-Control-Allow-Origin` missing in response. **Quick Resolution**: - Open **Products -> [Select App] -> Allowed Origins**. - Ensure the origin where your app is running is explicitly listed. For local development, specify both `http://localhost:` and `http://127.0.0.1:`. - Launch the live **CORS Origin Checker** in your Diagnostics Drawer to test connectivity. ## 2. Passkey Prompt Fails or Doesn't Trigger {#troubleshoot-passkey} **Symptoms**: The browser throws `NotAllowedError`, `SecurityError`, or the biometric dialog does not appear. **Quick Resolution**: - Passkeys require a secure context: `https://` in production, or `localhost` / `127.0.0.1` during local development. - Verify that your operating system has a supported platform authenticator enabled (Touch ID on macOS, Windows Hello on Windows, Fingerprint/Screen lock on Android). - Check that the RP ID configured in your app matches the current domain. ## 3. Webhook Signature Verification Fails {#troubleshoot-webhook} **Symptoms**: Your server logs show HTTP 401 `Invalid signature` on incoming webhook events. **Quick Resolution**: - Ensure you are passing the **raw request body buffer** to `verifyWebhookSignature`, not a pre-parsed JSON object. - Check that your `BUNCHKEY_WEBHOOK_SECRET` matches the secret displayed in **Settings -> Webhooks**. - Test your endpoint using the live **Webhook Signature Ping** probe in the Diagnostics Drawer. ## 4. API Key Returns UNAUTHENTICATED or PERMISSION_DENIED {#troubleshoot-apikey} **Symptoms**: Backend API calls return ConnectRPC error code 16 (`UNAUTHENTICATED`) or code 7 (`PERMISSION_DENIED`). **Quick Resolution**: - Confirm the `Authorization` header is formatted as `Bearer sec_live_...`. - Verify the API key has not expired or been revoked under **Developers -> API Keys**. - Run the **API Key Validation Probe** to verify key scopes.