Skip to main content
Embed Kash prediction market threads on your website using HTML iframes. This guide covers the basics of thread embeds, iframe parameters, and best practices.

Quick Start

The simplest way to embed a thread is using an iframe with the thread iframe URL:
Replace abc123 with your thread ID (obtained from the GET /api/threads endpoint).

Iframe Attributes

Required Attributes

string
required
The thread iframe URL: https://app.kash.bot/threads/{threadId}/iframe
string
default:"100%"
Iframe width - use 100% for responsive design
string
default:"600"
Iframe height in pixels (minimum 400px recommended)
string
default:"0"
Border width (set to 0 for seamless embed)
boolean
Allow fullscreen mode for market charts
string
default:"lazy"
Use eager for above-fold embeds, lazy for below-fold
string
Accessibility: describe the iframe content for screen readers

Query Parameters

string
Analytics label for embed attribution (e.g., your domain name). Recommended — it lets you (and Kash) segment embed traffic and interactions by placement. Note: source does not affect revenue share, which accrues per trade to the organization or partner that created the market.

Complete Example

Here’s a fully configured iframe embed:
What this does:
  • Embeds thread abc123 with the 20-tile market heatmap
  • Labels embed traffic as example.com for analytics attribution (organizations and partners earn revenue share on trades in markets they create — independent of source)
  • Displays thread title, description, and stats
  • Users can click any tile to view market details in a new tab
  • Predictions are made via Twitter (no login required in the iframe)

Responsive Design

Using CSS for Responsiveness

Wrap the iframe in a responsive container:

Mobile-Responsive Height

Adjust iframe height for different screen sizes using CSS media queries:

Security Considerations

Sandbox Attribute

Use the sandbox attribute to restrict iframe capabilities:
Sandbox permissions explained:
  • allow-scripts - Required for embed functionality
  • allow-same-origin - Allows API calls to Kash backend
  • allow-popups - Enables market detail modals
  • allow-forms - Allows trading form submissions
Do not use allow-top-navigation - This prevents the iframe from redirecting your parent page.

Content Security Policy (CSP)

If your site uses CSP headers, add Kash to allowed sources:

Finding Thread IDs

Use the GET /api/threads endpoint to discover thread IDs:

Performance Best Practices

1. Lazy Loading

Load below-fold iframes only when visible:

2. Preconnect to Kash Domain

Speed up iframe loading with DNS preconnect:

Accessibility

Provide Descriptive Title

Help screen reader users understand iframe content:

Keyboard Navigation

Kash embeds support full keyboard navigation:
  • Tab - Navigate between markets
  • Enter - Open market details
  • Escape - Close modals

ARIA Labels

The iframe automatically includes ARIA labels for interactive elements within the embed.

Common Issues

Iframe Not Displaying

Problem: Blank iframe or “Refused to display” error Solutions:
  1. Verify thread ID is correct
  2. Ensure URL uses the /iframe route: https://app.kash.bot/threads/{id}/iframe
  3. Check browser console for CSP errors
  4. Confirm parent page is served over HTTPS (required)

Height Not Correct

Problem: Iframe shows scrollbars or cuts off content Solutions:
  1. Set appropriate height: height="900" for threads, height="500" for markets
  2. Use CSS media queries to adjust height for different screen sizes
  3. Test on multiple devices and screen sizes

Markets Not Loading

Problem: Embed loads but shows no markets Solutions:
  1. Check thread has active markets using GET /api/threads/:id/markets
  2. Verify the thread ID is correct and the thread is active

Next Steps

Code Examples

View complete implementation examples

API Reference

Explore REST API endpoints