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

# ターン一覧取得

> ターン履歴をカーソルベースでページネーション取得します

# ターン一覧取得

APIキーに紐づくワークスペースのターン履歴を新しい順で返します。各ターンには紐づくAgentRun情報が含まれます。

## リクエスト

```
GET /api/v1/turn/list
```

### ヘッダー

| ヘッダー            | 必須 | 説明                             |
| --------------- | -- | ------------------------------ |
| `Authorization` | はい | `Bearer snorbe_...` 形式の API キー |

### クエリパラメータ

| パラメータ    | 型         | 必須  | デフォルト | 説明                 |
| -------- | --------- | --- | ----- | ------------------ |
| `limit`  | `integer` | いいえ | `10`  | 1ページあたりの取得件数（1〜50） |
| `cursor` | `string`  | いいえ | -     | 前ページの `nextCursor` |

<Note>
  ワークスペースは API キーに紐づくものが自動的に使用されます。パラメータは不要です。
</Note>

## レスポンス

```json theme={null}
{
  "turns": [
    {
      "id": "clxxx001",
      "kind": "user",
      "content": "最新のAI動向を調査して",
      "agentRunId": null,
      "createdAt": "2026-04-16T10:30:00.000Z",
      "agentRun": null
    },
    {
      "id": "clxxx002",
      "kind": "assistant",
      "content": "調査結果をお伝えします...",
      "agentRunId": "clyyy001",
      "createdAt": "2026-04-16T10:30:05.000Z",
      "agentRun": {
        "id": "clyyy001",
        "status": "completed",
        "process": [],
        "agent": { "id": "clzzz001", "name": "agent" },
        "images": [
          {
            "imageUrl": "https://example.com/photo-1.jpg",
            "thumbnailUrl": "https://example.com/thumb-1.jpg",
            "title": "リチウムイオン電池の構造図",
            "link": "https://example.com/article-1"
          }
        ]
      }
    }
  ],
  "nextCursor": "clxxx003"
}
```

### レスポンスフィールド

| フィールド                                    | 型                     | 説明                                                                  |
| ---------------------------------------- | --------------------- | ------------------------------------------------------------------- |
| `turns`                                  | `object[]`            | ターン配列（新しい順）                                                         |
| `turns[].id`                             | `string`              | ターン ID                                                              |
| `turns[].kind`                           | `string`              | `user`, `assistant`, `error`                                        |
| `turns[].content`                        | `string`              | ターン内容                                                               |
| `turns[].agentRunId`                     | `string \| null`      | 紐づくAgentRun ID                                                      |
| `turns[].agentRun`                       | `object \| null`      | AgentRun詳細                                                          |
| `turns[].agentRun.status`                | `string`              | `running`, `completed`, `failed` 等                                  |
| `turns[].agentRun.agent`                 | `object`              | エージェント情報                                                            |
| `turns[].agentRun.images`                | `object[]`            | process から抽出された画像配列。検索画像 SERP・スキル成果物・ソース要約の bodyLinks 画像を統合（重複排除済み） |
| `turns[].agentRun.images[].imageUrl`     | `string`              | 画像 URL                                                              |
| `turns[].agentRun.images[].thumbnailUrl` | `string \| undefined` | サムネイル URL（Serper 経由のみ存在）                                            |
| `turns[].agentRun.images[].title`        | `string \| undefined` | 画像タイトル / alt                                                        |
| `turns[].agentRun.images[].link`         | `string \| undefined` | 元ページの URL                                                           |
| `nextCursor`                             | `string \| null`      | 次ページ用カーソル（`null` = 最終ページ）                                           |

## 使用例

<CodeGroup>
  ```bash cURL theme={null}
  # 最初のページ
  curl "https://app.snorbe.deskrex.ai/api/v1/turn/list?limit=10" \
    -H "Authorization: Bearer snorbe_your_api_key_here"

  # 次のページ
  curl "https://app.snorbe.deskrex.ai/api/v1/turn/list?limit=10&cursor=clxxx003" \
    -H "Authorization: Bearer snorbe_your_api_key_here"
  ```

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

  base_url = "https://app.snorbe.deskrex.ai/api/v1/turn/list"
  headers = {"Authorization": "Bearer snorbe_your_api_key_here"}
  cursor = None

  while True:
      params = {"limit": 10}
      if cursor:
          params["cursor"] = cursor
      resp = requests.get(base_url, params=params, headers=headers)
      data = resp.json()
      for turn in data["turns"]:
          print(f"[{turn['kind']}] {turn['content'][:50]}")
      cursor = data.get("nextCursor")
      if not cursor:
          break
  ```

  ```typescript TypeScript theme={null}
  const baseUrl = "https://app.snorbe.deskrex.ai/api/v1/turn/list";
  const headers = { Authorization: "Bearer snorbe_your_api_key_here" };

  let cursor: string | undefined;
  do {
    const url = cursor
      ? `${baseUrl}?limit=10&cursor=${cursor}`
      : `${baseUrl}?limit=10`;
    const resp = await fetch(url, { headers });
    const data = await resp.json();
    for (const turn of data.turns) {
      console.log(`[${turn.kind}] ${turn.content.slice(0, 50)}`);
    }
    cursor = data.nextCursor ?? undefined;
  } while (cursor);
  ```
</CodeGroup>

## エラーレスポンス

| HTTP ステータス | コード                 | 説明                    |
| ---------- | ------------------- | --------------------- |
| 401        | `UNAUTHORIZED`      | API キーが無効、期限切れ、または未指定 |
| 429        | `TOO_MANY_REQUESTS` | レート制限超過               |
