> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kash.bot/llms.txt
> Use this file to discover all available pages before exploring further.

# GET /api/threads/:id

> Get details for a specific prediction market thread

Fetches detailed information for a single prediction market thread by its ID.

## Endpoint

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

## Path Parameters

<ParamField path="id" type="string" required>
  The unique thread identifier (UUID format)
</ParamField>

## Response

<ResponseField name="thread" type="object">
  Thread details object

  <Expandable title="Thread Properties">
    <ResponseField name="id" type="string">
      Unique thread identifier
    </ResponseField>

    <ResponseField name="title" type="string">
      Thread title
    </ResponseField>

    <ResponseField name="description" type="string">
      Thread description (may include markdown)
    </ResponseField>

    <ResponseField name="image" type="string">
      Thread cover image URL (IPFS or CDN)
    </ResponseField>

    <ResponseField name="backgroundImage" type="string">
      Background image URL for enhanced displays
    </ResponseField>

    <ResponseField name="totalVolume" type="number">
      Total trading volume across all markets (in cents)
    </ResponseField>

    <ResponseField name="marketCount" type="number">
      Number of markets in this thread
    </ResponseField>

    <ResponseField name="participantCount" type="number">
      Number of unique participants
    </ResponseField>

    <ResponseField name="startTime" type="number">
      Thread start time (Unix timestamp in seconds, optional)
    </ResponseField>

    <ResponseField name="endTime" type="number">
      Thread end time (Unix timestamp in seconds, optional)
    </ResponseField>

    <ResponseField name="status" type="string">
      Current status: `active`, `upcoming`, `completed`, `resolved`, `cancelled`, `paused`
    </ResponseField>

    <ResponseField name="category" type="string">
      Thread category (e.g., `politics`, `crypto`, `sports`)
    </ResponseField>

    <ResponseField name="tags" type="array">
      Array of tag strings for filtering and discovery
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 timestamp of thread creation
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      ISO 8601 timestamp of last update
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="_meta" type="object">
  Request metadata

  <Expandable title="Metadata Properties">
    <ResponseField name="authenticated" type="boolean">
      Whether the request was authenticated
    </ResponseField>

    <ResponseField name="requestedAt" type="string">
      ISO 8601 timestamp of request processing
    </ResponseField>
  </Expandable>
</ResponseField>

## Rate Limit

<Info>
  **100 requests per minute** per IP address
</Info>

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://app.kash.bot/api/threads/abc123-def456"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://app.kash.bot/api/threads/abc123-def456'
  );
  const data = await response.json();
  console.log(`Thread: ${data.thread.title}`);
  console.log(`Markets: ${data.thread.marketCount}`);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://app.kash.bot/api/threads/abc123-def456'
  )
  data = response.json()
  print(f"Thread: {data['thread']['title']}")
  print(f"Markets: {data['thread']['marketCount']}")
  ```
</CodeGroup>

## Example Response

```json 200 - Success theme={null}
{
  "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"
  }
}
```

```json 404 - Not Found theme={null}
{
  "error": "Thread not found",
  "message": "No thread exists with ID: abc123-def456",
  "code": "THREAD_NOT_FOUND"
}
```

```json 429 - Rate Limit Exceeded theme={null}
{
  "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:

```javascript theme={null}
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:

```javascript theme={null}
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:

```jsx React Component theme={null}
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>
  );
}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="GET /api/threads" href="/developer-docs/public-embed-api/endpoints/threads">
    List all available threads with filtering
  </Card>

  <Card title="GET /api/threads/:id/markets" href="/developer-docs/public-embed-api/endpoints/thread-markets">
    Get all markets within this thread
  </Card>
</CardGroup>
