Skip to main content
Fetches all chapters within a thread. Chapters are logical groupings of markets derived from denormalized fields on the markets table, ordered by position.

Endpoint

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

Path Parameters

id
string
required
The unique thread identifier (UUID format)

Response

chapters
array
Array of chapter summary objects, ordered by position
_meta
object
Request metadata

Rate Limit

100 requests per minute per IP address

Example Request

curl "https://app.kash.bot/api/threads/7c9e6679-7425-40de-944b-e07fc1f90ae7/chapters"

Example Response

200 - Success
{
  "chapters": [
    {
      "chapterId": "ch-group-stage",
      "title": "Group Stage",
      "position": 1,
      "total": 4,
      "marketCount": 24
    },
    {
      "chapterId": "ch-round-of-16",
      "title": "Round of 16",
      "position": 2,
      "total": 4,
      "marketCount": 8
    },
    {
      "chapterId": "ch-quarter-finals",
      "title": "Quarter Finals",
      "position": 3,
      "total": 4,
      "marketCount": 4
    },
    {
      "chapterId": "ch-finals",
      "title": "Semi Finals & Final",
      "position": 4,
      "total": 4,
      "marketCount": 3
    }
  ],
  "_meta": {
    "threadId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "requestedAt": "2026-03-04T12:00:00Z"
  }
}
404 - Thread Not Found
{
  "error": "Thread not found",
  "message": "No thread exists with ID: 7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "code": "NOT_FOUND"
}

Common Use Cases

Build a chapter navigation sidebar

async function buildChapterNav(threadId) {
  const { chapters } = await fetch(
    `https://app.kash.bot/api/threads/${threadId}/chapters`
  ).then(r => r.json());

  return chapters.map(ch => ({
    id: ch.chapterId,
    label: ch.title || `Chapter ${ch.position}`,
    marketCount: ch.marketCount,
    active: false,
  }));
}

Fetch markets for a specific chapter

Use the chapterId from this endpoint to filter markets:
async function getChapterMarkets(threadId, chapterId) {
  // Get chapter info
  const { chapters } = await fetch(
    `https://app.kash.bot/api/threads/${threadId}/chapters`
  ).then(r => r.json());

  const chapter = chapters.find(ch => ch.chapterId === chapterId);

  // Get markets filtered by chapterId
  const { markets } = await fetch(
    `https://app.kash.bot/api/markets?` +
    new URLSearchParams({ chapterId, status: 'active' })
  ).then(r => r.json());

  return { chapter, markets };
}

Build a complete thread page with chapters

async function buildThreadWithChapters(threadId) {
  // Fetch thread details and chapters in parallel
  const [threadRes, chaptersRes] = await Promise.all([
    fetch(`https://app.kash.bot/api/threads/${threadId}`),
    fetch(`https://app.kash.bot/api/threads/${threadId}/chapters`),
  ]);

  const { thread } = await threadRes.json();
  const { chapters } = await chaptersRes.json();

  // Fetch markets for each chapter
  const chaptersWithMarkets = await Promise.all(
    chapters.map(async (chapter) => {
      const { markets } = await fetch(
        `https://app.kash.bot/api/markets?chapterId=${chapter.chapterId}`
      ).then(r => r.json());
      return { ...chapter, markets };
    })
  );

  return { thread, chapters: chaptersWithMarkets };
}