Skip to main content
Fetches detailed information for a single prediction market thread by its ID.

Endpoint

GET https://app.kash.bot/api/threads/:id

Path Parameters

id
string
required
The unique thread identifier (UUID format)

Response

thread
object
Thread details object
_meta
object
Request metadata

Rate Limit

100 requests per minute per IP address

Example Request

curl "https://app.kash.bot/api/threads/abc123-def456"

Example Response

200 - Success
{
  "thread": {
    "id": "abc123-def456",
    "title": "2024 Election Predictions",
    "description": "Make predictions on the 2024 US Presidential Election and related political events.",
    "image": "https://ipfs.io/ipfs/QmXyz...",
    "backgroundImage": "https://ipfs.io/ipfs/QmAbc...",
    "totalVolume": 1250000,
    "marketCount": 12,
    "participantCount": 342,
    "startTime": 1704067200,
    "endTime": 1735689600,
    "status": "active",
    "category": "politics",
    "tags": ["election", "politics", "2024", "usa"],
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-15T12:30:00Z"
  },
  "_meta": {
    "authenticated": false,
    "requestedAt": "2024-01-16T12:00:00Z"
  }
}
404 - Not Found
{
  "error": "Thread not found",
  "message": "No thread exists with ID: abc123-def456",
  "code": "THREAD_NOT_FOUND"
}
429 - Rate Limit Exceeded
{
  "error": "Too many requests",
  "message": "Rate limit of 100 requests per minute exceeded",
  "code": "RATE_LIMIT_EXCEEDED",
  "retryAfter": 45
}

Response Headers

All responses include rate limit headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1704067260000
Access-Control-Allow-Origin: *

Common Use Cases

Fetch thread before embedding

Before embedding a thread iframe, fetch its details to display metadata:
async function embedThread(threadId) {
  // Fetch thread details
  const response = await fetch(`https://app.kash.bot/api/threads/${threadId}`);
  const { thread } = await response.json();

  // Display thread info above iframe
  document.getElementById('thread-title').textContent = thread.title;
  document.getElementById('thread-stats').textContent =
    `${thread.marketCount} markets • ${thread.participantCount} participants`;

  // Embed iframe
  const iframe = document.createElement('iframe');
  iframe.src = `https://app.kash.bot/threads/${threadId}/iframe`;
  iframe.width = '100%';
  iframe.height = '900';
  document.getElementById('embed-container').appendChild(iframe);
}

Check thread status before displaying

Avoid embedding inactive threads:
const { thread } = await fetch(`https://app.kash.bot/api/threads/${threadId}`)
  .then(r => r.json());

if (thread.status !== 'active') {
  console.log('Thread is not active, showing fallback content');
  return;
}

// Proceed with embedding

Build custom thread cards

Create custom UI cards with thread data:
React Component
function ThreadCard({ threadId }) {
  const [thread, setThread] = useState(null);

  useEffect(() => {
    fetch(`https://app.kash.bot/api/threads/${threadId}`)
      .then(r => r.json())
      .then(data => setThread(data.thread));
  }, [threadId]);

  if (!thread) return <div>Loading...</div>;

  return (
    <div className="thread-card">
      <img src={thread.image} alt={thread.title} />
      <h3>{thread.title}</h3>
      <p>{thread.description}</p>
      <div className="stats">
        <span>{thread.marketCount} markets</span>
        <span>${(thread.totalVolume / 100).toLocaleString()} volume</span>
      </div>
    </div>
  );
}