Skip to main content
Fetches a paginated list of all available prediction market threads.

Endpoint

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

Query Parameters

status
string
Filter by thread status. Options: active, upcoming, completed, resolved, cancelled, paused
category
string
Filter by category (e.g., politics, crypto, sports)
tags
string
Comma-separated list of tags to filter by (e.g., election,2024)
limit
number
default:"20"
Maximum number of results per page (max: 100)
offset
number
default:"0"
Pagination offset for fetching subsequent pages
sortBy
string
default:"created_at"
Field to sort by. Options: created_at, updated_at, total_volume, market_count, title
sortOrder
string
default:"desc"
Sort direction. Options: asc, desc

Response

threads
array
Array of thread objects
pagination
object
Pagination metadata

Rate Limit

50 requests per minute per IP address

Example Request

curl "https://app.kash.bot/api/threads?status=active&limit=10&sortBy=total_volume&sortOrder=desc"

Example Response

200 - Success
{
  "threads": [
    {
      "id": "abc123-def456",
      "title": "2024 Election Predictions",
      "description": "Markets for the 2024 US Presidential Election",
      "totalVolume": 1250000,
      "marketCount": 12,
      "participantCount": 342,
      "startTime": 1704067200,
      "endTime": 1735689600,
      "status": "active",
      "category": "politics",
      "tags": ["election", "politics", "2024"],
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-15T12:30:00Z"
    },
    {
      "id": "xyz789-abc123",
      "title": "Crypto Price Predictions 2024",
      "description": "Will Bitcoin reach $100k?",
      "totalVolume": 980000,
      "marketCount": 8,
      "participantCount": 256,
      "startTime": 1704067200,
      "endTime": 1735689600,
      "status": "active",
      "category": "crypto",
      "tags": ["bitcoin", "crypto", "2024"],
      "createdAt": "2024-01-05T00:00:00Z",
      "updatedAt": "2024-01-16T08:15:00Z"
    }
  ],
  "pagination": {
    "offset": 0,
    "limit": 10,
    "total": 25,
    "hasMore": true
  },
  "_meta": {
    "authenticated": false,
    "requestedAt": "2024-01-16T12:00:00Z"
  }
}
400 - Bad Request
{
  "error": "Invalid query parameters",
  "message": "limit must be between 1 and 100",
  "code": "INVALID_REQUEST"
}
429 - Rate Limit Exceeded
{
  "error": "Too many requests",
  "message": "Rate limit of 50 requests per minute exceeded",
  "code": "RATE_LIMIT_EXCEEDED",
  "retryAfter": 45
}

Response Headers

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

Common Use Cases

Fetch active threads with high volume

curl "https://app.kash.bot/api/threads?status=active&sortBy=total_volume&sortOrder=desc&limit=5"

Filter by category and tags

curl "https://app.kash.bot/api/threads?category=politics&tags=election,2024"

Paginate through all threads

async function fetchAllThreads() {
  let allThreads = [];
  let offset = 0;
  let hasMore = true;

  while (hasMore) {
    const response = await fetch(
      `https://app.kash.bot/api/threads?limit=100&offset=${offset}`
    );
    const data = await response.json();

    allThreads = allThreads.concat(data.threads);
    hasMore = data.pagination.hasMore;
    offset += 100;
  }

  return allThreads;
}