Documentation Index
Fetch the complete documentation index at: https://docs.thrads.ai/llms.txt
Use this file to discover all available pages before exploring further.
Handle Timeouts Gracefully
The endpoint has built-in timeouts (~3s max). Always set a client-side timeout as well:Respect Rate Limits
The API supports 100 requests per second per API key. Monitor rate limit headers:CORS Configuration
For browser-based requests, register your domains with Thrad:- Contact contact@thrad.ai to whitelist your domains
- Include the
Originheader in requests - Handle CORS preflight requests properly
Maintain Conversation Context
Keep the conversation history accurate for better ad relevance:Error Handling
Handle all possible response scenarios:How Matching Works
A few signals are derived server-side from what you already send — you don’t need to compute them:- Conversation language — auto-detected from
messages(last few turns). Used by language-targeted campaigns. Onopenerrequests with nomessages, the server falls back to theAccept-Languageheader; if neither is available, language targeting is skipped for that request. - Intent & keywords — derived from the conversation content.
- Geo — from
X-User-Country/X-User-Region/X-User-Cityheaders when provided, otherwise from theX-Forwarded-ForIP.
EU/UK Traffic & TCF Consent
oRTB DSPs scrub or skip requests for EU/UK users that don’t carry a valid IAB TCF v2 consent string. If your platform serves EU/UK traffic and you want full oRTB fill, passuser_metadata.tcf_consent (the raw base64 string from your CMP). The internal Thrad DSP doesn’t gate on TCF — you still get those bids — but external oRTB demand will drop without it.
Same applies to California traffic and user_metadata.us_privacy. Non-EU/non-US publishers can ignore both.
Maximising Fill Rate
Fill rate is the percentage of bid requests that return an ad. Several factors affect it: conversation relevance, geo targeting, campaign budgets, and pacing settings. Here’s a recommended approach: Start withoutforce — leave it off (the default) so you only show ads when there’s a strong contextual match. This gives the best user experience and highest click-through rates.
Monitor your fill rate — if you’re seeing a fill rate below your target, consider these steps in order:
- Lower
ad_offset— reduce the number of turns before the first ad.ad_offset: 0allows ads from the first exchange. - Lower
max_frequency— allow ads more frequently within a conversation. - Remove
max_headline_chars— headline constraints filter out some ads. Removing the limit increases the pool of eligible creatives. - Enable
force: true— as a last resort, force guarantees an ad is served whenever products exist in the system for the user’s geo, even if the conversation context isn’t a strong match.
Testing Your Integration
- Start with your staging API key: Use the staging-environment key during development — it always returns ads and doesn’t count toward monetization
- Test with various conversation flows: Try different topics and conversation lengths
- Handle no-bid scenarios: Ensure your UI gracefully handles null bids
- Test error scenarios: Verify error handling works correctly
- Monitor performance: Track request latency and success rates
- Switch to production key only when going live: Production keys enable real targeting, geolocation, and monetization
