Guides
Best Practices
Production tips for the Thunderbit Open API: concurrency, retries with backoff, idempotency, error handling, schema design, and cost-efficient batch sizing.
- Cache aggressively. Distill responses are deterministic for static pages — cache the markdown by URL hash on your side and bypass with
forceRefresh: trueonly when you need fresh data. - Use
includeover legacy booleans.includeHtml: trueandextractLinks: truestill work; the newinclude: ["metadata", "links"]array is composable and clearer in code review. - Prefer batch over loops. A batch of 50 URLs returns one job ID; 50 individual
/distillcalls burn rate limit and concurrency. - Use webhooks for jobs >10 URLs. Polling every 5 seconds for a 5-minute job wastes ~60 round-trips. See Webhooks.
- Wait only when you need to.
waitFor: 2000doubles your latency budget — set it only for SPAs that hydrate slowly. - Pin a
countryCodewhen scraping geo-aware sites (pricing, search results, e-commerce). Defaults to US. - Start with
renderMode: "none"and upgrade tobasicorfullonly if the page returns empty — most pages don't need a headless browser. See Render Modes. - Be specific in schemas. Field
descriptions are read by the AI;"product MSRP in USD before discount"extracts more reliably than"price". See Schema Design. - Make webhook handlers idempotent. A webhook can fire more than once for the same job ID under network partition.