> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/api/api-doc-ja/api-reference/dui-hua-he-xun-xi.md).

# 会話とメッセージ

### メッセージを送信 (ストリーミング) <a href="#undefined" id="undefined"></a>

POST `/api/chatbots/{chatbotId}/completions/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明 |
| ----------- | -- | ------ | -- |
| `chatbotId` | ✅  | string |    |

#### リクエスト内容

**リクエストパラメータ**

| フィールド                  | 型                                                                | 必須 | 説明                                                        |
| ---------------------- | ---------------------------------------------------------------- | -- | --------------------------------------------------------- |
| conversation           | string (uuid)                                                    | 任意 | 会話の一意の識別子。空の場合は新しい会話を作成します (任意)                           |
| message                | object (6 つのプロパティを含む: content, contentPayload, queryMetadata...) | 必須 | 送信するメッセージの内容                                              |
| message.content        | string                                                           | 必須 | メッセージのテキスト内容                                              |
| message.contentPayload | object                                                           | 任意 | メッセージの追加コンテンツペイロード。JSON 形式 (任意)                           |
| message.queryMetadata  | object                                                           | 任意 | クエリメタデータ。JSON 形式 (任意)                                     |
| message.metadata       | object                                                           | 任意 | メッセージの環境メタデータ (タイムゾーンなどの情報)。JSON 形式 (任意)                  |
| message.attachments    | array\[AttachmentInput]                                          | 任意 | メッセージの添付ファイル一覧 (任意)                                       |
| message.sender         | string (uuid)                                                    | 任意 | 送信者の Contact ID (任意)                                      |
| isStreaming            | boolean                                                          | 任意 | ストリーミングモードでレスポンスするかどうか。デフォルトは false (任意)                  |
| waitForAttachments     | boolean                                                          | 任意 | 添付ファイルの処理完了を待ってから agent workflow に進むかどうか。デフォルトは true (任意) |

**リクエスト構造の例**

```typescript
{
  "conversation"?: string (uuid) // 会話の一意の識別子。空の場合は新しい会話を作成します (任意) (任意)
  "message":  // 送信するメッセージの内容
  {
    "content": string // メッセージのテキスト内容
    "contentPayload"?: object // メッセージの追加コンテンツペイロード。JSON 形式 (任意) (任意)
    "queryMetadata"?: object // クエリメタデータ。JSON 形式 (任意) (任意)
    "metadata"?: object // メッセージの環境メタデータ (タイムゾーンなどの情報)。JSON 形式 (任意) (任意)
    "attachments"?: [ // メッセージの添付ファイル一覧 (任意) (任意)
      {
        "id": string (uuid) // 添付ファイルの一意の識別子
        "type":  // 添付ファイルの種類。指定可能な値: image (画像)、video (動画。開発中で未対応)、audio (音声)、sticker (スタンプ。開発中で未対応)、other (その他)

* `image` - Image
* `video` - Video
* `audio` - Audio
* `sticker` - Sticker
* `other` - Other
        {
        }
        "filename": string // 添付ファイルのファイル名
        "file": string (uri) // 添付ファイルの URL アドレス
      }
    ]
    "sender"?: string (uuid) // 送信者の Contact ID (任意) (任意)
  }
  "isStreaming"?: boolean // ストリーミングモードでレスポンスするかどうか。デフォルトは false (任意) (任意)
  "waitForAttachments"?: boolean // 添付ファイルの処理完了を待ってから agent workflow に進むかどうか。デフォルトは true (任意) (任意)
}
```

**リクエストのサンプル値**

```json
{
  "message": {
    "content": "こんにちは、自己紹介をしてください"
  },
  "is_streaming": true
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/completions/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "content": "こんにちは、自己紹介をしてください"
    },
    "is_streaming": true
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "message": {
      "content": "こんにちは、自己紹介をしてください"
    },
    "is_streaming": true
  };

axios.post("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/completions/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/completions/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "message": {
        "content": "こんにちは、自己紹介をしてください"
      },
      "is_streaming": true
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/completions/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "message": {
                "content": "こんにちは、自己紹介をしてください"
            },
            "is_streaming": true
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

| ステータスコード | 説明                                               |
| -------- | ------------------------------------------------ |
| 200      | 会話のレスポンス内容。ストリーミングの場合はイベントストリームになります             |
| 400      | リクエストパラメータが不正です。考えられる原因: Contact ID がその組織に属していない |

***

### メッセージを送信 (ストリーミング) <a href="#undefined" id="undefined"></a>

POST `/api/v1/chatbots/{chatbotId}/completions/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明 |
| ----------- | -- | ------ | -- |
| `chatbotId` | ✅  | string |    |

#### リクエスト内容

**リクエストパラメータ**

| フィールド                  | 型                                                                | 必須 | 説明                                                        |
| ---------------------- | ---------------------------------------------------------------- | -- | --------------------------------------------------------- |
| conversation           | string (uuid)                                                    | 任意 | 会話の一意の識別子。空の場合は新しい会話を作成します (任意)                           |
| message                | object (6 つのプロパティを含む: content, contentPayload, queryMetadata...) | 必須 | 送信するメッセージの内容                                              |
| message.content        | string                                                           | 必須 | メッセージのテキスト内容                                              |
| message.contentPayload | object                                                           | 任意 | メッセージの追加コンテンツペイロード。JSON 形式 (任意)                           |
| message.queryMetadata  | object                                                           | 任意 | クエリメタデータ。JSON 形式 (任意)                                     |
| message.metadata       | object                                                           | 任意 | メッセージの環境メタデータ (タイムゾーンなどの情報)。JSON 形式 (任意)                  |
| message.attachments    | array\[AttachmentInput]                                          | 任意 | メッセージの添付ファイル一覧 (任意)                                       |
| message.sender         | string (uuid)                                                    | 任意 | 送信者の Contact ID (任意)                                      |
| isStreaming            | boolean                                                          | 任意 | ストリーミングモードでレスポンスするかどうか。デフォルトは false (任意)                  |
| waitForAttachments     | boolean                                                          | 任意 | 添付ファイルの処理完了を待ってから agent workflow に進むかどうか。デフォルトは true (任意) |

**リクエスト構造の例**

```typescript
{
  "conversation"?: string (uuid) // 会話の一意の識別子。空の場合は新しい会話を作成します (任意) (任意)
  "message":  // 送信するメッセージの内容
  {
    "content": string // メッセージのテキスト内容
    "contentPayload"?: object // メッセージの追加コンテンツペイロード。JSON 形式 (任意) (任意)
    "queryMetadata"?: object // クエリメタデータ。JSON 形式 (任意) (任意)
    "metadata"?: object // メッセージの環境メタデータ (タイムゾーンなどの情報)。JSON 形式 (任意) (任意)
    "attachments"?: [ // メッセージの添付ファイル一覧 (任意) (任意)
      {
        "id": string (uuid) // 添付ファイルの一意の識別子
        "type":  // 添付ファイルの種類。指定可能な値: image (画像)、video (動画。開発中で未対応)、audio (音声)、sticker (スタンプ。開発中で未対応)、other (その他)

* `image` - Image
* `video` - Video
* `audio` - Audio
* `sticker` - Sticker
* `other` - Other
        {
        }
        "filename": string // 添付ファイルのファイル名
        "file": string (uri) // 添付ファイルの URL アドレス
      }
    ]
    "sender"?: string (uuid) // 送信者の Contact ID (任意) (任意)
  }
  "isStreaming"?: boolean // ストリーミングモードでレスポンスするかどうか。デフォルトは false (任意) (任意)
  "waitForAttachments"?: boolean // 添付ファイルの処理完了を待ってから agent workflow に進むかどうか。デフォルトは true (任意) (任意)
}
```

**リクエストのサンプル値**

```json
{
  "message": {
    "content": "こんにちは、自己紹介をしてください"
  },
  "is_streaming": true
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/chatbots/550e8400-e29b-41d4-a716-446655440000/completions/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "content": "こんにちは、自己紹介をしてください"
    },
    "is_streaming": true
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "message": {
      "content": "こんにちは、自己紹介をしてください"
    },
    "is_streaming": true
  };

axios.post("https://api.maiagent.ai/api/v1/chatbots/550e8400-e29b-41d4-a716-446655440000/completions/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/chatbots/550e8400-e29b-41d4-a716-446655440000/completions/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "message": {
        "content": "こんにちは、自己紹介をしてください"
      },
      "is_streaming": true
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/chatbots/550e8400-e29b-41d4-a716-446655440000/completions/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "message": {
                "content": "こんにちは、自己紹介をしてください"
            },
            "is_streaming": true
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

| ステータスコード | 説明                                               |
| -------- | ------------------------------------------------ |
| 200      | 会話のレスポンス内容。ストリーミングの場合はイベントストリームになります             |
| 400      | リクエストパラメータが不正です。考えられる原因: Contact ID がその組織に属していない |

***

### メッセージを送信 (作成) <a href="#undefined" id="undefined"></a>

POST `/api/messages/`

#### リクエスト内容

**リクエストパラメータ**

| フィールド             | 型                             | 必須 | 説明                          |
| ----------------- | ----------------------------- | -- | --------------------------- |
| conversation      | string (uuid)                 | 必須 |                             |
| type              | string                        | 任意 |                             |
| content           | string                        | 任意 |                             |
| contentPayload    | object                        | 任意 |                             |
| attachments       | array\[AttachmentCreateInput] | 任意 |                             |
| canvas            | object                        | 任意 |                             |
| canvas.name       | string                        | 必須 |                             |
| canvas.canvasType | object                        | 必須 |                             |
| canvas.title      | string                        | 必須 |                             |
| canvas.content    | string                        | 必須 |                             |
| queryMetadata     | object                        | 任意 |                             |
| metadata          | object                        | 任意 | メッセージのメタデータ (タイムゾーンなどの環境情報) |
| broadcast         | boolean                       | 任意 |                             |

**リクエスト構造の例**

```typescript
{
  "conversation": string (uuid)
  "type"?: string // 任意
  "content"?: string // 任意
  "contentPayload"?: object // 任意
  "attachments"?: [ // 任意
    {
      "type"?:  // 任意
      {
      }
      "filename": string
      "file": string (uri)
      "conversation"?: string (uuid) // 任意
    }
  ]
  "canvas"?: { // 任意
  {
    "name": string
    "canvasType": 
    {
    }
    "title": string
    "content": string
  }
  }
  "queryMetadata"?: object // 任意
  "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
  "broadcast"?: boolean // 任意
}
```

**リクエストのサンプル値**

````json
{
  "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
  "sender": {
    "id": 2.992461161002561e+38,
    "name": "jessiekuo",
    "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
  },
  "type": "incoming",
  "content": "これはテストメッセージです",
  "contentPayload": {
    "content": "これはテストメッセージです",
    "items": [
      {
        "type": "text",
        "text": "これはテストメッセージです",
        "startTimestamp": null,
        "citations": []
      }
    ],
    "metadata": null
  },
  "feedback": "like",
  "createdAt": "1748314926000",
  "attachments": [],
  "citations": [],
  "citationNodes": [],
  "canvas": {
    "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
    "name": "system-architecture-diagram",
    "canvasType": "markdown",
    "title": "システム構成図",
    "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
    "createdAt": "1748314926000"
  }
}
````

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

````bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/messages/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
    "sender": {
      "id": 2.992461161002561e+38,
      "name": "jessiekuo",
      "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
    },
    "type": "incoming",
    "content": "これはテストメッセージです",
    "contentPayload": {
      "content": "これはテストメッセージです",
      "items": [
        {
          "type": "text",
          "text": "これはテストメッセージです",
          "startTimestamp": null,
          "citations": []
        }
      ],
      "metadata": null
    },
    "feedback": "like",
    "createdAt": "1748314926000",
    "attachments": [],
    "citations": [],
    "citationNodes": [],
    "canvas": {
      "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
      "name": "system-architecture-diagram",
      "canvasType": "markdown",
      "title": "システム構成図",
      "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
      "createdAt": "1748314926000"
    }
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
````

{% endtab %}

{% tab title="JavaScript" %}

````javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
    "sender": {
      "id": 2.992461161002561e+38,
      "name": "jessiekuo",
      "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
    },
    "type": "incoming",
    "content": "これはテストメッセージです",
    "contentPayload": {
      "content": "これはテストメッセージです",
      "items": [
        {
          "type": "text",
          "text": "これはテストメッセージです",
          "startTimestamp": null,
          "citations": []
        }
      ],
      "metadata": null
    },
    "feedback": "like",
    "createdAt": "1748314926000",
    "attachments": [],
    "citations": [],
    "citationNodes": [],
    "canvas": {
      "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
      "name": "system-architecture-diagram",
      "canvasType": "markdown",
      "title": "システム構成図",
      "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
      "createdAt": "1748314926000"
    }
  };

axios.post("https://api.maiagent.ai/api/messages/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
````

{% endtab %}

{% tab title="Python" %}

````python
import requests

url = "https://api.maiagent.ai/api/messages/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
      "sender": {
        "id": 2.992461161002561e+38,
        "name": "jessiekuo",
        "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
      },
      "type": "incoming",
      "content": "これはテストメッセージです",
      "contentPayload": {
        "content": "これはテストメッセージです",
        "items": [
          {
            "type": "text",
            "text": "これはテストメッセージです",
            "startTimestamp": null,
            "citations": []
          }
        ],
        "metadata": null
      },
      "feedback": "like",
      "createdAt": "1748314926000",
      "attachments": [],
      "citations": [],
      "citationNodes": [],
      "canvas": {
        "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
        "name": "system-architecture-diagram",
        "canvasType": "markdown",
        "title": "システム構成図",
        "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
        "createdAt": "1748314926000"
      }
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
````

{% endtab %}

{% tab title="PHP" %}

````php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/messages/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
            "sender": {
                "id": 2.992461161002561e+38,
                "name": "jessiekuo",
                "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
            },
            "type": "incoming",
            "content": "これはテストメッセージです",
            "contentPayload": {
                "content": "これはテストメッセージです",
                "items": [
                    {
                        "type": "text",
                        "text": "これはテストメッセージです",
                        "startTimestamp": null,
                        "citations": []
                    }
                ],
                "metadata": null
            },
            "feedback": "like",
            "createdAt": "1748314926000",
            "attachments": [],
            "citations": [],
            "citationNodes": [],
            "canvas": {
                "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
                "name": "system-architecture-diagram",
                "canvasType": "markdown",
                "title": "システム構成図",
                "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
                "createdAt": "1748314926000"
            }
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
````

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 201**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "conversation": string (uuid)
  "sender": 
  {
    "id": string (uuid)
    "name": string
    "avatar": string
    "email"?: string (email) // 任意
    "phoneNumber"?: string // 任意
  }
  "type"?: string // 任意
  "content"?: string // 任意
  "contentPayload"?: object // 任意
  "feedback": 
  {
    "id": string (uuid)
    "type": 
    {
    }
    "suggestion"?: string // 任意
    "updatedAt": string (timestamp)
  }
  "createdAt": string (timestamp)
  "attachments"?: [ // 任意
    {
      "id": string (uuid)
      "type"?:  // 任意
      {
      }
      "filename": string
      "file": string (uri)
      "conversation"?: string (uuid) // 任意
    }
  ]
  "citations": [
    {
      "id": string (uuid)
      "filename": string // ファイル名
      "file": string (uri) // アップロードするファイル
      "fileType": string
      "knowledgeBase"?:  // 任意
      {
        "id": string (uuid)
        "name": string
      }
      "size": integer
      "status": 
      {
      }
      "parser": {
      {
        "id": string (uuid)
        "name": string
        "provider": 
        {
        }
        "order"?: integer // 任意
      }
      }
      "labels"?: [ // 任意
        {
          "id": string (uuid)
          "name": string
        }
      ]
      "rawUserDefineMetadata"?: object // 任意
      "vectorStorageSize": integer // Size of vectors for this file in Elasticsearch (bytes)
      "chunksCount": integer // Number of chunks/nodes generated from this file
      "waitingTime": number (double)
      "processingTime": number (double)
      "processingTimeDetails": object
      "createdAt": string (timestamp)
    }
  ]
  "citationNodes": [
    {
      "chatbotTextNode": {
      {
        "id": string (uuid)
        "charactersCount": integer
        "hitsCount": integer
        "text": string
        "updatedAt": string (timestamp)
        "filename": string
        "chatbotFile": object // ChatbotFile の完全な情報を返します。フロントエンドでの画像プレビューに対応するため、ファイルの URL と種類を含みます
        "knowledgeBaseFile": object // get_chatbot_file と同じです。後方互換性のために提供しています
        "pageNumber": integer
        "citationTitle": string // inline citation hover card で表示する出典のタイトル
        "citationDescription": string // inline citation hover card で表示する出典の説明
        "citationQuote": string // inline citation hover card で表示する引用テキストの断片
        "hasImage": boolean // 画像を含むかどうかを判定します (ファイルの種類または text 内の Markdown 画像をチェック)
        "imageUrl": string // 画像 URL を抽出します (ファイル URL を優先し、なければ Markdown から抽出)
        "displayText": string // 画像の Markdown 記法を除去した完全なテキストを返します
        "displayTitle": string // 表示タイトルを返します (fallback: citation_title -> filename)
        "highlightedText": string // Return text with matched terms wrapped in ``<mark>`` tags.

Priority:
1. ES/OpenSearch native highlight (set by retrieve_api via ``_es_highlighted_text``)
2. Python regex fallback (keyword-based, works for all backends)
      }
      }
      "score"?: number (double) // 任意
      "displayScore": integer
      "citationNumber"?: integer // Citation 番号。レスポンス内容の [1]、[2] などの記号に対応します (任意)
      "highlightedText"?: string // ES/OpenSearch highlight result with <mark> tags (任意)
    }
  ]
  "canvas"?: { // 任意
  {
    "id": string (uuid)
    "name": string
    "canvasType": 
    {
    }
    "title": string
    "content": string
    "createdAt": string (timestamp)
  }
  }
  "queryMetadata"?: object // 任意
  "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
  "recordId": string // Message に対応する ChatbotRecord ID を返します

Note:
    保存されていない Message (streaming 中の仮想 Message など) の場合は、そのまま None を返し、
    OneToOneField の reverse relation による DB クエリ (N+1 問題) を回避します。
  "broadcast"?: boolean // 任意
}
```

**レスポンスのサンプル値**

````json
{
  "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
  "sender": {
    "id": 2.992461161002561e+38,
    "name": "jessiekuo",
    "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
  },
  "type": "incoming",
  "content": "これはテストメッセージです",
  "contentPayload": {
    "content": "これはテストメッセージです",
    "items": [
      {
        "type": "text",
        "text": "これはテストメッセージです",
        "startTimestamp": null,
        "citations": []
      }
    ],
    "metadata": null
  },
  "feedback": "like",
  "createdAt": "1748314926000",
  "attachments": [],
  "citations": [],
  "citationNodes": [],
  "canvas": {
    "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
    "name": "system-architecture-diagram",
    "canvasType": "markdown",
    "title": "システム構成図",
    "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
    "createdAt": "1748314926000"
  }
}
````

***

### メッセージを送信 (作成) <a href="#undefined" id="undefined"></a>

POST `/api/v1/messages/`

#### リクエスト内容

**リクエストパラメータ**

| フィールド             | 型                             | 必須 | 説明                          |
| ----------------- | ----------------------------- | -- | --------------------------- |
| conversation      | string (uuid)                 | 必須 |                             |
| type              | string                        | 任意 |                             |
| content           | string                        | 任意 |                             |
| contentPayload    | object                        | 任意 |                             |
| attachments       | array\[AttachmentCreateInput] | 任意 |                             |
| canvas            | object                        | 任意 |                             |
| canvas.name       | string                        | 必須 |                             |
| canvas.canvasType | object                        | 必須 |                             |
| canvas.title      | string                        | 必須 |                             |
| canvas.content    | string                        | 必須 |                             |
| queryMetadata     | object                        | 任意 |                             |
| metadata          | object                        | 任意 | メッセージのメタデータ (タイムゾーンなどの環境情報) |
| broadcast         | boolean                       | 任意 |                             |

**リクエスト構造の例**

```typescript
{
  "conversation": string (uuid)
  "type"?: string // 任意
  "content"?: string // 任意
  "contentPayload"?: object // 任意
  "attachments"?: [ // 任意
    {
      "type"?:  // 任意
      {
      }
      "filename": string
      "file": string (uri)
      "conversation"?: string (uuid) // 任意
    }
  ]
  "canvas"?: { // 任意
  {
    "name": string
    "canvasType": 
    {
    }
    "title": string
    "content": string
  }
  }
  "queryMetadata"?: object // 任意
  "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
  "broadcast"?: boolean // 任意
}
```

**リクエストのサンプル値**

````json
{
  "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
  "sender": {
    "id": 2.992461161002561e+38,
    "name": "jessiekuo",
    "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
  },
  "type": "incoming",
  "content": "これはテストメッセージです",
  "contentPayload": {
    "content": "これはテストメッセージです",
    "items": [
      {
        "type": "text",
        "text": "これはテストメッセージです",
        "startTimestamp": null,
        "citations": []
      }
    ],
    "metadata": null
  },
  "feedback": "like",
  "createdAt": "1748314926000",
  "attachments": [],
  "citations": [],
  "citationNodes": [],
  "canvas": {
    "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
    "name": "system-architecture-diagram",
    "canvasType": "markdown",
    "title": "システム構成図",
    "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
    "createdAt": "1748314926000"
  }
}
````

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

````bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/messages/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
    "sender": {
      "id": 2.992461161002561e+38,
      "name": "jessiekuo",
      "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
    },
    "type": "incoming",
    "content": "これはテストメッセージです",
    "contentPayload": {
      "content": "これはテストメッセージです",
      "items": [
        {
          "type": "text",
          "text": "これはテストメッセージです",
          "startTimestamp": null,
          "citations": []
        }
      ],
      "metadata": null
    },
    "feedback": "like",
    "createdAt": "1748314926000",
    "attachments": [],
    "citations": [],
    "citationNodes": [],
    "canvas": {
      "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
      "name": "system-architecture-diagram",
      "canvasType": "markdown",
      "title": "システム構成図",
      "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
      "createdAt": "1748314926000"
    }
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
````

{% endtab %}

{% tab title="JavaScript" %}

````javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
    "sender": {
      "id": 2.992461161002561e+38,
      "name": "jessiekuo",
      "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
    },
    "type": "incoming",
    "content": "これはテストメッセージです",
    "contentPayload": {
      "content": "これはテストメッセージです",
      "items": [
        {
          "type": "text",
          "text": "これはテストメッセージです",
          "startTimestamp": null,
          "citations": []
        }
      ],
      "metadata": null
    },
    "feedback": "like",
    "createdAt": "1748314926000",
    "attachments": [],
    "citations": [],
    "citationNodes": [],
    "canvas": {
      "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
      "name": "system-architecture-diagram",
      "canvasType": "markdown",
      "title": "システム構成図",
      "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
      "createdAt": "1748314926000"
    }
  };

axios.post("https://api.maiagent.ai/api/v1/messages/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
````

{% endtab %}

{% tab title="Python" %}

````python
import requests

url = "https://api.maiagent.ai/api/v1/messages/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
      "sender": {
        "id": 2.992461161002561e+38,
        "name": "jessiekuo",
        "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
      },
      "type": "incoming",
      "content": "これはテストメッセージです",
      "contentPayload": {
        "content": "これはテストメッセージです",
        "items": [
          {
            "type": "text",
            "text": "これはテストメッセージです",
            "startTimestamp": null,
            "citations": []
          }
        ],
        "metadata": null
      },
      "feedback": "like",
      "createdAt": "1748314926000",
      "attachments": [],
      "citations": [],
      "citationNodes": [],
      "canvas": {
        "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
        "name": "system-architecture-diagram",
        "canvasType": "markdown",
        "title": "システム構成図",
        "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
        "createdAt": "1748314926000"
      }
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
````

{% endtab %}

{% tab title="PHP" %}

````php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/messages/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
            "sender": {
                "id": 2.992461161002561e+38,
                "name": "jessiekuo",
                "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
            },
            "type": "incoming",
            "content": "これはテストメッセージです",
            "contentPayload": {
                "content": "これはテストメッセージです",
                "items": [
                    {
                        "type": "text",
                        "text": "これはテストメッセージです",
                        "startTimestamp": null,
                        "citations": []
                    }
                ],
                "metadata": null
            },
            "feedback": "like",
            "createdAt": "1748314926000",
            "attachments": [],
            "citations": [],
            "citationNodes": [],
            "canvas": {
                "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
                "name": "system-architecture-diagram",
                "canvasType": "markdown",
                "title": "システム構成図",
                "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
                "createdAt": "1748314926000"
            }
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
````

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 201**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "conversation": string (uuid)
  "sender": 
  {
    "id": string (uuid)
    "name": string
    "avatar": string
    "email"?: string (email) // 任意
    "phoneNumber"?: string // 任意
  }
  "type"?: string // 任意
  "content"?: string // 任意
  "contentPayload"?: object // 任意
  "feedback": 
  {
    "id": string (uuid)
    "type": 
    {
    }
    "suggestion"?: string // 任意
    "updatedAt": string (timestamp)
  }
  "createdAt": string (timestamp)
  "attachments"?: [ // 任意
    {
      "id": string (uuid)
      "type"?:  // 任意
      {
      }
      "filename": string
      "file": string (uri)
      "conversation"?: string (uuid) // 任意
    }
  ]
  "citations": [
    {
      "id": string (uuid)
      "filename": string // ファイル名
      "file": string (uri) // アップロードするファイル
      "fileType": string
      "knowledgeBase"?:  // 任意
      {
        "id": string (uuid)
        "name": string
      }
      "size": integer
      "status": 
      {
      }
      "parser": {
      {
        "id": string (uuid)
        "name": string
        "provider": 
        {
        }
        "order"?: integer // 任意
      }
      }
      "labels"?: [ // 任意
        {
          "id": string (uuid)
          "name": string
        }
      ]
      "rawUserDefineMetadata"?: object // 任意
      "vectorStorageSize": integer // Size of vectors for this file in Elasticsearch (bytes)
      "chunksCount": integer // Number of chunks/nodes generated from this file
      "waitingTime": number (double)
      "processingTime": number (double)
      "processingTimeDetails": object
      "createdAt": string (timestamp)
    }
  ]
  "citationNodes": [
    {
      "chatbotTextNode": {
      {
        "id": string (uuid)
        "charactersCount": integer
        "hitsCount": integer
        "text": string
        "updatedAt": string (timestamp)
        "filename": string
        "chatbotFile": object // ChatbotFile の完全な情報を返します。フロントエンドでの画像プレビューに対応するため、ファイルの URL と種類を含みます
        "knowledgeBaseFile": object // get_chatbot_file と同じです。後方互換性のために提供しています
        "pageNumber": integer
        "citationTitle": string // inline citation hover card で表示する出典のタイトル
        "citationDescription": string // inline citation hover card で表示する出典の説明
        "citationQuote": string // inline citation hover card で表示する引用テキストの断片
        "hasImage": boolean // 画像を含むかどうかを判定します (ファイルの種類または text 内の Markdown 画像をチェック)
        "imageUrl": string // 画像 URL を抽出します (ファイル URL を優先し、なければ Markdown から抽出)
        "displayText": string // 画像の Markdown 記法を除去した完全なテキストを返します
        "displayTitle": string // 表示タイトルを返します (fallback: citation_title -> filename)
        "highlightedText": string // Return text with matched terms wrapped in ``<mark>`` tags.

Priority:
1. ES/OpenSearch native highlight (set by retrieve_api via ``_es_highlighted_text``)
2. Python regex fallback (keyword-based, works for all backends)
      }
      }
      "score"?: number (double) // 任意
      "displayScore": integer
      "citationNumber"?: integer // Citation 番号。レスポンス内容の [1]、[2] などの記号に対応します (任意)
      "highlightedText"?: string // ES/OpenSearch highlight result with <mark> tags (任意)
    }
  ]
  "canvas"?: { // 任意
  {
    "id": string (uuid)
    "name": string
    "canvasType": 
    {
    }
    "title": string
    "content": string
    "createdAt": string (timestamp)
  }
  }
  "queryMetadata"?: object // 任意
  "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
  "recordId": string // Message に対応する ChatbotRecord ID を返します

Note:
    保存されていない Message (streaming 中の仮想 Message など) の場合は、そのまま None を返し、
    OneToOneField の reverse relation による DB クエリ (N+1 問題) を回避します。
  "broadcast"?: boolean // 任意
}
```

**レスポンスのサンプル値**

````json
{
  "conversation": "c96a0fb9-d106-4b16-8706-3906533bafa2",
  "sender": {
    "id": 2.992461161002561e+38,
    "name": "jessiekuo",
    "avatar": "https://autox-media-dev.playma.app/static/images/default-user-avatar.png"
  },
  "type": "incoming",
  "content": "これはテストメッセージです",
  "contentPayload": {
    "content": "これはテストメッセージです",
    "items": [
      {
        "type": "text",
        "text": "これはテストメッセージです",
        "startTimestamp": null,
        "citations": []
      }
    ],
    "metadata": null
  },
  "feedback": "like",
  "createdAt": "1748314926000",
  "attachments": [],
  "citations": [],
  "citationNodes": [],
  "canvas": {
    "id": "034eecd7-e0f4-46e9-88cb-4fefdb5b7ddd",
    "name": "system-architecture-diagram",
    "canvasType": "markdown",
    "title": "システム構成図",
    "content": "```mermaid\ngraph TD\n    A[ユーザー] --> B[フロントエンド画面]\n    B --> C[API層]\n    C --> D[データベース]\n```",
    "createdAt": "1748314926000"
  }
}
````

***

### プロアクティブメッセージを送信 <a href="#undefined" id="undefined"></a>

POST `/api/messages/outgoing/`

#### リクエスト内容

**リクエストパラメータ**

| フィールド             | 型                             | 必須 | 説明                          |
| ----------------- | ----------------------------- | -- | --------------------------- |
| conversation      | string (uuid)                 | 必須 |                             |
| type              | string                        | 任意 |                             |
| content           | string                        | 任意 |                             |
| contentPayload    | object                        | 任意 |                             |
| attachments       | array\[AttachmentCreateInput] | 任意 |                             |
| canvas            | object                        | 任意 |                             |
| canvas.name       | string                        | 必須 |                             |
| canvas.canvasType | object                        | 必須 |                             |
| canvas.title      | string                        | 必須 |                             |
| canvas.content    | string                        | 必須 |                             |
| queryMetadata     | object                        | 任意 |                             |
| metadata          | object                        | 任意 | メッセージのメタデータ (タイムゾーンなどの環境情報) |
| broadcast         | boolean                       | 任意 |                             |

**リクエスト構造の例**

```typescript
{
  "conversation": string (uuid)
  "type"?: string // 任意
  "content"?: string // 任意
  "contentPayload"?: object // 任意
  "attachments"?: [ // 任意
    {
      "type"?:  // 任意
      {
      }
      "filename": string
      "file": string (uri)
      "conversation"?: string (uuid) // 任意
    }
  ]
  "canvas"?: { // 任意
  {
    "name": string
    "canvasType": 
    {
    }
    "title": string
    "content": string
  }
  }
  "queryMetadata"?: object // 任意
  "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
  "broadcast"?: boolean // 任意
}
```

**リクエストのサンプル値**

```json
{
  "conversation": "550e8400-e29b-41d4-a716-446655440000",
  "type": "サンプル文字列",
  "content": "こんにちは！製品情報について知りたいです。",
  "contentPayload": null,
  "attachments": [
    {
      "type": {},
      "filename": "document.pdf",
      "file": "https://example.com/file.jpg",
      "conversation": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "canvas": {
    "name": "サンプル名",
    "canvasType": {},
    "title": "サンプル名",
    "content": "こんにちは！製品情報について知りたいです。"
  },
  "queryMetadata": null,
  "metadata": null,
  "broadcast": true
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/messages/outgoing/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "conversation": "550e8400-e29b-41d4-a716-446655440000",
    "type": "サンプル文字列",
    "content": "こんにちは！製品情報について知りたいです。",
    "contentPayload": null,
    "attachments": [
      {
        "type": {},
        "filename": "document.pdf",
        "file": "https://example.com/file.jpg",
        "conversation": "550e8400-e29b-41d4-a716-446655440000"
      }
    ],
    "canvas": {
      "name": "サンプル名",
      "canvasType": {},
      "title": "サンプル名",
      "content": "こんにちは！製品情報について知りたいです。"
    },
    "queryMetadata": null,
    "metadata": null,
    "broadcast": true
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "conversation": "550e8400-e29b-41d4-a716-446655440000",
    "type": "サンプル文字列",
    "content": "こんにちは！製品情報について知りたいです。",
    "contentPayload": null,
    "attachments": [
      {
        "type": {},
        "filename": "document.pdf",
        "file": "https://example.com/file.jpg",
        "conversation": "550e8400-e29b-41d4-a716-446655440000"
      }
    ],
    "canvas": {
      "name": "サンプル名",
      "canvasType": {},
      "title": "サンプル名",
      "content": "こんにちは！製品情報について知りたいです。"
    },
    "queryMetadata": null,
    "metadata": null,
    "broadcast": true
  };

axios.post("https://api.maiagent.ai/api/messages/outgoing/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/messages/outgoing/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "conversation": "550e8400-e29b-41d4-a716-446655440000",
      "type": "サンプル文字列",
      "content": "こんにちは！製品情報について知りたいです。",
      "contentPayload": null,
      "attachments": [
        {
          "type": {},
          "filename": "document.pdf",
          "file": "https://example.com/file.jpg",
          "conversation": "550e8400-e29b-41d4-a716-446655440000"
        }
      ],
      "canvas": {
        "name": "サンプル名",
        "canvasType": {},
        "title": "サンプル名",
        "content": "こんにちは！製品情報について知りたいです。"
      },
      "queryMetadata": null,
      "metadata": null,
      "broadcast": true
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/messages/outgoing/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "conversation": "550e8400-e29b-41d4-a716-446655440000",
            "type": "サンプル文字列",
            "content": "こんにちは！製品情報について知りたいです。",
            "contentPayload": null,
            "attachments": [
                {
                    "type": {},
                    "filename": "document.pdf",
                    "file": "https://example.com/file.jpg",
                    "conversation": "550e8400-e29b-41d4-a716-446655440000"
                }
            ],
            "canvas": {
                "name": "サンプル名",
                "canvasType": {},
                "title": "サンプル名",
                "content": "こんにちは！製品情報について知りたいです。"
            },
            "queryMetadata": null,
            "metadata": null,
            "broadcast": true
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 201**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "conversation": string (uuid)
  "sender": 
  {
    "id": string (uuid)
    "name": string
    "avatar": string
    "email"?: string (email) // 任意
    "phoneNumber"?: string // 任意
  }
  "type"?: string // 任意
  "content"?: string // 任意
  "contentPayload"?: object // 任意
  "feedback": 
  {
    "id": string (uuid)
    "type": 
    {
    }
    "suggestion"?: string // 任意
    "updatedAt": string (timestamp)
  }
  "createdAt": string (timestamp)
  "attachments"?: [ // 任意
    {
      "id": string (uuid)
      "type"?:  // 任意
      {
      }
      "filename": string
      "file": string (uri)
      "conversation"?: string (uuid) // 任意
    }
  ]
  "citations": [
    {
      "id": string (uuid)
      "filename": string // ファイル名
      "file": string (uri) // アップロードするファイル
      "fileType": string
      "knowledgeBase"?:  // 任意
      {
        "id": string (uuid)
        "name": string
      }
      "size": integer
      "status": 
      {
      }
      "parser": {
      {
        "id": string (uuid)
        "name": string
        "provider": 
        {
        }
        "order"?: integer // 任意
      }
      }
      "labels"?: [ // 任意
        {
          "id": string (uuid)
          "name": string
        }
      ]
      "rawUserDefineMetadata"?: object // 任意
      "vectorStorageSize": integer // Size of vectors for this file in Elasticsearch (bytes)
      "chunksCount": integer // Number of chunks/nodes generated from this file
      "waitingTime": number (double)
      "processingTime": number (double)
      "processingTimeDetails": object
      "createdAt": string (timestamp)
    }
  ]
  "citationNodes": [
    {
      "chatbotTextNode": {
      {
        "id": string (uuid)
        "charactersCount": integer
        "hitsCount": integer
        "text": string
        "updatedAt": string (timestamp)
        "filename": string
        "chatbotFile": object // ChatbotFile の完全な情報を返します。フロントエンドでの画像プレビューに対応するため、ファイルの URL と種類を含みます
        "knowledgeBaseFile": object // get_chatbot_file と同じです。後方互換性のために提供しています
        "pageNumber": integer
        "citationTitle": string // inline citation hover card で表示する出典のタイトル
        "citationDescription": string // inline citation hover card で表示する出典の説明
        "citationQuote": string // inline citation hover card で表示する引用テキストの断片
        "hasImage": boolean // 画像を含むかどうかを判定します (ファイルの種類または text 内の Markdown 画像をチェック)
        "imageUrl": string // 画像 URL を抽出します (ファイル URL を優先し、なければ Markdown から抽出)
        "displayText": string // 画像の Markdown 記法を除去した完全なテキストを返します
        "displayTitle": string // 表示タイトルを返します (fallback: citation_title -> filename)
        "highlightedText": string // Return text with matched terms wrapped in ``<mark>`` tags.

Priority:
1. ES/OpenSearch native highlight (set by retrieve_api via ``_es_highlighted_text``)
2. Python regex fallback (keyword-based, works for all backends)
      }
      }
      "score"?: number (double) // 任意
      "displayScore": integer
      "citationNumber"?: integer // Citation 番号。レスポンス内容の [1]、[2] などの記号に対応します (任意)
      "highlightedText"?: string // ES/OpenSearch highlight result with <mark> tags (任意)
    }
  ]
  "canvas"?: { // 任意
  {
    "id": string (uuid)
    "name": string
    "canvasType": 
    {
    }
    "title": string
    "content": string
    "createdAt": string (timestamp)
  }
  }
  "queryMetadata"?: object // 任意
  "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
  "recordId": string // Message に対応する ChatbotRecord ID を返します

Note:
    保存されていない Message (streaming 中の仮想 Message など) の場合は、そのまま None を返し、
    OneToOneField の reverse relation による DB クエリ (N+1 問題) を回避します。
  "broadcast"?: boolean // 任意
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "conversation": "550e8400-e29b-41d4-a716-446655440000",
  "sender": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "avatar": "レスポンス文字列",
    "email": "response@example.com",
    "phoneNumber": "レスポンス文字列"
  },
  "type": "レスポンス文字列",
  "content": "レスポンス文字列",
  "contentPayload": null,
  "feedback": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": {},
    "suggestion": "レスポンス文字列",
    "updatedAt": "レスポンス文字列"
  },
  "createdAt": "レスポンス文字列",
  "attachments": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": {},
      "filename": "レスポンス文字列",
      "file": "https://example.com/file.jpg",
      "conversation": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "citations": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "filename": "レスポンス文字列",
      "file": "https://example.com/file.jpg",
      "fileType": "レスポンス文字列",
      "knowledgeBase": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列"
      },
      "size": 456,
      "status": {},
      "parser": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "provider": {},
        "order": 456
      },
      "labels": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンス文字列"
        }
      ],
      "rawUserDefineMetadata": null,
      "vectorStorageSize": 456,
      "chunksCount": 456,
      "waitingTime": 456,
      "processingTime": 456,
      "processingTimeDetails": null,
      "createdAt": "レスポンス文字列"
    }
  ],
  "citationNodes": [
    {
      "chatbotTextNode": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "charactersCount": 456,
        "hitsCount": 456,
        "text": "レスポンス文字列",
        "updatedAt": "レスポンス文字列",
        "filename": "レスポンス文字列",
        "chatbotFile": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンスのサンプル名",
          "description": "レスポンスのサンプル説明"
        },
        "knowledgeBaseFile": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンスのサンプル名",
          "description": "レスポンスのサンプル説明"
        },
        "pageNumber": 456,
        "citationTitle": "レスポンス文字列",
        "citationDescription": "レスポンス文字列",
        "citationQuote": "レスポンス文字列",
        "hasImage": false,
        "imageUrl": "レスポンス文字列",
        "displayText": "レスポンス文字列",
        "displayTitle": "レスポンス文字列",
        "highlightedText": "レスポンス文字列"
      },
      "score": 456,
      "displayScore": 456,
      "citationNumber": 456,
      "highlightedText": "レスポンス文字列"
    }
  ],
  "canvas": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "canvasType": {},
    "title": "レスポンス文字列",
    "content": "レスポンス文字列",
    "createdAt": "レスポンス文字列"
  },
  "queryMetadata": null,
  "metadata": null,
  "recordId": "レスポンス文字列",
  "broadcast": false
}
```

***

### プロアクティブメッセージを送信 <a href="#undefined" id="undefined"></a>

POST `/api/v1/messages/outgoing/`

#### リクエスト内容

**リクエストパラメータ**

| フィールド             | 型                             | 必須 | 説明                          |
| ----------------- | ----------------------------- | -- | --------------------------- |
| conversation      | string (uuid)                 | 必須 |                             |
| type              | string                        | 任意 |                             |
| content           | string                        | 任意 |                             |
| contentPayload    | object                        | 任意 |                             |
| attachments       | array\[AttachmentCreateInput] | 任意 |                             |
| canvas            | object                        | 任意 |                             |
| canvas.name       | string                        | 必須 |                             |
| canvas.canvasType | object                        | 必須 |                             |
| canvas.title      | string                        | 必須 |                             |
| canvas.content    | string                        | 必須 |                             |
| queryMetadata     | object                        | 任意 |                             |
| metadata          | object                        | 任意 | メッセージのメタデータ (タイムゾーンなどの環境情報) |
| broadcast         | boolean                       | 任意 |                             |

**リクエスト構造の例**

```typescript
{
  "conversation": string (uuid)
  "type"?: string // 任意
  "content"?: string // 任意
  "contentPayload"?: object // 任意
  "attachments"?: [ // 任意
    {
      "type"?:  // 任意
      {
      }
      "filename": string
      "file": string (uri)
      "conversation"?: string (uuid) // 任意
    }
  ]
  "canvas"?: { // 任意
  {
    "name": string
    "canvasType": 
    {
    }
    "title": string
    "content": string
  }
  }
  "queryMetadata"?: object // 任意
  "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
  "broadcast"?: boolean // 任意
}
```

**リクエストのサンプル値**

```json
{
  "conversation": "550e8400-e29b-41d4-a716-446655440000",
  "type": "サンプル文字列",
  "content": "こんにちは！製品情報について知りたいです。",
  "contentPayload": null,
  "attachments": [
    {
      "type": {},
      "filename": "document.pdf",
      "file": "https://example.com/file.jpg",
      "conversation": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "canvas": {
    "name": "サンプル名",
    "canvasType": {},
    "title": "サンプル名",
    "content": "こんにちは！製品情報について知りたいです。"
  },
  "queryMetadata": null,
  "metadata": null,
  "broadcast": true
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/messages/outgoing/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "conversation": "550e8400-e29b-41d4-a716-446655440000",
    "type": "サンプル文字列",
    "content": "こんにちは！製品情報について知りたいです。",
    "contentPayload": null,
    "attachments": [
      {
        "type": {},
        "filename": "document.pdf",
        "file": "https://example.com/file.jpg",
        "conversation": "550e8400-e29b-41d4-a716-446655440000"
      }
    ],
    "canvas": {
      "name": "サンプル名",
      "canvasType": {},
      "title": "サンプル名",
      "content": "こんにちは！製品情報について知りたいです。"
    },
    "queryMetadata": null,
    "metadata": null,
    "broadcast": true
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "conversation": "550e8400-e29b-41d4-a716-446655440000",
    "type": "サンプル文字列",
    "content": "こんにちは！製品情報について知りたいです。",
    "contentPayload": null,
    "attachments": [
      {
        "type": {},
        "filename": "document.pdf",
        "file": "https://example.com/file.jpg",
        "conversation": "550e8400-e29b-41d4-a716-446655440000"
      }
    ],
    "canvas": {
      "name": "サンプル名",
      "canvasType": {},
      "title": "サンプル名",
      "content": "こんにちは！製品情報について知りたいです。"
    },
    "queryMetadata": null,
    "metadata": null,
    "broadcast": true
  };

axios.post("https://api.maiagent.ai/api/v1/messages/outgoing/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/messages/outgoing/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "conversation": "550e8400-e29b-41d4-a716-446655440000",
      "type": "サンプル文字列",
      "content": "こんにちは！製品情報について知りたいです。",
      "contentPayload": null,
      "attachments": [
        {
          "type": {},
          "filename": "document.pdf",
          "file": "https://example.com/file.jpg",
          "conversation": "550e8400-e29b-41d4-a716-446655440000"
        }
      ],
      "canvas": {
        "name": "サンプル名",
        "canvasType": {},
        "title": "サンプル名",
        "content": "こんにちは！製品情報について知りたいです。"
      },
      "queryMetadata": null,
      "metadata": null,
      "broadcast": true
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/messages/outgoing/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "conversation": "550e8400-e29b-41d4-a716-446655440000",
            "type": "サンプル文字列",
            "content": "こんにちは！製品情報について知りたいです。",
            "contentPayload": null,
            "attachments": [
                {
                    "type": {},
                    "filename": "document.pdf",
                    "file": "https://example.com/file.jpg",
                    "conversation": "550e8400-e29b-41d4-a716-446655440000"
                }
            ],
            "canvas": {
                "name": "サンプル名",
                "canvasType": {},
                "title": "サンプル名",
                "content": "こんにちは！製品情報について知りたいです。"
            },
            "queryMetadata": null,
            "metadata": null,
            "broadcast": true
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 201**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "conversation": string (uuid)
  "sender": 
  {
    "id": string (uuid)
    "name": string
    "avatar": string
    "email"?: string (email) // 任意
    "phoneNumber"?: string // 任意
  }
  "type"?: string // 任意
  "content"?: string // 任意
  "contentPayload"?: object // 任意
  "feedback": 
  {
    "id": string (uuid)
    "type": 
    {
    }
    "suggestion"?: string // 任意
    "updatedAt": string (timestamp)
  }
  "createdAt": string (timestamp)
  "attachments"?: [ // 任意
    {
      "id": string (uuid)
      "type"?:  // 任意
      {
      }
      "filename": string
      "file": string (uri)
      "conversation"?: string (uuid) // 任意
    }
  ]
  "citations": [
    {
      "id": string (uuid)
      "filename": string // ファイル名
      "file": string (uri) // アップロードするファイル
      "fileType": string
      "knowledgeBase"?:  // 任意
      {
        "id": string (uuid)
        "name": string
      }
      "size": integer
      "status": 
      {
      }
      "parser": {
      {
        "id": string (uuid)
        "name": string
        "provider": 
        {
        }
        "order"?: integer // 任意
      }
      }
      "labels"?: [ // 任意
        {
          "id": string (uuid)
          "name": string
        }
      ]
      "rawUserDefineMetadata"?: object // 任意
      "vectorStorageSize": integer // Size of vectors for this file in Elasticsearch (bytes)
      "chunksCount": integer // Number of chunks/nodes generated from this file
      "waitingTime": number (double)
      "processingTime": number (double)
      "processingTimeDetails": object
      "createdAt": string (timestamp)
    }
  ]
  "citationNodes": [
    {
      "chatbotTextNode": {
      {
        "id": string (uuid)
        "charactersCount": integer
        "hitsCount": integer
        "text": string
        "updatedAt": string (timestamp)
        "filename": string
        "chatbotFile": object // ChatbotFile の完全な情報を返します。フロントエンドでの画像プレビューに対応するため、ファイルの URL と種類を含みます
        "knowledgeBaseFile": object // get_chatbot_file と同じです。後方互換性のために提供しています
        "pageNumber": integer
        "citationTitle": string // inline citation hover card で表示する出典のタイトル
        "citationDescription": string // inline citation hover card で表示する出典の説明
        "citationQuote": string // inline citation hover card で表示する引用テキストの断片
        "hasImage": boolean // 画像を含むかどうかを判定します (ファイルの種類または text 内の Markdown 画像をチェック)
        "imageUrl": string // 画像 URL を抽出します (ファイル URL を優先し、なければ Markdown から抽出)
        "displayText": string // 画像の Markdown 記法を除去した完全なテキストを返します
        "displayTitle": string // 表示タイトルを返します (fallback: citation_title -> filename)
        "highlightedText": string // Return text with matched terms wrapped in ``<mark>`` tags.

Priority:
1. ES/OpenSearch native highlight (set by retrieve_api via ``_es_highlighted_text``)
2. Python regex fallback (keyword-based, works for all backends)
      }
      }
      "score"?: number (double) // 任意
      "displayScore": integer
      "citationNumber"?: integer // Citation 番号。レスポンス内容の [1]、[2] などの記号に対応します (任意)
      "highlightedText"?: string // ES/OpenSearch highlight result with <mark> tags (任意)
    }
  ]
  "canvas"?: { // 任意
  {
    "id": string (uuid)
    "name": string
    "canvasType": 
    {
    }
    "title": string
    "content": string
    "createdAt": string (timestamp)
  }
  }
  "queryMetadata"?: object // 任意
  "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
  "recordId": string // Message に対応する ChatbotRecord ID を返します

Note:
    保存されていない Message (streaming 中の仮想 Message など) の場合は、そのまま None を返し、
    OneToOneField の reverse relation による DB クエリ (N+1 問題) を回避します。
  "broadcast"?: boolean // 任意
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "conversation": "550e8400-e29b-41d4-a716-446655440000",
  "sender": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "avatar": "レスポンス文字列",
    "email": "response@example.com",
    "phoneNumber": "レスポンス文字列"
  },
  "type": "レスポンス文字列",
  "content": "レスポンス文字列",
  "contentPayload": null,
  "feedback": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": {},
    "suggestion": "レスポンス文字列",
    "updatedAt": "レスポンス文字列"
  },
  "createdAt": "レスポンス文字列",
  "attachments": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": {},
      "filename": "レスポンス文字列",
      "file": "https://example.com/file.jpg",
      "conversation": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "citations": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "filename": "レスポンス文字列",
      "file": "https://example.com/file.jpg",
      "fileType": "レスポンス文字列",
      "knowledgeBase": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列"
      },
      "size": 456,
      "status": {},
      "parser": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "provider": {},
        "order": 456
      },
      "labels": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンス文字列"
        }
      ],
      "rawUserDefineMetadata": null,
      "vectorStorageSize": 456,
      "chunksCount": 456,
      "waitingTime": 456,
      "processingTime": 456,
      "processingTimeDetails": null,
      "createdAt": "レスポンス文字列"
    }
  ],
  "citationNodes": [
    {
      "chatbotTextNode": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "charactersCount": 456,
        "hitsCount": 456,
        "text": "レスポンス文字列",
        "updatedAt": "レスポンス文字列",
        "filename": "レスポンス文字列",
        "chatbotFile": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンスのサンプル名",
          "description": "レスポンスのサンプル説明"
        },
        "knowledgeBaseFile": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンスのサンプル名",
          "description": "レスポンスのサンプル説明"
        },
        "pageNumber": 456,
        "citationTitle": "レスポンス文字列",
        "citationDescription": "レスポンス文字列",
        "citationQuote": "レスポンス文字列",
        "hasImage": false,
        "imageUrl": "レスポンス文字列",
        "displayText": "レスポンス文字列",
        "displayTitle": "レスポンス文字列",
        "highlightedText": "レスポンス文字列"
      },
      "score": 456,
      "displayScore": 456,
      "citationNumber": 456,
      "highlightedText": "レスポンス文字列"
    }
  ],
  "canvas": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "canvasType": {},
    "title": "レスポンス文字列",
    "content": "レスポンス文字列",
    "createdAt": "レスポンス文字列"
  },
  "queryMetadata": null,
  "metadata": null,
  "recordId": "レスポンス文字列",
  "broadcast": false
}
```

***

### 新しい会話を作成 <a href="#undefined" id="undefined"></a>

POST `/api/conversations/`

#### リクエスト内容

**リクエストパラメータ**

| フィールド   | 型             | 必須 | 説明 |
| ------- | ------------- | -- | -- |
| webChat | string (uuid) | 必須 |    |
| contact | string (uuid) | 任意 |    |

**リクエスト構造の例**

```typescript
{
  "webChat": string (uuid)
  "contact"?: string (uuid) // 任意
}
```

**リクエストのサンプル値**

```json
{
  "webChat": "550e8400-e29b-41d4-a716-446655440000",
  "contact": "550e8400-e29b-41d4-a716-446655440000"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/conversations/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "webChat": "550e8400-e29b-41d4-a716-446655440000",
    "contact": "550e8400-e29b-41d4-a716-446655440000"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "webChat": "550e8400-e29b-41d4-a716-446655440000",
    "contact": "550e8400-e29b-41d4-a716-446655440000"
  };

axios.post("https://api.maiagent.ai/api/conversations/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/conversations/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "webChat": "550e8400-e29b-41d4-a716-446655440000",
      "contact": "550e8400-e29b-41d4-a716-446655440000"
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/conversations/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "webChat": "550e8400-e29b-41d4-a716-446655440000",
            "contact": "550e8400-e29b-41d4-a716-446655440000"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 201**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "contact": { // 軽量版の Contact Serializer。Conversation List view で使用します

List view に必要なフィールドのみを含み、inboxes と mcp_credentials を除外します
N+1 クエリ問題を回避するため
  {
    "id": string (uuid)
    "name": string
    "avatar"?: string (uri) // 任意
    "sourceId"?: string // 任意
  }
  }
  "inbox": {
  {
    "id": string (uuid)
    "name": string
    "channelType": string (enum: line, telegram, teams, web, messenger, instagram, email, whatsapp) // * `line` - LINE
* `telegram` - Telegram
* `teams` - Teams
* `web` - Web
* `messenger` - Messenger
* `instagram` - Instagram
* `email` - Email
* `whatsapp` - WhatsApp
    "unreadConversationsCount"?: integer // 任意
    "signAuth"?:  // 任意
    {
      "id": string (uuid)
      "signSource": string (uuid)
      "signParams": {
      {
        "keycloak": 
        {
          "clientId": string
          "url": string
          "realm": string
        }
        "line": 
        {
          "liffId": string
        }
        "ad": 
        {
          "saml": string
        }
      }
      }
    }
  }
  }
  "title": string
  "lastMessage"?: { // 任意
  {
    "id": string (uuid)
    "type"?: string // 任意
    "content"?: string // 任意
    "contentPayload"?: object // 任意
    "feedback": 
    {
      "id": string (uuid)
      "type": 
      {
      }
      "suggestion"?: string // 任意
      "updatedAt": string (timestamp)
    }
    "createdAt": string (timestamp)
    "queryMetadata"?: object // 任意
  }
  }
  "lastMessageCreatedAt": string (timestamp)
  "unreadMessagesCount": integer
  "autoReplyEnabled": boolean
  "isAutoReplyNow": boolean
  "lastReadAt": string (timestamp)
  "createdAt": string (timestamp)
  "isGroupChat": boolean
  "enableGroupMention"?: boolean // 任意
  "queryMetadata"?: object // 任意
  "toolMask"?: object // 各ツールの有効/無効の状態を記録します {tool_id: bool} (任意)
  "connectorMask"?: object // 各コネクタの有効/無効の状態を記録します {connector_id: bool} (任意)
  "thinkingConfig"?: object // None=未設定 (chatbot の設定を使用)、{}=明示的に無効、{...}=カスタムで上書き (任意)
  "thinkingConfigSchema": object
  "effectiveThinkingConfig": object // Return the effective thinking config after applying the priority chain:
conversation override > chatbot config > LLM metadata.

This allows the frontend to display the actual thinking config in use,
even when the conversation has no explicit override.
  "llm": string (uuid)
  "deepResearchStatus":  // Status of deep research for this conversation

* `not_used` - Not Used
* `started` - Started
* `running` - Running
* `completed` - Completed
* `failed` - Failed
  {
  }
  "ipAddress": string
  "ipCountryCode": string
  "ipRecordedAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "contact": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "avatar": "https://example.com/file.jpg",
    "sourceId": "レスポンス文字列"
  },
  "inbox": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "channelType": "line",
    "unreadConversationsCount": 456,
    "signAuth": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "signSource": "550e8400-e29b-41d4-a716-446655440000",
      "signParams": {
        "keycloak": {
          "clientId": "レスポンス文字列",
          "url": "レスポンス文字列",
          "realm": "レスポンス文字列"
        },
        "line": {
          "liffId": "レスポンス文字列"
        },
        "ad": {
          "saml": "レスポンス文字列"
        }
      }
    }
  },
  "title": "レスポンス文字列",
  "lastMessage": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "レスポンス文字列",
    "content": "レスポンス文字列",
    "contentPayload": null,
    "feedback": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": {},
      "suggestion": "レスポンス文字列",
      "updatedAt": "レスポンス文字列"
    },
    "createdAt": "レスポンス文字列",
    "queryMetadata": null
  },
  "lastMessageCreatedAt": "レスポンス文字列",
  "unreadMessagesCount": 456,
  "autoReplyEnabled": false,
  "isAutoReplyNow": false,
  "lastReadAt": "レスポンス文字列",
  "createdAt": "レスポンス文字列",
  "isGroupChat": false,
  "enableGroupMention": false,
  "queryMetadata": null,
  "toolMask": null,
  "connectorMask": null,
  "thinkingConfig": null,
  "thinkingConfigSchema": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "effectiveThinkingConfig": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "llm": "550e8400-e29b-41d4-a716-446655440000",
  "deepResearchStatus": {},
  "ipAddress": "レスポンス文字列",
  "ipCountryCode": "レスポンス文字列",
  "ipRecordedAt": "レスポンス文字列"
}
```

***

### 新しい会話を作成 <a href="#undefined" id="undefined"></a>

POST `/api/v1/conversations/`

#### リクエスト内容

**リクエストパラメータ**

| フィールド   | 型             | 必須 | 説明 |
| ------- | ------------- | -- | -- |
| webChat | string (uuid) | 必須 |    |
| contact | string (uuid) | 任意 |    |

**リクエスト構造の例**

```typescript
{
  "webChat": string (uuid)
  "contact"?: string (uuid) // 任意
}
```

**リクエストのサンプル値**

```json
{
  "webChat": "550e8400-e29b-41d4-a716-446655440000",
  "contact": "550e8400-e29b-41d4-a716-446655440000"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/conversations/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "webChat": "550e8400-e29b-41d4-a716-446655440000",
    "contact": "550e8400-e29b-41d4-a716-446655440000"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "webChat": "550e8400-e29b-41d4-a716-446655440000",
    "contact": "550e8400-e29b-41d4-a716-446655440000"
  };

axios.post("https://api.maiagent.ai/api/v1/conversations/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/conversations/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "webChat": "550e8400-e29b-41d4-a716-446655440000",
      "contact": "550e8400-e29b-41d4-a716-446655440000"
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/conversations/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "webChat": "550e8400-e29b-41d4-a716-446655440000",
            "contact": "550e8400-e29b-41d4-a716-446655440000"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 201**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "contact": { // 軽量版の Contact Serializer。Conversation List view で使用します

List view に必要なフィールドのみを含み、inboxes と mcp_credentials を除外します
N+1 クエリ問題を回避するため
  {
    "id": string (uuid)
    "name": string
    "avatar"?: string (uri) // 任意
    "sourceId"?: string // 任意
  }
  }
  "inbox": {
  {
    "id": string (uuid)
    "name": string
    "channelType": string (enum: line, telegram, teams, web, messenger, instagram, email, whatsapp) // * `line` - LINE
* `telegram` - Telegram
* `teams` - Teams
* `web` - Web
* `messenger` - Messenger
* `instagram` - Instagram
* `email` - Email
* `whatsapp` - WhatsApp
    "unreadConversationsCount"?: integer // 任意
    "signAuth"?:  // 任意
    {
      "id": string (uuid)
      "signSource": string (uuid)
      "signParams": {
      {
        "keycloak": 
        {
          "clientId": string
          "url": string
          "realm": string
        }
        "line": 
        {
          "liffId": string
        }
        "ad": 
        {
          "saml": string
        }
      }
      }
    }
  }
  }
  "title": string
  "lastMessage"?: { // 任意
  {
    "id": string (uuid)
    "type"?: string // 任意
    "content"?: string // 任意
    "contentPayload"?: object // 任意
    "feedback": 
    {
      "id": string (uuid)
      "type": 
      {
      }
      "suggestion"?: string // 任意
      "updatedAt": string (timestamp)
    }
    "createdAt": string (timestamp)
    "queryMetadata"?: object // 任意
  }
  }
  "lastMessageCreatedAt": string (timestamp)
  "unreadMessagesCount": integer
  "autoReplyEnabled": boolean
  "isAutoReplyNow": boolean
  "lastReadAt": string (timestamp)
  "createdAt": string (timestamp)
  "isGroupChat": boolean
  "enableGroupMention"?: boolean // 任意
  "queryMetadata"?: object // 任意
  "toolMask"?: object // 各ツールの有効/無効の状態を記録します {tool_id: bool} (任意)
  "connectorMask"?: object // 各コネクタの有効/無効の状態を記録します {connector_id: bool} (任意)
  "thinkingConfig"?: object // None=未設定 (chatbot の設定を使用)、{}=明示的に無効、{...}=カスタムで上書き (任意)
  "thinkingConfigSchema": object
  "effectiveThinkingConfig": object // Return the effective thinking config after applying the priority chain:
conversation override > chatbot config > LLM metadata.

This allows the frontend to display the actual thinking config in use,
even when the conversation has no explicit override.
  "llm": string (uuid)
  "deepResearchStatus":  // Status of deep research for this conversation

* `not_used` - Not Used
* `started` - Started
* `running` - Running
* `completed` - Completed
* `failed` - Failed
  {
  }
  "ipAddress": string
  "ipCountryCode": string
  "ipRecordedAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "contact": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "avatar": "https://example.com/file.jpg",
    "sourceId": "レスポンス文字列"
  },
  "inbox": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "channelType": "line",
    "unreadConversationsCount": 456,
    "signAuth": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "signSource": "550e8400-e29b-41d4-a716-446655440000",
      "signParams": {
        "keycloak": {
          "clientId": "レスポンス文字列",
          "url": "レスポンス文字列",
          "realm": "レスポンス文字列"
        },
        "line": {
          "liffId": "レスポンス文字列"
        },
        "ad": {
          "saml": "レスポンス文字列"
        }
      }
    }
  },
  "title": "レスポンス文字列",
  "lastMessage": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "レスポンス文字列",
    "content": "レスポンス文字列",
    "contentPayload": null,
    "feedback": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": {},
      "suggestion": "レスポンス文字列",
      "updatedAt": "レスポンス文字列"
    },
    "createdAt": "レスポンス文字列",
    "queryMetadata": null
  },
  "lastMessageCreatedAt": "レスポンス文字列",
  "unreadMessagesCount": 456,
  "autoReplyEnabled": false,
  "isAutoReplyNow": false,
  "lastReadAt": "レスポンス文字列",
  "createdAt": "レスポンス文字列",
  "isGroupChat": false,
  "enableGroupMention": false,
  "queryMetadata": null,
  "toolMask": null,
  "connectorMask": null,
  "thinkingConfig": null,
  "thinkingConfigSchema": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "effectiveThinkingConfig": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "llm": "550e8400-e29b-41d4-a716-446655440000",
  "deepResearchStatus": {},
  "ipAddress": "レスポンス文字列",
  "ipCountryCode": "レスポンス文字列",
  "ipRecordedAt": "レスポンス文字列"
}
```

***

### メッセージ一覧を取得 <a href="#undefined" id="undefined"></a>

GET `/api/messages/`

#### パラメータ

| パラメータ名         | 必須 | 型       | 説明                                    |
| -------------- | -- | ------- | ------------------------------------- |
| `conversation` | ✅  | string  | 会話 ID                                 |
| `cursor`       | ❌  | string  | The pagination cursor value.          |
| `pageSize`     | ❌  | integer | Number of results to return per page. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/messages/?conversation=example&cursor=example&pageSize=1" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/messages/?conversation=example&cursor=example&pageSize=1", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/messages/?conversation=example&cursor=example&pageSize=1"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/messages/?conversation=example&cursor=example&pageSize=1", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "count": integer
  "next"?: string (uri) // 任意
  "previous"?: string (uri) // 任意
  "results": [
    {
      "id": string (uuid)
      "conversation": string (uuid)
      "sender": 
      {
        "id": string (uuid)
        "name": string
        "avatar": string
        "email"?: string (email) // 任意
        "phoneNumber"?: string // 任意
      }
      "type"?: string // 任意
      "content"?: string // 任意
      "contentPayload"?: object // 任意
      "feedback": 
      {
        "id": string (uuid)
        "type": 
        {
        }
        "suggestion"?: string // 任意
        "updatedAt": string (timestamp)
      }
      "createdAt": string (timestamp)
      "attachments"?: [ // 任意
        {
          "id": string (uuid)
          "type"?:  // 任意
          {
          }
          "filename": string
          "file": string (uri)
          "conversation"?: string (uuid) // 任意
        }
      ]
      "citations": [
        {
          "id": string (uuid)
          "filename": string // ファイル名
          "file": string (uri) // アップロードするファイル
          "fileType": string
          "knowledgeBase"?:  // 任意
          {
            "id": string (uuid)
            "name": string
          }
          "size": integer
          "status": 
          {
          }
          "parser": {
          {
            "id": string (uuid)
            "name": string
            "provider": 
            {
            }
            "order"?: integer // 任意
          }
          }
          "labels"?: [ // 任意
            {
              "id": string (uuid)
              "name": string
            }
          ]
          "rawUserDefineMetadata"?: object // 任意
          "vectorStorageSize": integer // Size of vectors for this file in Elasticsearch (bytes)
          "chunksCount": integer // Number of chunks/nodes generated from this file
          "waitingTime": number (double)
          "processingTime": number (double)
          "processingTimeDetails": object
          "createdAt": string (timestamp)
        }
      ]
      "citationNodes": [
        {
          "chatbotTextNode": {
          {
            "id": string (uuid)
            "charactersCount": integer
            "hitsCount": integer
            "text": string
            "updatedAt": string (timestamp)
            "filename": string
            "chatbotFile": object // ChatbotFile の完全な情報を返します。フロントエンドでの画像プレビューに対応するため、ファイルの URL と種類を含みます
            "knowledgeBaseFile": object // get_chatbot_file と同じです。後方互換性のために提供しています
            "pageNumber": integer
            "citationTitle": string // inline citation hover card で表示する出典のタイトル
            "citationDescription": string // inline citation hover card で表示する出典の説明
            "citationQuote": string // inline citation hover card で表示する引用テキストの断片
            "hasImage": boolean // 画像を含むかどうかを判定します (ファイルの種類または text 内の Markdown 画像をチェック)
            "imageUrl": string // 画像 URL を抽出します (ファイル URL を優先し、なければ Markdown から抽出)
            "displayText": string // 画像の Markdown 記法を除去した完全なテキストを返します
            "displayTitle": string // 表示タイトルを返します (fallback: citation_title -> filename)
            "highlightedText": string // Return text with matched terms wrapped in ``<mark>`` tags.

Priority:
1. ES/OpenSearch native highlight (set by retrieve_api via ``_es_highlighted_text``)
2. Python regex fallback (keyword-based, works for all backends)
          }
          }
          "score"?: number (double) // 任意
          "displayScore": integer
          "citationNumber"?: integer // Citation 番号。レスポンス内容の [1]、[2] などの記号に対応します (任意)
          "highlightedText"?: string // ES/OpenSearch highlight result with <mark> tags (任意)
        }
      ]
      "canvas"?: { // 任意
      {
        "id": string (uuid)
        "name": string
        "canvasType": 
        {
        }
        "title": string
        "content": string
        "createdAt": string (timestamp)
      }
      }
      "queryMetadata"?: object // 任意
      "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
      "recordId": string // Message に対応する ChatbotRecord ID を返します

Note:
    保存されていない Message (streaming 中の仮想 Message など) の場合は、そのまま None を返し、
    OneToOneField の reverse relation による DB クエリ (N+1 問題) を回避します。
      "broadcast"?: boolean // 任意
    }
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "conversation": "550e8400-e29b-41d4-a716-446655440000",
      "sender": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "avatar": "レスポンス文字列",
        "email": "response@example.com",
        "phoneNumber": "レスポンス文字列"
      },
      "type": "レスポンス文字列",
      "content": "レスポンス文字列",
      "contentPayload": null,
      "feedback": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "type": {},
        "suggestion": "レスポンス文字列",
        "updatedAt": "レスポンス文字列"
      },
      "createdAt": "レスポンス文字列",
      "attachments": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "type": {},
          "filename": "レスポンス文字列",
          "file": "https://example.com/file.jpg",
          "conversation": "550e8400-e29b-41d4-a716-446655440000"
        }
      ],
      "citations": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "filename": "レスポンス文字列",
          "file": "https://example.com/file.jpg",
          "fileType": "レスポンス文字列",
          "knowledgeBase": {
            "id": "550e8400-e29b-41d4-a716-446655440000",
            "name": "レスポンス文字列"
          },
          "size": 456,
          "status": {},
          "parser": {
            "id": "550e8400-e29b-41d4-a716-446655440000",
            "name": "レスポンス文字列",
            "provider": {},
            "order": 456
          },
          "labels": [
            {
              "id": "550e8400-e29b-41d4-a716-446655440000",
              "name": "レスポンス文字列"
            }
          ],
          "rawUserDefineMetadata": null,
          "vectorStorageSize": 456,
          "chunksCount": 456,
          "waitingTime": 456,
          "processingTime": 456,
          "processingTimeDetails": null,
          "createdAt": "レスポンス文字列"
        }
      ],
      "citationNodes": [
        {
          "chatbotTextNode": {
            "id": "550e8400-e29b-41d4-a716-446655440000",
            "charactersCount": 456,
            "hitsCount": 456,
            "text": "レスポンス文字列",
            "updatedAt": "レスポンス文字列",
            "filename": "レスポンス文字列",
            "chatbotFile": {
              "id": "550e8400-e29b-41d4-a716-446655440000",
              "name": "レスポンスのサンプル名",
              "description": "レスポンスのサンプル説明"
            },
            "knowledgeBaseFile": {
              "id": "550e8400-e29b-41d4-a716-446655440000",
              "name": "レスポンスのサンプル名",
              "description": "レスポンスのサンプル説明"
            },
            "pageNumber": 456,
            "citationTitle": "レスポンス文字列",
            "citationDescription": "レスポンス文字列",
            "citationQuote": "レスポンス文字列",
            "hasImage": false,
            "imageUrl": "レスポンス文字列",
            "displayText": "レスポンス文字列",
            "displayTitle": "レスポンス文字列",
            "highlightedText": "レスポンス文字列"
          },
          "score": 456,
          "displayScore": 456,
          "citationNumber": 456,
          "highlightedText": "レスポンス文字列"
        }
      ],
      "canvas": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "canvasType": {},
        "title": "レスポンス文字列",
        "content": "レスポンス文字列",
        "createdAt": "レスポンス文字列"
      },
      "queryMetadata": null,
      "metadata": null,
      "recordId": "レスポンス文字列",
      "broadcast": false
    }
  ]
}
```

***

### メッセージ一覧を取得 <a href="#undefined" id="undefined"></a>

GET `/api/v1/messages/`

#### パラメータ

| パラメータ名         | 必須 | 型       | 説明                                    |
| -------------- | -- | ------- | ------------------------------------- |
| `conversation` | ✅  | string  | 会話 ID                                 |
| `cursor`       | ❌  | string  | The pagination cursor value.          |
| `pageSize`     | ❌  | integer | Number of results to return per page. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/messages/?conversation=example&cursor=example&pageSize=1" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/messages/?conversation=example&cursor=example&pageSize=1", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/messages/?conversation=example&cursor=example&pageSize=1"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/messages/?conversation=example&cursor=example&pageSize=1", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "count": integer
  "next"?: string (uri) // 任意
  "previous"?: string (uri) // 任意
  "results": [
    {
      "id": string (uuid)
      "conversation": string (uuid)
      "sender": 
      {
        "id": string (uuid)
        "name": string
        "avatar": string
        "email"?: string (email) // 任意
        "phoneNumber"?: string // 任意
      }
      "type"?: string // 任意
      "content"?: string // 任意
      "contentPayload"?: object // 任意
      "feedback": 
      {
        "id": string (uuid)
        "type": 
        {
        }
        "suggestion"?: string // 任意
        "updatedAt": string (timestamp)
      }
      "createdAt": string (timestamp)
      "attachments"?: [ // 任意
        {
          "id": string (uuid)
          "type"?:  // 任意
          {
          }
          "filename": string
          "file": string (uri)
          "conversation"?: string (uuid) // 任意
        }
      ]
      "citations": [
        {
          "id": string (uuid)
          "filename": string // ファイル名
          "file": string (uri) // アップロードするファイル
          "fileType": string
          "knowledgeBase"?:  // 任意
          {
            "id": string (uuid)
            "name": string
          }
          "size": integer
          "status": 
          {
          }
          "parser": {
          {
            "id": string (uuid)
            "name": string
            "provider": 
            {
            }
            "order"?: integer // 任意
          }
          }
          "labels"?: [ // 任意
            {
              "id": string (uuid)
              "name": string
            }
          ]
          "rawUserDefineMetadata"?: object // 任意
          "vectorStorageSize": integer // Size of vectors for this file in Elasticsearch (bytes)
          "chunksCount": integer // Number of chunks/nodes generated from this file
          "waitingTime": number (double)
          "processingTime": number (double)
          "processingTimeDetails": object
          "createdAt": string (timestamp)
        }
      ]
      "citationNodes": [
        {
          "chatbotTextNode": {
          {
            "id": string (uuid)
            "charactersCount": integer
            "hitsCount": integer
            "text": string
            "updatedAt": string (timestamp)
            "filename": string
            "chatbotFile": object // ChatbotFile の完全な情報を返します。フロントエンドでの画像プレビューに対応するため、ファイルの URL と種類を含みます
            "knowledgeBaseFile": object // get_chatbot_file と同じです。後方互換性のために提供しています
            "pageNumber": integer
            "citationTitle": string // inline citation hover card で表示する出典のタイトル
            "citationDescription": string // inline citation hover card で表示する出典の説明
            "citationQuote": string // inline citation hover card で表示する引用テキストの断片
            "hasImage": boolean // 画像を含むかどうかを判定します (ファイルの種類または text 内の Markdown 画像をチェック)
            "imageUrl": string // 画像 URL を抽出します (ファイル URL を優先し、なければ Markdown から抽出)
            "displayText": string // 画像の Markdown 記法を除去した完全なテキストを返します
            "displayTitle": string // 表示タイトルを返します (fallback: citation_title -> filename)
            "highlightedText": string // Return text with matched terms wrapped in ``<mark>`` tags.

Priority:
1. ES/OpenSearch native highlight (set by retrieve_api via ``_es_highlighted_text``)
2. Python regex fallback (keyword-based, works for all backends)
          }
          }
          "score"?: number (double) // 任意
          "displayScore": integer
          "citationNumber"?: integer // Citation 番号。レスポンス内容の [1]、[2] などの記号に対応します (任意)
          "highlightedText"?: string // ES/OpenSearch highlight result with <mark> tags (任意)
        }
      ]
      "canvas"?: { // 任意
      {
        "id": string (uuid)
        "name": string
        "canvasType": 
        {
        }
        "title": string
        "content": string
        "createdAt": string (timestamp)
      }
      }
      "queryMetadata"?: object // 任意
      "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
      "recordId": string // Message に対応する ChatbotRecord ID を返します

Note:
    保存されていない Message (streaming 中の仮想 Message など) の場合は、そのまま None を返し、
    OneToOneField の reverse relation による DB クエリ (N+1 問題) を回避します。
      "broadcast"?: boolean // 任意
    }
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "conversation": "550e8400-e29b-41d4-a716-446655440000",
      "sender": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "avatar": "レスポンス文字列",
        "email": "response@example.com",
        "phoneNumber": "レスポンス文字列"
      },
      "type": "レスポンス文字列",
      "content": "レスポンス文字列",
      "contentPayload": null,
      "feedback": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "type": {},
        "suggestion": "レスポンス文字列",
        "updatedAt": "レスポンス文字列"
      },
      "createdAt": "レスポンス文字列",
      "attachments": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "type": {},
          "filename": "レスポンス文字列",
          "file": "https://example.com/file.jpg",
          "conversation": "550e8400-e29b-41d4-a716-446655440000"
        }
      ],
      "citations": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "filename": "レスポンス文字列",
          "file": "https://example.com/file.jpg",
          "fileType": "レスポンス文字列",
          "knowledgeBase": {
            "id": "550e8400-e29b-41d4-a716-446655440000",
            "name": "レスポンス文字列"
          },
          "size": 456,
          "status": {},
          "parser": {
            "id": "550e8400-e29b-41d4-a716-446655440000",
            "name": "レスポンス文字列",
            "provider": {},
            "order": 456
          },
          "labels": [
            {
              "id": "550e8400-e29b-41d4-a716-446655440000",
              "name": "レスポンス文字列"
            }
          ],
          "rawUserDefineMetadata": null,
          "vectorStorageSize": 456,
          "chunksCount": 456,
          "waitingTime": 456,
          "processingTime": 456,
          "processingTimeDetails": null,
          "createdAt": "レスポンス文字列"
        }
      ],
      "citationNodes": [
        {
          "chatbotTextNode": {
            "id": "550e8400-e29b-41d4-a716-446655440000",
            "charactersCount": 456,
            "hitsCount": 456,
            "text": "レスポンス文字列",
            "updatedAt": "レスポンス文字列",
            "filename": "レスポンス文字列",
            "chatbotFile": {
              "id": "550e8400-e29b-41d4-a716-446655440000",
              "name": "レスポンスのサンプル名",
              "description": "レスポンスのサンプル説明"
            },
            "knowledgeBaseFile": {
              "id": "550e8400-e29b-41d4-a716-446655440000",
              "name": "レスポンスのサンプル名",
              "description": "レスポンスのサンプル説明"
            },
            "pageNumber": 456,
            "citationTitle": "レスポンス文字列",
            "citationDescription": "レスポンス文字列",
            "citationQuote": "レスポンス文字列",
            "hasImage": false,
            "imageUrl": "レスポンス文字列",
            "displayText": "レスポンス文字列",
            "displayTitle": "レスポンス文字列",
            "highlightedText": "レスポンス文字列"
          },
          "score": 456,
          "displayScore": 456,
          "citationNumber": 456,
          "highlightedText": "レスポンス文字列"
        }
      ],
      "canvas": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "canvasType": {},
        "title": "レスポンス文字列",
        "content": "レスポンス文字列",
        "createdAt": "レスポンス文字列"
      },
      "queryMetadata": null,
      "metadata": null,
      "recordId": "レスポンス文字列",
      "broadcast": false
    }
  ]
}
```

***

### 特定のメッセージを取得 <a href="#undefined" id="undefined"></a>

GET `/api/messages/{id}/`

#### パラメータ

| パラメータ名         | 必須 | 型      | 説明                                    |
| -------------- | -- | ------ | ------------------------------------- |
| `id`           | ✅  | string | A UUID string identifying this メッセージ. |
| `conversation` | ✅  | string | 会話 ID                                 |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/messages/550e8400-e29b-41d4-a716-446655440000/?conversation=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/messages/550e8400-e29b-41d4-a716-446655440000/?conversation=example", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/messages/550e8400-e29b-41d4-a716-446655440000/?conversation=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/messages/550e8400-e29b-41d4-a716-446655440000/?conversation=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "conversation": string (uuid)
  "sender": 
  {
    "id": string (uuid)
    "name": string
    "avatar": string
    "email"?: string (email) // 任意
    "phoneNumber"?: string // 任意
  }
  "type"?: string // 任意
  "content"?: string // 任意
  "contentPayload"?: object // 任意
  "feedback": 
  {
    "id": string (uuid)
    "type": 
    {
    }
    "suggestion"?: string // 任意
    "updatedAt": string (timestamp)
  }
  "createdAt": string (timestamp)
  "attachments"?: [ // 任意
    {
      "id": string (uuid)
      "type"?:  // 任意
      {
      }
      "filename": string
      "file": string (uri)
      "conversation"?: string (uuid) // 任意
    }
  ]
  "citations": [
    {
      "id": string (uuid)
      "filename": string // ファイル名
      "file": string (uri) // アップロードするファイル
      "fileType": string
      "knowledgeBase"?:  // 任意
      {
        "id": string (uuid)
        "name": string
      }
      "size": integer
      "status": 
      {
      }
      "parser": {
      {
        "id": string (uuid)
        "name": string
        "provider": 
        {
        }
        "order"?: integer // 任意
      }
      }
      "labels"?: [ // 任意
        {
          "id": string (uuid)
          "name": string
        }
      ]
      "rawUserDefineMetadata"?: object // 任意
      "vectorStorageSize": integer // Size of vectors for this file in Elasticsearch (bytes)
      "chunksCount": integer // Number of chunks/nodes generated from this file
      "waitingTime": number (double)
      "processingTime": number (double)
      "processingTimeDetails": object
      "createdAt": string (timestamp)
    }
  ]
  "citationNodes": [
    {
      "chatbotTextNode": {
      {
        "id": string (uuid)
        "charactersCount": integer
        "hitsCount": integer
        "text": string
        "updatedAt": string (timestamp)
        "filename": string
        "chatbotFile": object // ChatbotFile の完全な情報を返します。フロントエンドでの画像プレビューに対応するため、ファイルの URL と種類を含みます
        "knowledgeBaseFile": object // get_chatbot_file と同じです。後方互換性のために提供しています
        "pageNumber": integer
        "citationTitle": string // inline citation hover card で表示する出典のタイトル
        "citationDescription": string // inline citation hover card で表示する出典の説明
        "citationQuote": string // inline citation hover card で表示する引用テキストの断片
        "hasImage": boolean // 画像を含むかどうかを判定します (ファイルの種類または text 内の Markdown 画像をチェック)
        "imageUrl": string // 画像 URL を抽出します (ファイル URL を優先し、なければ Markdown から抽出)
        "displayText": string // 画像の Markdown 記法を除去した完全なテキストを返します
        "displayTitle": string // 表示タイトルを返します (fallback: citation_title -> filename)
        "highlightedText": string // Return text with matched terms wrapped in ``<mark>`` tags.

Priority:
1. ES/OpenSearch native highlight (set by retrieve_api via ``_es_highlighted_text``)
2. Python regex fallback (keyword-based, works for all backends)
      }
      }
      "score"?: number (double) // 任意
      "displayScore": integer
      "citationNumber"?: integer // Citation 番号。レスポンス内容の [1]、[2] などの記号に対応します (任意)
      "highlightedText"?: string // ES/OpenSearch highlight result with <mark> tags (任意)
    }
  ]
  "canvas"?: { // 任意
  {
    "id": string (uuid)
    "name": string
    "canvasType": 
    {
    }
    "title": string
    "content": string
    "createdAt": string (timestamp)
  }
  }
  "queryMetadata"?: object // 任意
  "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
  "recordId": string // Message に対応する ChatbotRecord ID を返します

Note:
    保存されていない Message (streaming 中の仮想 Message など) の場合は、そのまま None を返し、
    OneToOneField の reverse relation による DB クエリ (N+1 問題) を回避します。
  "broadcast"?: boolean // 任意
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "conversation": "550e8400-e29b-41d4-a716-446655440000",
  "sender": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "avatar": "レスポンス文字列",
    "email": "response@example.com",
    "phoneNumber": "レスポンス文字列"
  },
  "type": "レスポンス文字列",
  "content": "レスポンス文字列",
  "contentPayload": null,
  "feedback": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": {},
    "suggestion": "レスポンス文字列",
    "updatedAt": "レスポンス文字列"
  },
  "createdAt": "レスポンス文字列",
  "attachments": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": {},
      "filename": "レスポンス文字列",
      "file": "https://example.com/file.jpg",
      "conversation": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "citations": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "filename": "レスポンス文字列",
      "file": "https://example.com/file.jpg",
      "fileType": "レスポンス文字列",
      "knowledgeBase": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列"
      },
      "size": 456,
      "status": {},
      "parser": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "provider": {},
        "order": 456
      },
      "labels": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンス文字列"
        }
      ],
      "rawUserDefineMetadata": null,
      "vectorStorageSize": 456,
      "chunksCount": 456,
      "waitingTime": 456,
      "processingTime": 456,
      "processingTimeDetails": null,
      "createdAt": "レスポンス文字列"
    }
  ],
  "citationNodes": [
    {
      "chatbotTextNode": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "charactersCount": 456,
        "hitsCount": 456,
        "text": "レスポンス文字列",
        "updatedAt": "レスポンス文字列",
        "filename": "レスポンス文字列",
        "chatbotFile": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンスのサンプル名",
          "description": "レスポンスのサンプル説明"
        },
        "knowledgeBaseFile": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンスのサンプル名",
          "description": "レスポンスのサンプル説明"
        },
        "pageNumber": 456,
        "citationTitle": "レスポンス文字列",
        "citationDescription": "レスポンス文字列",
        "citationQuote": "レスポンス文字列",
        "hasImage": false,
        "imageUrl": "レスポンス文字列",
        "displayText": "レスポンス文字列",
        "displayTitle": "レスポンス文字列",
        "highlightedText": "レスポンス文字列"
      },
      "score": 456,
      "displayScore": 456,
      "citationNumber": 456,
      "highlightedText": "レスポンス文字列"
    }
  ],
  "canvas": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "canvasType": {},
    "title": "レスポンス文字列",
    "content": "レスポンス文字列",
    "createdAt": "レスポンス文字列"
  },
  "queryMetadata": null,
  "metadata": null,
  "recordId": "レスポンス文字列",
  "broadcast": false
}
```

***

### 特定のメッセージを取得 <a href="#undefined" id="undefined"></a>

GET `/api/v1/messages/{id}/`

#### パラメータ

| パラメータ名         | 必須 | 型      | 説明                                    |
| -------------- | -- | ------ | ------------------------------------- |
| `id`           | ✅  | string | A UUID string identifying this メッセージ. |
| `conversation` | ✅  | string | 会話 ID                                 |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/messages/550e8400-e29b-41d4-a716-446655440000/?conversation=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/messages/550e8400-e29b-41d4-a716-446655440000/?conversation=example", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/messages/550e8400-e29b-41d4-a716-446655440000/?conversation=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/messages/550e8400-e29b-41d4-a716-446655440000/?conversation=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "conversation": string (uuid)
  "sender": 
  {
    "id": string (uuid)
    "name": string
    "avatar": string
    "email"?: string (email) // 任意
    "phoneNumber"?: string // 任意
  }
  "type"?: string // 任意
  "content"?: string // 任意
  "contentPayload"?: object // 任意
  "feedback": 
  {
    "id": string (uuid)
    "type": 
    {
    }
    "suggestion"?: string // 任意
    "updatedAt": string (timestamp)
  }
  "createdAt": string (timestamp)
  "attachments"?: [ // 任意
    {
      "id": string (uuid)
      "type"?:  // 任意
      {
      }
      "filename": string
      "file": string (uri)
      "conversation"?: string (uuid) // 任意
    }
  ]
  "citations": [
    {
      "id": string (uuid)
      "filename": string // ファイル名
      "file": string (uri) // アップロードするファイル
      "fileType": string
      "knowledgeBase"?:  // 任意
      {
        "id": string (uuid)
        "name": string
      }
      "size": integer
      "status": 
      {
      }
      "parser": {
      {
        "id": string (uuid)
        "name": string
        "provider": 
        {
        }
        "order"?: integer // 任意
      }
      }
      "labels"?: [ // 任意
        {
          "id": string (uuid)
          "name": string
        }
      ]
      "rawUserDefineMetadata"?: object // 任意
      "vectorStorageSize": integer // Size of vectors for this file in Elasticsearch (bytes)
      "chunksCount": integer // Number of chunks/nodes generated from this file
      "waitingTime": number (double)
      "processingTime": number (double)
      "processingTimeDetails": object
      "createdAt": string (timestamp)
    }
  ]
  "citationNodes": [
    {
      "chatbotTextNode": {
      {
        "id": string (uuid)
        "charactersCount": integer
        "hitsCount": integer
        "text": string
        "updatedAt": string (timestamp)
        "filename": string
        "chatbotFile": object // ChatbotFile の完全な情報を返します。フロントエンドでの画像プレビューに対応するため、ファイルの URL と種類を含みます
        "knowledgeBaseFile": object // get_chatbot_file と同じです。後方互換性のために提供しています
        "pageNumber": integer
        "citationTitle": string // inline citation hover card で表示する出典のタイトル
        "citationDescription": string // inline citation hover card で表示する出典の説明
        "citationQuote": string // inline citation hover card で表示する引用テキストの断片
        "hasImage": boolean // 画像を含むかどうかを判定します (ファイルの種類または text 内の Markdown 画像をチェック)
        "imageUrl": string // 画像 URL を抽出します (ファイル URL を優先し、なければ Markdown から抽出)
        "displayText": string // 画像の Markdown 記法を除去した完全なテキストを返します
        "displayTitle": string // 表示タイトルを返します (fallback: citation_title -> filename)
        "highlightedText": string // Return text with matched terms wrapped in ``<mark>`` tags.

Priority:
1. ES/OpenSearch native highlight (set by retrieve_api via ``_es_highlighted_text``)
2. Python regex fallback (keyword-based, works for all backends)
      }
      }
      "score"?: number (double) // 任意
      "displayScore": integer
      "citationNumber"?: integer // Citation 番号。レスポンス内容の [1]、[2] などの記号に対応します (任意)
      "highlightedText"?: string // ES/OpenSearch highlight result with <mark> tags (任意)
    }
  ]
  "canvas"?: { // 任意
  {
    "id": string (uuid)
    "name": string
    "canvasType": 
    {
    }
    "title": string
    "content": string
    "createdAt": string (timestamp)
  }
  }
  "queryMetadata"?: object // 任意
  "metadata"?: object // メッセージのメタデータ (タイムゾーンなどの環境情報) (任意)
  "recordId": string // Message に対応する ChatbotRecord ID を返します

Note:
    保存されていない Message (streaming 中の仮想 Message など) の場合は、そのまま None を返し、
    OneToOneField の reverse relation による DB クエリ (N+1 問題) を回避します。
  "broadcast"?: boolean // 任意
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "conversation": "550e8400-e29b-41d4-a716-446655440000",
  "sender": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "avatar": "レスポンス文字列",
    "email": "response@example.com",
    "phoneNumber": "レスポンス文字列"
  },
  "type": "レスポンス文字列",
  "content": "レスポンス文字列",
  "contentPayload": null,
  "feedback": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": {},
    "suggestion": "レスポンス文字列",
    "updatedAt": "レスポンス文字列"
  },
  "createdAt": "レスポンス文字列",
  "attachments": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": {},
      "filename": "レスポンス文字列",
      "file": "https://example.com/file.jpg",
      "conversation": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "citations": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "filename": "レスポンス文字列",
      "file": "https://example.com/file.jpg",
      "fileType": "レスポンス文字列",
      "knowledgeBase": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列"
      },
      "size": 456,
      "status": {},
      "parser": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "provider": {},
        "order": 456
      },
      "labels": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンス文字列"
        }
      ],
      "rawUserDefineMetadata": null,
      "vectorStorageSize": 456,
      "chunksCount": 456,
      "waitingTime": 456,
      "processingTime": 456,
      "processingTimeDetails": null,
      "createdAt": "レスポンス文字列"
    }
  ],
  "citationNodes": [
    {
      "chatbotTextNode": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "charactersCount": 456,
        "hitsCount": 456,
        "text": "レスポンス文字列",
        "updatedAt": "レスポンス文字列",
        "filename": "レスポンス文字列",
        "chatbotFile": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンスのサンプル名",
          "description": "レスポンスのサンプル説明"
        },
        "knowledgeBaseFile": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンスのサンプル名",
          "description": "レスポンスのサンプル説明"
        },
        "pageNumber": 456,
        "citationTitle": "レスポンス文字列",
        "citationDescription": "レスポンス文字列",
        "citationQuote": "レスポンス文字列",
        "hasImage": false,
        "imageUrl": "レスポンス文字列",
        "displayText": "レスポンス文字列",
        "displayTitle": "レスポンス文字列",
        "highlightedText": "レスポンス文字列"
      },
      "score": 456,
      "displayScore": 456,
      "citationNumber": 456,
      "highlightedText": "レスポンス文字列"
    }
  ],
  "canvas": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "canvasType": {},
    "title": "レスポンス文字列",
    "content": "レスポンス文字列",
    "createdAt": "レスポンス文字列"
  },
  "queryMetadata": null,
  "metadata": null,
  "recordId": "レスポンス文字列",
  "broadcast": false
}
```

***

### 会話一覧を取得 <a href="#undefined" id="undefined"></a>

GET `/api/conversations/`

#### パラメータ

| パラメータ名                   | 必須 | 型       | 説明                                    |
| ------------------------ | -- | ------- | ------------------------------------- |
| `contact`                | ❌  | string  | 連絡先 ID                                |
| `cursor`                 | ❌  | string  | The pagination cursor value.          |
| `endDate`                | ❌  | string  |                                       |
| `externalConversationId` | ❌  | string  |                                       |
| `externalSource`         | ❌  | string  |                                       |
| `inbox`                  | ❌  | string  | 会話プラットフォーム ID                         |
| `keyword`                | ❌  | string  | キーワード検索                               |
| `pageSize`               | ❌  | integer | Number of results to return per page. |
| `startDate`              | ❌  | string  |                                       |
| `updatedAfter`           | ❌  | string  |                                       |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/conversations/?contact=example&cursor=example&endDate=example&externalConversationId=example&externalSource=example&inbox=example&keyword=example&pageSize=1&startDate=example&updatedAfter=2026-03-21T14:31:44.842Z" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/conversations/?contact=example&cursor=example&endDate=example&externalConversationId=example&externalSource=example&inbox=example&keyword=example&pageSize=1&startDate=example&updatedAfter=2026-03-21T14:31:44.842Z", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/conversations/?contact=example&cursor=example&endDate=example&externalConversationId=example&externalSource=example&inbox=example&keyword=example&pageSize=1&startDate=example&updatedAfter=2026-03-21T14:31:44.842Z"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/conversations/?contact=example&cursor=example&endDate=example&externalConversationId=example&externalSource=example&inbox=example&keyword=example&pageSize=1&startDate=example&updatedAfter=2026-03-21T14:31:44.842Z", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "count": integer
  "next"?: string (uri) // 任意
  "previous"?: string (uri) // 任意
  "results": [
    {
      "id": string (uuid)
      "contact": { // 軽量版の Contact Serializer。Conversation List view で使用します

List view に必要なフィールドのみを含み、inboxes と mcp_credentials を除外します
N+1 クエリ問題を回避するため
      {
        "id": string (uuid)
        "name": string
        "avatar"?: string (uri) // 任意
        "sourceId"?: string // 任意
      }
      }
      "inbox": {
      {
        "id": string (uuid)
        "name": string
        "channelType": string (enum: line, telegram, teams, web, messenger, instagram, email, whatsapp) // * `line` - LINE
* `telegram` - Telegram
* `teams` - Teams
* `web` - Web
* `messenger` - Messenger
* `instagram` - Instagram
* `email` - Email
* `whatsapp` - WhatsApp
        "unreadConversationsCount"?: integer // 任意
        "signAuth"?:  // 任意
        {
          "id": string (uuid)
          "signSource": string (uuid)
          "signParams": {
          {
            "keycloak": 
            {
              "clientId": string
              "url": string
              "realm": string
            }
            "line": 
            {
              "liffId": string
            }
            "ad": 
            {
              "saml": string
            }
          }
          }
        }
      }
      }
      "title": string
      "lastMessage"?: { // 任意
      {
        "id": string (uuid)
        "type"?: string // 任意
        "content"?: string // 任意
        "contentPayload"?: object // 任意
        "feedback": 
        {
          "id": string (uuid)
          "type": 
          {
          }
          "suggestion"?: string // 任意
          "updatedAt": string (timestamp)
        }
        "createdAt": string (timestamp)
        "queryMetadata"?: object // 任意
      }
      }
      "lastMessageCreatedAt": string (timestamp)
      "unreadMessagesCount": integer
      "autoReplyEnabled": boolean
      "isAutoReplyNow": boolean
      "lastReadAt": string (timestamp)
      "createdAt": string (timestamp)
      "isGroupChat": boolean
      "enableGroupMention"?: boolean // 任意
      "queryMetadata"?: object // 任意
      "toolMask"?: object // 各ツールの有効/無効の状態を記録します {tool_id: bool} (任意)
      "connectorMask"?: object // 各コネクタの有効/無効の状態を記録します {connector_id: bool} (任意)
      "thinkingConfig"?: object // None=未設定 (chatbot の設定を使用)、{}=明示的に無効、{...}=カスタムで上書き (任意)
      "thinkingConfigSchema": object
      "effectiveThinkingConfig": object // Return the effective thinking config after applying the priority chain:
conversation override > chatbot config > LLM metadata.

This allows the frontend to display the actual thinking config in use,
even when the conversation has no explicit override.
      "llm": string (uuid)
      "deepResearchStatus":  // Status of deep research for this conversation

* `not_used` - Not Used
* `started` - Started
* `running` - Running
* `completed` - Completed
* `failed` - Failed
      {
      }
      "ipAddress": string
      "ipCountryCode": string
      "ipRecordedAt": string (timestamp)
    }
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "contact": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "avatar": "https://example.com/file.jpg",
        "sourceId": "レスポンス文字列"
      },
      "inbox": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "channelType": "line",
        "unreadConversationsCount": 456,
        "signAuth": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "signSource": "550e8400-e29b-41d4-a716-446655440000",
          "signParams": {
            "keycloak": {
              "clientId": "レスポンス文字列",
              "url": "レスポンス文字列",
              "realm": "レスポンス文字列"
            },
            "line": {
              "liffId": "レスポンス文字列"
            },
            "ad": {
              "saml": "レスポンス文字列"
            }
          }
        }
      },
      "title": "レスポンス文字列",
      "lastMessage": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "type": "レスポンス文字列",
        "content": "レスポンス文字列",
        "contentPayload": null,
        "feedback": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "type": {},
          "suggestion": "レスポンス文字列",
          "updatedAt": "レスポンス文字列"
        },
        "createdAt": "レスポンス文字列",
        "queryMetadata": null
      },
      "lastMessageCreatedAt": "レスポンス文字列",
      "unreadMessagesCount": 456,
      "autoReplyEnabled": false,
      "isAutoReplyNow": false,
      "lastReadAt": "レスポンス文字列",
      "createdAt": "レスポンス文字列",
      "isGroupChat": false,
      "enableGroupMention": false,
      "queryMetadata": null,
      "toolMask": null,
      "connectorMask": null,
      "thinkingConfig": null,
      "thinkingConfigSchema": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンスのサンプル名",
        "description": "レスポンスのサンプル説明"
      },
      "effectiveThinkingConfig": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンスのサンプル名",
        "description": "レスポンスのサンプル説明"
      },
      "llm": "550e8400-e29b-41d4-a716-446655440000",
      "deepResearchStatus": {},
      "ipAddress": "レスポンス文字列",
      "ipCountryCode": "レスポンス文字列",
      "ipRecordedAt": "レスポンス文字列"
    }
  ]
}
```

***

### 会話一覧を取得 <a href="#undefined" id="undefined"></a>

GET `/api/v1/conversations/`

#### パラメータ

| パラメータ名                   | 必須 | 型       | 説明                                    |
| ------------------------ | -- | ------- | ------------------------------------- |
| `contact`                | ❌  | string  | 連絡先 ID                                |
| `cursor`                 | ❌  | string  | The pagination cursor value.          |
| `endDate`                | ❌  | string  |                                       |
| `externalConversationId` | ❌  | string  |                                       |
| `externalSource`         | ❌  | string  |                                       |
| `inbox`                  | ❌  | string  | 会話プラットフォーム ID                         |
| `keyword`                | ❌  | string  | キーワード検索                               |
| `pageSize`               | ❌  | integer | Number of results to return per page. |
| `startDate`              | ❌  | string  |                                       |
| `updatedAfter`           | ❌  | string  |                                       |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/conversations/?contact=example&cursor=example&endDate=example&externalConversationId=example&externalSource=example&inbox=example&keyword=example&pageSize=1&startDate=example&updatedAfter=2026-03-21T14:31:44.842Z" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/conversations/?contact=example&cursor=example&endDate=example&externalConversationId=example&externalSource=example&inbox=example&keyword=example&pageSize=1&startDate=example&updatedAfter=2026-03-21T14:31:44.842Z", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/conversations/?contact=example&cursor=example&endDate=example&externalConversationId=example&externalSource=example&inbox=example&keyword=example&pageSize=1&startDate=example&updatedAfter=2026-03-21T14:31:44.842Z"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/conversations/?contact=example&cursor=example&endDate=example&externalConversationId=example&externalSource=example&inbox=example&keyword=example&pageSize=1&startDate=example&updatedAfter=2026-03-21T14:31:44.842Z", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "count": integer
  "next"?: string (uri) // 任意
  "previous"?: string (uri) // 任意
  "results": [
    {
      "id": string (uuid)
      "contact": { // 軽量版の Contact Serializer。Conversation List view で使用します

List view に必要なフィールドのみを含み、inboxes と mcp_credentials を除外します
N+1 クエリ問題を回避するため
      {
        "id": string (uuid)
        "name": string
        "avatar"?: string (uri) // 任意
        "sourceId"?: string // 任意
      }
      }
      "inbox": {
      {
        "id": string (uuid)
        "name": string
        "channelType": string (enum: line, telegram, teams, web, messenger, instagram, email, whatsapp) // * `line` - LINE
* `telegram` - Telegram
* `teams` - Teams
* `web` - Web
* `messenger` - Messenger
* `instagram` - Instagram
* `email` - Email
* `whatsapp` - WhatsApp
        "unreadConversationsCount"?: integer // 任意
        "signAuth"?:  // 任意
        {
          "id": string (uuid)
          "signSource": string (uuid)
          "signParams": {
          {
            "keycloak": 
            {
              "clientId": string
              "url": string
              "realm": string
            }
            "line": 
            {
              "liffId": string
            }
            "ad": 
            {
              "saml": string
            }
          }
          }
        }
      }
      }
      "title": string
      "lastMessage"?: { // 任意
      {
        "id": string (uuid)
        "type"?: string // 任意
        "content"?: string // 任意
        "contentPayload"?: object // 任意
        "feedback": 
        {
          "id": string (uuid)
          "type": 
          {
          }
          "suggestion"?: string // 任意
          "updatedAt": string (timestamp)
        }
        "createdAt": string (timestamp)
        "queryMetadata"?: object // 任意
      }
      }
      "lastMessageCreatedAt": string (timestamp)
      "unreadMessagesCount": integer
      "autoReplyEnabled": boolean
      "isAutoReplyNow": boolean
      "lastReadAt": string (timestamp)
      "createdAt": string (timestamp)
      "isGroupChat": boolean
      "enableGroupMention"?: boolean // 任意
      "queryMetadata"?: object // 任意
      "toolMask"?: object // 各ツールの有効/無効の状態を記録します {tool_id: bool} (任意)
      "connectorMask"?: object // 各コネクタの有効/無効の状態を記録します {connector_id: bool} (任意)
      "thinkingConfig"?: object // None=未設定 (chatbot の設定を使用)、{}=明示的に無効、{...}=カスタムで上書き (任意)
      "thinkingConfigSchema": object
      "effectiveThinkingConfig": object // Return the effective thinking config after applying the priority chain:
conversation override > chatbot config > LLM metadata.

This allows the frontend to display the actual thinking config in use,
even when the conversation has no explicit override.
      "llm": string (uuid)
      "deepResearchStatus":  // Status of deep research for this conversation

* `not_used` - Not Used
* `started` - Started
* `running` - Running
* `completed` - Completed
* `failed` - Failed
      {
      }
      "ipAddress": string
      "ipCountryCode": string
      "ipRecordedAt": string (timestamp)
    }
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "contact": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "avatar": "https://example.com/file.jpg",
        "sourceId": "レスポンス文字列"
      },
      "inbox": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列",
        "channelType": "line",
        "unreadConversationsCount": 456,
        "signAuth": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "signSource": "550e8400-e29b-41d4-a716-446655440000",
          "signParams": {
            "keycloak": {
              "clientId": "レスポンス文字列",
              "url": "レスポンス文字列",
              "realm": "レスポンス文字列"
            },
            "line": {
              "liffId": "レスポンス文字列"
            },
            "ad": {
              "saml": "レスポンス文字列"
            }
          }
        }
      },
      "title": "レスポンス文字列",
      "lastMessage": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "type": "レスポンス文字列",
        "content": "レスポンス文字列",
        "contentPayload": null,
        "feedback": {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "type": {},
          "suggestion": "レスポンス文字列",
          "updatedAt": "レスポンス文字列"
        },
        "createdAt": "レスポンス文字列",
        "queryMetadata": null
      },
      "lastMessageCreatedAt": "レスポンス文字列",
      "unreadMessagesCount": 456,
      "autoReplyEnabled": false,
      "isAutoReplyNow": false,
      "lastReadAt": "レスポンス文字列",
      "createdAt": "レスポンス文字列",
      "isGroupChat": false,
      "enableGroupMention": false,
      "queryMetadata": null,
      "toolMask": null,
      "connectorMask": null,
      "thinkingConfig": null,
      "thinkingConfigSchema": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンスのサンプル名",
        "description": "レスポンスのサンプル説明"
      },
      "effectiveThinkingConfig": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンスのサンプル名",
        "description": "レスポンスのサンプル説明"
      },
      "llm": "550e8400-e29b-41d4-a716-446655440000",
      "deepResearchStatus": {},
      "ipAddress": "レスポンス文字列",
      "ipCountryCode": "レスポンス文字列",
      "ipRecordedAt": "レスポンス文字列"
    }
  ]
}
```

***

### 特定の会話を取得 <a href="#undefined" id="undefined"></a>

GET `/api/conversations/{id}/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                 |
| ------ | -- | ------ | ---------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this 会話. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/conversations/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/conversations/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/conversations/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/conversations/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "contact": { // 軽量版の Contact Serializer。Conversation List view で使用します

List view に必要なフィールドのみを含み、inboxes と mcp_credentials を除外します
N+1 クエリ問題を回避するため
  {
    "id": string (uuid)
    "name": string
    "avatar"?: string (uri) // 任意
    "sourceId"?: string // 任意
  }
  }
  "inbox": {
  {
    "id": string (uuid)
    "name": string
    "channelType": string (enum: line, telegram, teams, web, messenger, instagram, email, whatsapp) // * `line` - LINE
* `telegram` - Telegram
* `teams` - Teams
* `web` - Web
* `messenger` - Messenger
* `instagram` - Instagram
* `email` - Email
* `whatsapp` - WhatsApp
    "unreadConversationsCount"?: integer // 任意
    "signAuth"?:  // 任意
    {
      "id": string (uuid)
      "signSource": string (uuid)
      "signParams": {
      {
        "keycloak": 
        {
          "clientId": string
          "url": string
          "realm": string
        }
        "line": 
        {
          "liffId": string
        }
        "ad": 
        {
          "saml": string
        }
      }
      }
    }
  }
  }
  "title": string
  "lastMessage"?: { // 任意
  {
    "id": string (uuid)
    "type"?: string // 任意
    "content"?: string // 任意
    "contentPayload"?: object // 任意
    "feedback": 
    {
      "id": string (uuid)
      "type": 
      {
      }
      "suggestion"?: string // 任意
      "updatedAt": string (timestamp)
    }
    "createdAt": string (timestamp)
    "queryMetadata"?: object // 任意
  }
  }
  "lastMessageCreatedAt": string (timestamp)
  "unreadMessagesCount": integer
  "autoReplyEnabled": boolean
  "isAutoReplyNow": boolean
  "lastReadAt": string (timestamp)
  "createdAt": string (timestamp)
  "isGroupChat": boolean
  "enableGroupMention"?: boolean // 任意
  "queryMetadata"?: object // 任意
  "toolMask"?: object // 各ツールの有効/無効の状態を記録します {tool_id: bool} (任意)
  "connectorMask"?: object // 各コネクタの有効/無効の状態を記録します {connector_id: bool} (任意)
  "thinkingConfig"?: object // None=未設定 (chatbot の設定を使用)、{}=明示的に無効、{...}=カスタムで上書き (任意)
  "thinkingConfigSchema": object
  "effectiveThinkingConfig": object // Return the effective thinking config after applying the priority chain:
conversation override > chatbot config > LLM metadata.

This allows the frontend to display the actual thinking config in use,
even when the conversation has no explicit override.
  "llm": string (uuid)
  "deepResearchStatus":  // Status of deep research for this conversation

* `not_used` - Not Used
* `started` - Started
* `running` - Running
* `completed` - Completed
* `failed` - Failed
  {
  }
  "ipAddress": string
  "ipCountryCode": string
  "ipRecordedAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "contact": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "avatar": "https://example.com/file.jpg",
    "sourceId": "レスポンス文字列"
  },
  "inbox": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "channelType": "line",
    "unreadConversationsCount": 456,
    "signAuth": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "signSource": "550e8400-e29b-41d4-a716-446655440000",
      "signParams": {
        "keycloak": {
          "clientId": "レスポンス文字列",
          "url": "レスポンス文字列",
          "realm": "レスポンス文字列"
        },
        "line": {
          "liffId": "レスポンス文字列"
        },
        "ad": {
          "saml": "レスポンス文字列"
        }
      }
    }
  },
  "title": "レスポンス文字列",
  "lastMessage": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "レスポンス文字列",
    "content": "レスポンス文字列",
    "contentPayload": null,
    "feedback": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": {},
      "suggestion": "レスポンス文字列",
      "updatedAt": "レスポンス文字列"
    },
    "createdAt": "レスポンス文字列",
    "queryMetadata": null
  },
  "lastMessageCreatedAt": "レスポンス文字列",
  "unreadMessagesCount": 456,
  "autoReplyEnabled": false,
  "isAutoReplyNow": false,
  "lastReadAt": "レスポンス文字列",
  "createdAt": "レスポンス文字列",
  "isGroupChat": false,
  "enableGroupMention": false,
  "queryMetadata": null,
  "toolMask": null,
  "connectorMask": null,
  "thinkingConfig": null,
  "thinkingConfigSchema": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "effectiveThinkingConfig": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "llm": "550e8400-e29b-41d4-a716-446655440000",
  "deepResearchStatus": {},
  "ipAddress": "レスポンス文字列",
  "ipCountryCode": "レスポンス文字列",
  "ipRecordedAt": "レスポンス文字列"
}
```

***

### 特定の会話を取得 <a href="#undefined" id="undefined"></a>

GET `/api/v1/conversations/{id}/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                 |
| ------ | -- | ------ | ---------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this 会話. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/conversations/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/conversations/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/conversations/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/conversations/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "contact": { // 軽量版の Contact Serializer。Conversation List view で使用します

List view に必要なフィールドのみを含み、inboxes と mcp_credentials を除外します
N+1 クエリ問題を回避するため
  {
    "id": string (uuid)
    "name": string
    "avatar"?: string (uri) // 任意
    "sourceId"?: string // 任意
  }
  }
  "inbox": {
  {
    "id": string (uuid)
    "name": string
    "channelType": string (enum: line, telegram, teams, web, messenger, instagram, email, whatsapp) // * `line` - LINE
* `telegram` - Telegram
* `teams` - Teams
* `web` - Web
* `messenger` - Messenger
* `instagram` - Instagram
* `email` - Email
* `whatsapp` - WhatsApp
    "unreadConversationsCount"?: integer // 任意
    "signAuth"?:  // 任意
    {
      "id": string (uuid)
      "signSource": string (uuid)
      "signParams": {
      {
        "keycloak": 
        {
          "clientId": string
          "url": string
          "realm": string
        }
        "line": 
        {
          "liffId": string
        }
        "ad": 
        {
          "saml": string
        }
      }
      }
    }
  }
  }
  "title": string
  "lastMessage"?: { // 任意
  {
    "id": string (uuid)
    "type"?: string // 任意
    "content"?: string // 任意
    "contentPayload"?: object // 任意
    "feedback": 
    {
      "id": string (uuid)
      "type": 
      {
      }
      "suggestion"?: string // 任意
      "updatedAt": string (timestamp)
    }
    "createdAt": string (timestamp)
    "queryMetadata"?: object // 任意
  }
  }
  "lastMessageCreatedAt": string (timestamp)
  "unreadMessagesCount": integer
  "autoReplyEnabled": boolean
  "isAutoReplyNow": boolean
  "lastReadAt": string (timestamp)
  "createdAt": string (timestamp)
  "isGroupChat": boolean
  "enableGroupMention"?: boolean // 任意
  "queryMetadata"?: object // 任意
  "toolMask"?: object // 各ツールの有効/無効の状態を記録します {tool_id: bool} (任意)
  "connectorMask"?: object // 各コネクタの有効/無効の状態を記録します {connector_id: bool} (任意)
  "thinkingConfig"?: object // None=未設定 (chatbot の設定を使用)、{}=明示的に無効、{...}=カスタムで上書き (任意)
  "thinkingConfigSchema": object
  "effectiveThinkingConfig": object // Return the effective thinking config after applying the priority chain:
conversation override > chatbot config > LLM metadata.

This allows the frontend to display the actual thinking config in use,
even when the conversation has no explicit override.
  "llm": string (uuid)
  "deepResearchStatus":  // Status of deep research for this conversation

* `not_used` - Not Used
* `started` - Started
* `running` - Running
* `completed` - Completed
* `failed` - Failed
  {
  }
  "ipAddress": string
  "ipCountryCode": string
  "ipRecordedAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "contact": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "avatar": "https://example.com/file.jpg",
    "sourceId": "レスポンス文字列"
  },
  "inbox": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "channelType": "line",
    "unreadConversationsCount": 456,
    "signAuth": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "signSource": "550e8400-e29b-41d4-a716-446655440000",
      "signParams": {
        "keycloak": {
          "clientId": "レスポンス文字列",
          "url": "レスポンス文字列",
          "realm": "レスポンス文字列"
        },
        "line": {
          "liffId": "レスポンス文字列"
        },
        "ad": {
          "saml": "レスポンス文字列"
        }
      }
    }
  },
  "title": "レスポンス文字列",
  "lastMessage": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "レスポンス文字列",
    "content": "レスポンス文字列",
    "contentPayload": null,
    "feedback": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": {},
      "suggestion": "レスポンス文字列",
      "updatedAt": "レスポンス文字列"
    },
    "createdAt": "レスポンス文字列",
    "queryMetadata": null
  },
  "lastMessageCreatedAt": "レスポンス文字列",
  "unreadMessagesCount": 456,
  "autoReplyEnabled": false,
  "isAutoReplyNow": false,
  "lastReadAt": "レスポンス文字列",
  "createdAt": "レスポンス文字列",
  "isGroupChat": false,
  "enableGroupMention": false,
  "queryMetadata": null,
  "toolMask": null,
  "connectorMask": null,
  "thinkingConfig": null,
  "thinkingConfigSchema": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "effectiveThinkingConfig": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "llm": "550e8400-e29b-41d4-a716-446655440000",
  "deepResearchStatus": {},
  "ipAddress": "レスポンス文字列",
  "ipCountryCode": "レスポンス文字列",
  "ipRecordedAt": "レスポンス文字列"
}
```

***

### 会話の名前を変更 <a href="#undefined" id="undefined"></a>

PATCH `/api/conversations/{id}/rename/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                 |
| ------ | -- | ------ | ---------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this 会話. |

#### リクエスト内容

**リクエストパラメータ**

| フィールド | 型      | 必須 | 説明 |
| ----- | ------ | -- | -- |
| title | string | 任意 |    |

**リクエスト構造の例**

```typescript
{
  "title"?: string // 任意
}
```

**リクエストのサンプル値**

```json
{
  "title": "サンプル名"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/conversations/550e8400-e29b-41d4-a716-446655440000/rename/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "サンプル名"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "title": "サンプル名"
  };

axios.patch("https://api.maiagent.ai/api/conversations/550e8400-e29b-41d4-a716-446655440000/rename/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/conversations/550e8400-e29b-41d4-a716-446655440000/rename/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "title": "サンプル名"
    }

response = requests.patch(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/conversations/550e8400-e29b-41d4-a716-446655440000/rename/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "title": "サンプル名"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "contact": { // 軽量版の Contact Serializer。Conversation List view で使用します

List view に必要なフィールドのみを含み、inboxes と mcp_credentials を除外します
N+1 クエリ問題を回避するため
  {
    "id": string (uuid)
    "name": string
    "avatar"?: string (uri) // 任意
    "sourceId"?: string // 任意
  }
  }
  "inbox": {
  {
    "id": string (uuid)
    "name": string
    "channelType": string (enum: line, telegram, teams, web, messenger, instagram, email, whatsapp) // * `line` - LINE
* `telegram` - Telegram
* `teams` - Teams
* `web` - Web
* `messenger` - Messenger
* `instagram` - Instagram
* `email` - Email
* `whatsapp` - WhatsApp
    "unreadConversationsCount"?: integer // 任意
    "signAuth"?:  // 任意
    {
      "id": string (uuid)
      "signSource": string (uuid)
      "signParams": {
      {
        "keycloak": 
        {
          "clientId": string
          "url": string
          "realm": string
        }
        "line": 
        {
          "liffId": string
        }
        "ad": 
        {
          "saml": string
        }
      }
      }
    }
  }
  }
  "title": string
  "lastMessage"?: { // 任意
  {
    "id": string (uuid)
    "type"?: string // 任意
    "content"?: string // 任意
    "contentPayload"?: object // 任意
    "feedback": 
    {
      "id": string (uuid)
      "type": 
      {
      }
      "suggestion"?: string // 任意
      "updatedAt": string (timestamp)
    }
    "createdAt": string (timestamp)
    "queryMetadata"?: object // 任意
  }
  }
  "lastMessageCreatedAt": string (timestamp)
  "unreadMessagesCount": integer
  "autoReplyEnabled": boolean
  "isAutoReplyNow": boolean
  "lastReadAt": string (timestamp)
  "createdAt": string (timestamp)
  "isGroupChat": boolean
  "enableGroupMention"?: boolean // 任意
  "queryMetadata"?: object // 任意
  "toolMask"?: object // 各ツールの有効/無効の状態を記録します {tool_id: bool} (任意)
  "connectorMask"?: object // 各コネクタの有効/無効の状態を記録します {connector_id: bool} (任意)
  "thinkingConfig"?: object // None=未設定 (chatbot の設定を使用)、{}=明示的に無効、{...}=カスタムで上書き (任意)
  "thinkingConfigSchema": object
  "effectiveThinkingConfig": object // Return the effective thinking config after applying the priority chain:
conversation override > chatbot config > LLM metadata.

This allows the frontend to display the actual thinking config in use,
even when the conversation has no explicit override.
  "llm": string (uuid)
  "deepResearchStatus":  // Status of deep research for this conversation

* `not_used` - Not Used
* `started` - Started
* `running` - Running
* `completed` - Completed
* `failed` - Failed
  {
  }
  "ipAddress": string
  "ipCountryCode": string
  "ipRecordedAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "contact": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "avatar": "https://example.com/file.jpg",
    "sourceId": "レスポンス文字列"
  },
  "inbox": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "channelType": "line",
    "unreadConversationsCount": 456,
    "signAuth": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "signSource": "550e8400-e29b-41d4-a716-446655440000",
      "signParams": {
        "keycloak": {
          "clientId": "レスポンス文字列",
          "url": "レスポンス文字列",
          "realm": "レスポンス文字列"
        },
        "line": {
          "liffId": "レスポンス文字列"
        },
        "ad": {
          "saml": "レスポンス文字列"
        }
      }
    }
  },
  "title": "レスポンス文字列",
  "lastMessage": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "レスポンス文字列",
    "content": "レスポンス文字列",
    "contentPayload": null,
    "feedback": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": {},
      "suggestion": "レスポンス文字列",
      "updatedAt": "レスポンス文字列"
    },
    "createdAt": "レスポンス文字列",
    "queryMetadata": null
  },
  "lastMessageCreatedAt": "レスポンス文字列",
  "unreadMessagesCount": 456,
  "autoReplyEnabled": false,
  "isAutoReplyNow": false,
  "lastReadAt": "レスポンス文字列",
  "createdAt": "レスポンス文字列",
  "isGroupChat": false,
  "enableGroupMention": false,
  "queryMetadata": null,
  "toolMask": null,
  "connectorMask": null,
  "thinkingConfig": null,
  "thinkingConfigSchema": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "effectiveThinkingConfig": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "llm": "550e8400-e29b-41d4-a716-446655440000",
  "deepResearchStatus": {},
  "ipAddress": "レスポンス文字列",
  "ipCountryCode": "レスポンス文字列",
  "ipRecordedAt": "レスポンス文字列"
}
```

***

### 会話の名前を変更 <a href="#undefined" id="undefined"></a>

PATCH `/api/v1/conversations/{id}/rename/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                 |
| ------ | -- | ------ | ---------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this 会話. |

#### リクエスト内容

**リクエストパラメータ**

| フィールド | 型      | 必須 | 説明 |
| ----- | ------ | -- | -- |
| title | string | 任意 |    |

**リクエスト構造の例**

```typescript
{
  "title"?: string // 任意
}
```

**リクエストのサンプル値**

```json
{
  "title": "サンプル名"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/v1/conversations/550e8400-e29b-41d4-a716-446655440000/rename/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "サンプル名"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "title": "サンプル名"
  };

axios.patch("https://api.maiagent.ai/api/v1/conversations/550e8400-e29b-41d4-a716-446655440000/rename/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/conversations/550e8400-e29b-41d4-a716-446655440000/rename/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "title": "サンプル名"
    }

response = requests.patch(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/v1/conversations/550e8400-e29b-41d4-a716-446655440000/rename/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "title": "サンプル名"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "contact": { // 軽量版の Contact Serializer。Conversation List view で使用します

List view に必要なフィールドのみを含み、inboxes と mcp_credentials を除外します
N+1 クエリ問題を回避するため
  {
    "id": string (uuid)
    "name": string
    "avatar"?: string (uri) // 任意
    "sourceId"?: string // 任意
  }
  }
  "inbox": {
  {
    "id": string (uuid)
    "name": string
    "channelType": string (enum: line, telegram, teams, web, messenger, instagram, email, whatsapp) // * `line` - LINE
* `telegram` - Telegram
* `teams` - Teams
* `web` - Web
* `messenger` - Messenger
* `instagram` - Instagram
* `email` - Email
* `whatsapp` - WhatsApp
    "unreadConversationsCount"?: integer // 任意
    "signAuth"?:  // 任意
    {
      "id": string (uuid)
      "signSource": string (uuid)
      "signParams": {
      {
        "keycloak": 
        {
          "clientId": string
          "url": string
          "realm": string
        }
        "line": 
        {
          "liffId": string
        }
        "ad": 
        {
          "saml": string
        }
      }
      }
    }
  }
  }
  "title": string
  "lastMessage"?: { // 任意
  {
    "id": string (uuid)
    "type"?: string // 任意
    "content"?: string // 任意
    "contentPayload"?: object // 任意
    "feedback": 
    {
      "id": string (uuid)
      "type": 
      {
      }
      "suggestion"?: string // 任意
      "updatedAt": string (timestamp)
    }
    "createdAt": string (timestamp)
    "queryMetadata"?: object // 任意
  }
  }
  "lastMessageCreatedAt": string (timestamp)
  "unreadMessagesCount": integer
  "autoReplyEnabled": boolean
  "isAutoReplyNow": boolean
  "lastReadAt": string (timestamp)
  "createdAt": string (timestamp)
  "isGroupChat": boolean
  "enableGroupMention"?: boolean // 任意
  "queryMetadata"?: object // 任意
  "toolMask"?: object // 各ツールの有効/無効の状態を記録します {tool_id: bool} (任意)
  "connectorMask"?: object // 各コネクタの有効/無効の状態を記録します {connector_id: bool} (任意)
  "thinkingConfig"?: object // None=未設定 (chatbot の設定を使用)、{}=明示的に無効、{...}=カスタムで上書き (任意)
  "thinkingConfigSchema": object
  "effectiveThinkingConfig": object // Return the effective thinking config after applying the priority chain:
conversation override > chatbot config > LLM metadata.

This allows the frontend to display the actual thinking config in use,
even when the conversation has no explicit override.
  "llm": string (uuid)
  "deepResearchStatus":  // Status of deep research for this conversation

* `not_used` - Not Used
* `started` - Started
* `running` - Running
* `completed` - Completed
* `failed` - Failed
  {
  }
  "ipAddress": string
  "ipCountryCode": string
  "ipRecordedAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "contact": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "avatar": "https://example.com/file.jpg",
    "sourceId": "レスポンス文字列"
  },
  "inbox": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列",
    "channelType": "line",
    "unreadConversationsCount": 456,
    "signAuth": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "signSource": "550e8400-e29b-41d4-a716-446655440000",
      "signParams": {
        "keycloak": {
          "clientId": "レスポンス文字列",
          "url": "レスポンス文字列",
          "realm": "レスポンス文字列"
        },
        "line": {
          "liffId": "レスポンス文字列"
        },
        "ad": {
          "saml": "レスポンス文字列"
        }
      }
    }
  },
  "title": "レスポンス文字列",
  "lastMessage": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": "レスポンス文字列",
    "content": "レスポンス文字列",
    "contentPayload": null,
    "feedback": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": {},
      "suggestion": "レスポンス文字列",
      "updatedAt": "レスポンス文字列"
    },
    "createdAt": "レスポンス文字列",
    "queryMetadata": null
  },
  "lastMessageCreatedAt": "レスポンス文字列",
  "unreadMessagesCount": 456,
  "autoReplyEnabled": false,
  "isAutoReplyNow": false,
  "lastReadAt": "レスポンス文字列",
  "createdAt": "レスポンス文字列",
  "isGroupChat": false,
  "enableGroupMention": false,
  "queryMetadata": null,
  "toolMask": null,
  "connectorMask": null,
  "thinkingConfig": null,
  "thinkingConfigSchema": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "effectiveThinkingConfig": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "llm": "550e8400-e29b-41d4-a716-446655440000",
  "deepResearchStatus": {},
  "ipAddress": "レスポンス文字列",
  "ipCountryCode": "レスポンス文字列",
  "ipRecordedAt": "レスポンス文字列"
}
```

***

### 会話を共有 <a href="#undefined" id="undefined"></a>

POST `/api/conversations/{conversationPk}/share/`

#### パラメータ

| パラメータ名           | 必須 | 型      | 説明 |
| ---------------- | -- | ------ | -- |
| `conversationPk` | ✅  | string |    |

#### リクエスト内容

**リクエストパラメータ**

| フィールド       | 型                                          | 必須 | 説明                                                                |
| ----------- | ------------------------------------------ | -- | ----------------------------------------------------------------- |
| shareScope  | string (enum: organization, group, member) | 必須 | `organization`: Organization ; `group`: Group ; `member`: Member; |
| permission  | object                                     | 任意 |                                                                   |
| title       | string                                     | 任意 |                                                                   |
| description | string                                     | 任意 |                                                                   |
| groupIds    | array\[string]                             | 任意 |                                                                   |
| memberIds   | array\[string]                             | 任意 |                                                                   |

**リクエスト構造の例**

```typescript
{
  "shareScope": string (enum: organization, group, member) // * `organization` - Organization
* `group` - Group
* `member` - Member
  "permission"?:  // 任意
  {
  }
  "title"?: string // 任意
  "description"?: string // 任意
  "groupIds"?: [ // 任意
    string (uuid)
  ]
  "memberIds"?: [ // 任意
    string (uuid)
  ]
}
```

**リクエストのサンプル値**

```json
{
  "shareScope": "organization",
  "permission": {},
  "title": "サンプル名",
  "description": "サンプル文字列",
  "groupIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "memberIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/conversations/{conversationPk}/share/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "shareScope": "organization",
    "permission": {},
    "title": "サンプル名",
    "description": "サンプル文字列",
    "groupIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ],
    "memberIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ]
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "shareScope": "organization",
    "permission": {},
    "title": "サンプル名",
    "description": "サンプル文字列",
    "groupIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ],
    "memberIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ]
  };

axios.post("https://api.maiagent.ai/api/conversations/{conversationPk}/share/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/conversations/{conversationPk}/share/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "shareScope": "organization",
      "permission": {},
      "title": "サンプル名",
      "description": "サンプル文字列",
      "groupIds": [
        "550e8400-e29b-41d4-a716-446655440000"
      ],
      "memberIds": [
        "550e8400-e29b-41d4-a716-446655440000"
      ]
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/conversations/{conversationPk}/share/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "shareScope": "organization",
            "permission": {},
            "title": "サンプル名",
            "description": "サンプル文字列",
            "groupIds": [
                "550e8400-e29b-41d4-a716-446655440000"
            ],
            "memberIds": [
                "550e8400-e29b-41d4-a716-446655440000"
            ]
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 201**

**レスポンス構造の例**

```typescript
{
  "shareScope": string (enum: organization, group, member) // * `organization` - Organization
* `group` - Group
* `member` - Member
  "permission"?:  // 任意
  {
  }
  "title"?: string // 任意
  "description"?: string // 任意
  "groupIds"?: [ // 任意
    string (uuid)
  ]
  "memberIds"?: [ // 任意
    string (uuid)
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "shareScope": "organization",
  "permission": {},
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "groupIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "memberIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}
```

***

### 会話を共有 <a href="#undefined" id="undefined"></a>

POST `/api/v1/conversations/{conversationPk}/share/`

#### パラメータ

| パラメータ名           | 必須 | 型      | 説明 |
| ---------------- | -- | ------ | -- |
| `conversationPk` | ✅  | string |    |

#### リクエスト内容

**リクエストパラメータ**

| フィールド       | 型                                          | 必須 | 説明                                                                |
| ----------- | ------------------------------------------ | -- | ----------------------------------------------------------------- |
| shareScope  | string (enum: organization, group, member) | 必須 | `organization`: Organization ; `group`: Group ; `member`: Member; |
| permission  | object                                     | 任意 |                                                                   |
| title       | string                                     | 任意 |                                                                   |
| description | string                                     | 任意 |                                                                   |
| groupIds    | array\[string]                             | 任意 |                                                                   |
| memberIds   | array\[string]                             | 任意 |                                                                   |

**リクエスト構造の例**

```typescript
{
  "shareScope": string (enum: organization, group, member) // * `organization` - Organization
* `group` - Group
* `member` - Member
  "permission"?:  // 任意
  {
  }
  "title"?: string // 任意
  "description"?: string // 任意
  "groupIds"?: [ // 任意
    string (uuid)
  ]
  "memberIds"?: [ // 任意
    string (uuid)
  ]
}
```

**リクエストのサンプル値**

```json
{
  "shareScope": "organization",
  "permission": {},
  "title": "サンプル名",
  "description": "サンプル文字列",
  "groupIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "memberIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/conversations/{conversationPk}/share/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "shareScope": "organization",
    "permission": {},
    "title": "サンプル名",
    "description": "サンプル文字列",
    "groupIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ],
    "memberIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ]
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "shareScope": "organization",
    "permission": {},
    "title": "サンプル名",
    "description": "サンプル文字列",
    "groupIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ],
    "memberIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ]
  };

axios.post("https://api.maiagent.ai/api/v1/conversations/{conversationPk}/share/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/conversations/{conversationPk}/share/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "shareScope": "organization",
      "permission": {},
      "title": "サンプル名",
      "description": "サンプル文字列",
      "groupIds": [
        "550e8400-e29b-41d4-a716-446655440000"
      ],
      "memberIds": [
        "550e8400-e29b-41d4-a716-446655440000"
      ]
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/conversations/{conversationPk}/share/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "shareScope": "organization",
            "permission": {},
            "title": "サンプル名",
            "description": "サンプル文字列",
            "groupIds": [
                "550e8400-e29b-41d4-a716-446655440000"
            ],
            "memberIds": [
                "550e8400-e29b-41d4-a716-446655440000"
            ]
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 201**

**レスポンス構造の例**

```typescript
{
  "shareScope": string (enum: organization, group, member) // * `organization` - Organization
* `group` - Group
* `member` - Member
  "permission"?:  // 任意
  {
  }
  "title"?: string // 任意
  "description"?: string // 任意
  "groupIds"?: [ // 任意
    string (uuid)
  ]
  "memberIds"?: [ // 任意
    string (uuid)
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "shareScope": "organization",
  "permission": {},
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "groupIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "memberIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}
```

***

### 会話をクイック共有 <a href="#undefined" id="undefined"></a>

POST `/api/conversations/{conversationPk}/share/quick/`

#### パラメータ

| パラメータ名           | 必須 | 型      | 説明 |
| ---------------- | -- | ------ | -- |
| `conversationPk` | ✅  | string |    |

#### リクエスト内容

**リクエストパラメータ**

| フィールド       | 型                                          | 必須 | 説明                                                                |
| ----------- | ------------------------------------------ | -- | ----------------------------------------------------------------- |
| shareScope  | string (enum: organization, group, member) | 必須 | `organization`: Organization ; `group`: Group ; `member`: Member; |
| permission  | object                                     | 任意 |                                                                   |
| title       | string                                     | 任意 |                                                                   |
| description | string                                     | 任意 |                                                                   |
| groupIds    | array\[string]                             | 任意 |                                                                   |
| memberIds   | array\[string]                             | 任意 |                                                                   |

**リクエスト構造の例**

```typescript
{
  "shareScope": string (enum: organization, group, member) // * `organization` - Organization
* `group` - Group
* `member` - Member
  "permission"?:  // 任意
  {
  }
  "title"?: string // 任意
  "description"?: string // 任意
  "groupIds"?: [ // 任意
    string (uuid)
  ]
  "memberIds"?: [ // 任意
    string (uuid)
  ]
}
```

**リクエストのサンプル値**

```json
{
  "shareScope": "organization",
  "permission": {},
  "title": "サンプル名",
  "description": "サンプル文字列",
  "groupIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "memberIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/conversations/{conversationPk}/share/quick/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "shareScope": "organization",
    "permission": {},
    "title": "サンプル名",
    "description": "サンプル文字列",
    "groupIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ],
    "memberIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ]
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "shareScope": "organization",
    "permission": {},
    "title": "サンプル名",
    "description": "サンプル文字列",
    "groupIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ],
    "memberIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ]
  };

axios.post("https://api.maiagent.ai/api/conversations/{conversationPk}/share/quick/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/conversations/{conversationPk}/share/quick/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "shareScope": "organization",
      "permission": {},
      "title": "サンプル名",
      "description": "サンプル文字列",
      "groupIds": [
        "550e8400-e29b-41d4-a716-446655440000"
      ],
      "memberIds": [
        "550e8400-e29b-41d4-a716-446655440000"
      ]
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/conversations/{conversationPk}/share/quick/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "shareScope": "organization",
            "permission": {},
            "title": "サンプル名",
            "description": "サンプル文字列",
            "groupIds": [
                "550e8400-e29b-41d4-a716-446655440000"
            ],
            "memberIds": [
                "550e8400-e29b-41d4-a716-446655440000"
            ]
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "shareScope": string (enum: organization, group, member) // * `organization` - Organization
* `group` - Group
* `member` - Member
  "permission"?:  // 任意
  {
  }
  "title"?: string // 任意
  "description"?: string // 任意
  "groupIds"?: [ // 任意
    string (uuid)
  ]
  "memberIds"?: [ // 任意
    string (uuid)
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "shareScope": "organization",
  "permission": {},
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "groupIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "memberIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}
```

***

### 会話をクイック共有 <a href="#undefined" id="undefined"></a>

POST `/api/v1/conversations/{conversationPk}/share/quick/`

#### パラメータ

| パラメータ名           | 必須 | 型      | 説明 |
| ---------------- | -- | ------ | -- |
| `conversationPk` | ✅  | string |    |

#### リクエスト内容

**リクエストパラメータ**

| フィールド       | 型                                          | 必須 | 説明                                                                |
| ----------- | ------------------------------------------ | -- | ----------------------------------------------------------------- |
| shareScope  | string (enum: organization, group, member) | 必須 | `organization`: Organization ; `group`: Group ; `member`: Member; |
| permission  | object                                     | 任意 |                                                                   |
| title       | string                                     | 任意 |                                                                   |
| description | string                                     | 任意 |                                                                   |
| groupIds    | array\[string]                             | 任意 |                                                                   |
| memberIds   | array\[string]                             | 任意 |                                                                   |

**リクエスト構造の例**

```typescript
{
  "shareScope": string (enum: organization, group, member) // * `organization` - Organization
* `group` - Group
* `member` - Member
  "permission"?:  // 任意
  {
  }
  "title"?: string // 任意
  "description"?: string // 任意
  "groupIds"?: [ // 任意
    string (uuid)
  ]
  "memberIds"?: [ // 任意
    string (uuid)
  ]
}
```

**リクエストのサンプル値**

```json
{
  "shareScope": "organization",
  "permission": {},
  "title": "サンプル名",
  "description": "サンプル文字列",
  "groupIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "memberIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/conversations/{conversationPk}/share/quick/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "shareScope": "organization",
    "permission": {},
    "title": "サンプル名",
    "description": "サンプル文字列",
    "groupIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ],
    "memberIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ]
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "shareScope": "organization",
    "permission": {},
    "title": "サンプル名",
    "description": "サンプル文字列",
    "groupIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ],
    "memberIds": [
      "550e8400-e29b-41d4-a716-446655440000"
    ]
  };

axios.post("https://api.maiagent.ai/api/v1/conversations/{conversationPk}/share/quick/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/conversations/{conversationPk}/share/quick/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "shareScope": "organization",
      "permission": {},
      "title": "サンプル名",
      "description": "サンプル文字列",
      "groupIds": [
        "550e8400-e29b-41d4-a716-446655440000"
      ],
      "memberIds": [
        "550e8400-e29b-41d4-a716-446655440000"
      ]
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/conversations/{conversationPk}/share/quick/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "shareScope": "organization",
            "permission": {},
            "title": "サンプル名",
            "description": "サンプル文字列",
            "groupIds": [
                "550e8400-e29b-41d4-a716-446655440000"
            ],
            "memberIds": [
                "550e8400-e29b-41d4-a716-446655440000"
            ]
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "shareScope": string (enum: organization, group, member) // * `organization` - Organization
* `group` - Group
* `member` - Member
  "permission"?:  // 任意
  {
  }
  "title"?: string // 任意
  "description"?: string // 任意
  "groupIds"?: [ // 任意
    string (uuid)
  ]
  "memberIds"?: [ // 任意
    string (uuid)
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "shareScope": "organization",
  "permission": {},
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "groupIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "memberIds": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}
```

***

### 共有された会話を一覧表示 <a href="#undefined" id="undefined"></a>

GET `/api/shared-conversations/`

#### パラメータ

| パラメータ名     | 必須 | 型       | 説明                                             |
| ---------- | -- | ------- | ---------------------------------------------- |
| `page`     | ❌  | integer | A page number within the paginated result set. |
| `pageSize` | ❌  | integer | Number of results to return per page.          |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/shared-conversations/?page=1&pageSize=1" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/shared-conversations/?page=1&pageSize=1", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/shared-conversations/?page=1&pageSize=1"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/shared-conversations/?page=1&pageSize=1", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "count": integer
  "next"?: string (uri) // 任意
  "previous"?: string (uri) // 任意
  "results": [
    {
      "id": string (uuid)
      "title": string // Custom title for the shared conversation
      "description": string // Custom description for the shared conversation
      "shareScope": 
      {
      }
      "permission": 
      {
      }
      "sharedBy": 
      {
        "id": string (uuid)
        "name": string
      }
      "messageCount": integer
      "createdAt": string (timestamp)
    }
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "title": "レスポンス文字列",
      "description": "レスポンス文字列",
      "shareScope": {},
      "permission": {},
      "sharedBy": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列"
      },
      "messageCount": 456,
      "createdAt": "レスポンス文字列"
    }
  ]
}
```

***

### 共有された会話を一覧表示 <a href="#undefined" id="undefined"></a>

GET `/api/v1/shared-conversations/`

#### パラメータ

| パラメータ名     | 必須 | 型       | 説明                                             |
| ---------- | -- | ------- | ---------------------------------------------- |
| `page`     | ❌  | integer | A page number within the paginated result set. |
| `pageSize` | ❌  | integer | Number of results to return per page.          |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/shared-conversations/?page=1&pageSize=1" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/shared-conversations/?page=1&pageSize=1", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/shared-conversations/?page=1&pageSize=1"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/shared-conversations/?page=1&pageSize=1", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "count": integer
  "next"?: string (uri) // 任意
  "previous"?: string (uri) // 任意
  "results": [
    {
      "id": string (uuid)
      "title": string // Custom title for the shared conversation
      "description": string // Custom description for the shared conversation
      "shareScope": 
      {
      }
      "permission": 
      {
      }
      "sharedBy": 
      {
        "id": string (uuid)
        "name": string
      }
      "messageCount": integer
      "createdAt": string (timestamp)
    }
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "title": "レスポンス文字列",
      "description": "レスポンス文字列",
      "shareScope": {},
      "permission": {},
      "sharedBy": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列"
      },
      "messageCount": 456,
      "createdAt": "レスポンス文字列"
    }
  ]
}
```

***

### 特定の共有会話を取得 <a href="#undefined" id="undefined"></a>

GET `/api/shared-conversations/{id}/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                                  |
| ------ | -- | ------ | --------------------------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this Shared Conversation. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "title": string // Custom title for the shared conversation
  "description": string // Custom description for the shared conversation
  "permission": 
  {
  }
  "sharedBy": 
  {
    "id": string (uuid)
    "name": string
  }
  "createdAt": string (timestamp)
  "conversationSnapshot": object // Frozen conversation snapshot: {title, messages[]}
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "permission": {},
  "sharedBy": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "createdAt": "レスポンス文字列",
  "conversationSnapshot": null
}
```

***

### 特定の共有会話を取得 <a href="#undefined" id="undefined"></a>

GET `/api/shared-conversations/my-shares/`

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/shared-conversations/my-shares/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/shared-conversations/my-shares/", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/shared-conversations/my-shares/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/shared-conversations/my-shares/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "title": string // Custom title for the shared conversation
  "description": string // Custom description for the shared conversation
  "shareScope": 
  {
  }
  "permission": 
  {
  }
  "sharedBy": 
  {
    "id": string (uuid)
    "name": string
  }
  "messageCount": integer
  "createdAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "shareScope": {},
  "permission": {},
  "sharedBy": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "messageCount": 456,
  "createdAt": "レスポンス文字列"
}
```

***

### 特定の共有会話を取得 <a href="#undefined" id="undefined"></a>

GET `/api/v1/shared-conversations/{id}/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                                  |
| ------ | -- | ------ | --------------------------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this Shared Conversation. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "title": string // Custom title for the shared conversation
  "description": string // Custom description for the shared conversation
  "permission": 
  {
  }
  "sharedBy": 
  {
    "id": string (uuid)
    "name": string
  }
  "createdAt": string (timestamp)
  "conversationSnapshot": object // Frozen conversation snapshot: {title, messages[]}
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "permission": {},
  "sharedBy": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "createdAt": "レスポンス文字列",
  "conversationSnapshot": null
}
```

***

### 特定の共有会話を取得 <a href="#undefined" id="undefined"></a>

GET `/api/v1/shared-conversations/my-shares/`

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/shared-conversations/my-shares/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/shared-conversations/my-shares/", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/shared-conversations/my-shares/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/shared-conversations/my-shares/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "title": string // Custom title for the shared conversation
  "description": string // Custom description for the shared conversation
  "shareScope": 
  {
  }
  "permission": 
  {
  }
  "sharedBy": 
  {
    "id": string (uuid)
    "name": string
  }
  "messageCount": integer
  "createdAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "shareScope": {},
  "permission": {},
  "sharedBy": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "messageCount": 456,
  "createdAt": "レスポンス文字列"
}
```

***

### 共有会話を更新 <a href="#undefined" id="undefined"></a>

PATCH `/api/shared-conversations/{id}/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                                  |
| ------ | -- | ------ | --------------------------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this Shared Conversation. |

#### リクエスト内容

**リクエストパラメータ**

| フィールド       | 型                             | 必須 | 説明                                        |
| ----------- | ----------------------------- | -- | ----------------------------------------- |
| title       | string                        | 任意 |                                           |
| description | string                        | 任意 |                                           |
| permission  | string (enum: readonly, copy) | 任意 | `readonly`: Read Only ; `copy`: Copyable; |

**リクエスト構造の例**

```typescript
{
  "title"?: string // 任意
  "description"?: string // 任意
  "permission"?: string (enum: readonly, copy) // * `readonly` - Read Only
* `copy` - Copyable (任意)
}
```

**リクエストのサンプル値**

```json
{
  "title": "サンプル名",
  "description": "サンプル文字列",
  "permission": "readonly"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "サンプル名",
    "description": "サンプル文字列",
    "permission": "readonly"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "title": "サンプル名",
    "description": "サンプル文字列",
    "permission": "readonly"
  };

axios.patch("https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "title": "サンプル名",
      "description": "サンプル文字列",
      "permission": "readonly"
    }

response = requests.patch(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "title": "サンプル名",
            "description": "サンプル文字列",
            "permission": "readonly"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "title"?: string // 任意
  "description"?: string // 任意
  "permission"?: string (enum: readonly, copy) // * `readonly` - Read Only
* `copy` - Copyable (任意)
}
```

**レスポンスのサンプル値**

```json
{
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "permission": "readonly"
}
```

***

### 共有会話を更新 <a href="#undefined" id="undefined"></a>

PATCH `/api/v1/shared-conversations/{id}/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                                  |
| ------ | -- | ------ | --------------------------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this Shared Conversation. |

#### リクエスト内容

**リクエストパラメータ**

| フィールド       | 型                             | 必須 | 説明                                        |
| ----------- | ----------------------------- | -- | ----------------------------------------- |
| title       | string                        | 任意 |                                           |
| description | string                        | 任意 |                                           |
| permission  | string (enum: readonly, copy) | 任意 | `readonly`: Read Only ; `copy`: Copyable; |

**リクエスト構造の例**

```typescript
{
  "title"?: string // 任意
  "description"?: string // 任意
  "permission"?: string (enum: readonly, copy) // * `readonly` - Read Only
* `copy` - Copyable (任意)
}
```

**リクエストのサンプル値**

```json
{
  "title": "サンプル名",
  "description": "サンプル文字列",
  "permission": "readonly"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "サンプル名",
    "description": "サンプル文字列",
    "permission": "readonly"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "title": "サンプル名",
    "description": "サンプル文字列",
    "permission": "readonly"
  };

axios.patch("https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "title": "サンプル名",
      "description": "サンプル文字列",
      "permission": "readonly"
    }

response = requests.patch(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "title": "サンプル名",
            "description": "サンプル文字列",
            "permission": "readonly"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "title"?: string // 任意
  "description"?: string // 任意
  "permission"?: string (enum: readonly, copy) // * `readonly` - Read Only
* `copy` - Copyable (任意)
}
```

**レスポンスのサンプル値**

```json
{
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "permission": "readonly"
}
```

***

### 共有会話を削除 <a href="#undefined" id="undefined"></a>

DELETE `/api/shared-conversations/{id}/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                                  |
| ------ | -- | ------ | --------------------------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this Shared Conversation. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// リクエスト内容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

| ステータスコード | 説明               |
| -------- | ---------------- |
| 204      | No response body |

***

### 共有会話を削除 <a href="#undefined" id="undefined"></a>

DELETE `/api/v1/shared-conversations/{id}/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                                  |
| ------ | -- | ------ | --------------------------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this Shared Conversation. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// リクエスト内容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

| ステータスコード | 説明               |
| -------- | ---------------- |
| 204      | No response body |

***

### 共有会話を複製 <a href="#undefined" id="undefined"></a>

POST `/api/shared-conversations/{id}/fork/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                                  |
| ------ | -- | ------ | --------------------------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this Shared Conversation. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/fork/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {};

axios.post("https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/fork/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/fork/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {}

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/shared-conversations/550e8400-e29b-41d4-a716-446655440000/fork/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {}
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "title": string // Custom title for the shared conversation
  "description": string // Custom description for the shared conversation
  "permission": 
  {
  }
  "sharedBy": 
  {
    "id": string (uuid)
    "name": string
  }
  "createdAt": string (timestamp)
  "conversationSnapshot": object // Frozen conversation snapshot: {title, messages[]}
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "permission": {},
  "sharedBy": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "createdAt": "レスポンス文字列",
  "conversationSnapshot": null
}
```

***

### 共有会話を複製 <a href="#undefined" id="undefined"></a>

POST `/api/v1/shared-conversations/{id}/fork/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                                  |
| ------ | -- | ------ | --------------------------------------------------- |
| `id`   | ✅  | string | A UUID string identifying this Shared Conversation. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/fork/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {};

axios.post("https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/fork/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/fork/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {}

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/shared-conversations/550e8400-e29b-41d4-a716-446655440000/fork/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {}
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "title": string // Custom title for the shared conversation
  "description": string // Custom description for the shared conversation
  "permission": 
  {
  }
  "sharedBy": 
  {
    "id": string (uuid)
    "name": string
  }
  "createdAt": string (timestamp)
  "conversationSnapshot": object // Frozen conversation snapshot: {title, messages[]}
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "title": "レスポンス文字列",
  "description": "レスポンス文字列",
  "permission": {},
  "sharedBy": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "createdAt": "レスポンス文字列",
  "conversationSnapshot": null
}
```

***

### メッセージフィードバックを作成 <a href="#undefined" id="undefined"></a>

POST `/api/messages/{messagePk}/feedback/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明 |
| ----------- | -- | ------ | -- |
| `messagePk` | ✅  | string |    |

#### リクエスト内容

**リクエストパラメータ**

| フィールド      | 型      | 必須 | 説明 |
| ---------- | ------ | -- | -- |
| type       | object | 必須 |    |
| suggestion | string | 任意 |    |

**リクエスト構造の例**

```typescript
{
  "type": 
  {
  }
  "suggestion"?: string // 任意
}
```

**リクエストのサンプル値**

```json
{
  "type": {},
  "suggestion": "サンプル文字列"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/messages/{messagePk}/feedback/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": {},
    "suggestion": "サンプル文字列"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "type": {},
    "suggestion": "サンプル文字列"
  };

axios.post("https://api.maiagent.ai/api/messages/{messagePk}/feedback/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/messages/{messagePk}/feedback/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "type": {},
      "suggestion": "サンプル文字列"
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/messages/{messagePk}/feedback/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "type": {},
            "suggestion": "サンプル文字列"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 201**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "type": 
  {
  }
  "suggestion"?: string // 任意
  "updatedAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "type": {},
  "suggestion": "レスポンス文字列",
  "updatedAt": "レスポンス文字列"
}
```

**ステータスコード: 400 - このメッセージには既にフィードバックがあります。PATCH メソッドで更新してください**

***

### メッセージフィードバックを作成 <a href="#undefined" id="undefined"></a>

POST `/api/v1/messages/{messagePk}/feedback/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明 |
| ----------- | -- | ------ | -- |
| `messagePk` | ✅  | string |    |

#### リクエスト内容

**リクエストパラメータ**

| フィールド      | 型      | 必須 | 説明 |
| ---------- | ------ | -- | -- |
| type       | object | 必須 |    |
| suggestion | string | 任意 |    |

**リクエスト構造の例**

```typescript
{
  "type": 
  {
  }
  "suggestion"?: string // 任意
}
```

**リクエストのサンプル値**

```json
{
  "type": {},
  "suggestion": "サンプル文字列"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": {},
    "suggestion": "サンプル文字列"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "type": {},
    "suggestion": "サンプル文字列"
  };

axios.post("https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "type": {},
      "suggestion": "サンプル文字列"
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "type": {},
            "suggestion": "サンプル文字列"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 201**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "type": 
  {
  }
  "suggestion"?: string // 任意
  "updatedAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "type": {},
  "suggestion": "レスポンス文字列",
  "updatedAt": "レスポンス文字列"
}
```

**ステータスコード: 400 - このメッセージには既にフィードバックがあります。PATCH メソッドで更新してください**

***

### メッセージフィードバックを更新 <a href="#undefined" id="undefined"></a>

PUT `/api/messages/{messagePk}/feedback/{id}/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明                                           |
| ----------- | -- | ------ | -------------------------------------------- |
| `id`        | ✅  | string | A UUID string identifying this メッセージフィードバック. |
| `messagePk` | ✅  | string |                                              |

#### リクエスト内容

**リクエストパラメータ**

| フィールド      | 型      | 必須 | 説明 |
| ---------- | ------ | -- | -- |
| type       | object | 必須 |    |
| suggestion | string | 任意 |    |

**リクエスト構造の例**

```typescript
{
  "type": 
  {
  }
  "suggestion"?: string // 任意
}
```

**リクエストのサンプル値**

```json
{
  "type": {},
  "suggestion": "サンプル文字列"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": {},
    "suggestion": "サンプル文字列"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "type": {},
    "suggestion": "サンプル文字列"
  };

axios.put("https://api.maiagent.ai/api/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "type": {},
      "suggestion": "サンプル文字列"
    }

response = requests.put(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->put("https://api.maiagent.ai/api/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "type": {},
            "suggestion": "サンプル文字列"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "type": 
  {
  }
  "suggestion"?: string // 任意
  "updatedAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "type": {},
  "suggestion": "レスポンス文字列",
  "updatedAt": "レスポンス文字列"
}
```

***

### メッセージフィードバックを更新 <a href="#undefined" id="undefined"></a>

PUT `/api/v1/messages/{messagePk}/feedback/{id}/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明                                           |
| ----------- | -- | ------ | -------------------------------------------- |
| `id`        | ✅  | string | A UUID string identifying this メッセージフィードバック. |
| `messagePk` | ✅  | string |                                              |

#### リクエスト内容

**リクエストパラメータ**

| フィールド      | 型      | 必須 | 説明 |
| ---------- | ------ | -- | -- |
| type       | object | 必須 |    |
| suggestion | string | 任意 |    |

**リクエスト構造の例**

```typescript
{
  "type": 
  {
  }
  "suggestion"?: string // 任意
}
```

**リクエストのサンプル値**

```json
{
  "type": {},
  "suggestion": "サンプル文字列"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": {},
    "suggestion": "サンプル文字列"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "type": {},
    "suggestion": "サンプル文字列"
  };

axios.put("https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "type": {},
      "suggestion": "サンプル文字列"
    }

response = requests.put(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->put("https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "type": {},
            "suggestion": "サンプル文字列"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "type": 
  {
  }
  "suggestion"?: string // 任意
  "updatedAt": string (timestamp)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "type": {},
  "suggestion": "レスポンス文字列",
  "updatedAt": "レスポンス文字列"
}
```

***

### メッセージフィードバックを削除 <a href="#undefined" id="undefined"></a>

DELETE `/api/messages/{messagePk}/feedback/{id}/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明                                           |
| ----------- | -- | ------ | -------------------------------------------- |
| `id`        | ✅  | string | A UUID string identifying this メッセージフィードバック. |
| `messagePk` | ✅  | string |                                              |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// リクエスト内容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

| ステータスコード | 説明                           |
| -------- | ---------------------------- |
| 204      | フィードバックの削除に成功しました            |
| 400      | このフィードバックは指定されたメッセージに属していません |

***

### メッセージフィードバックを削除 <a href="#undefined" id="undefined"></a>

DELETE `/api/v1/messages/{messagePk}/feedback/{id}/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明                                           |
| ----------- | -- | ------ | -------------------------------------------- |
| `id`        | ✅  | string | A UUID string identifying this メッセージフィードバック. |
| `messagePk` | ✅  | string |                                              |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// リクエスト内容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/v1/messages/{messagePk}/feedback/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

| ステータスコード | 説明                           |
| -------- | ---------------------------- |
| 204      | フィードバックの削除に成功しました            |
| 400      | このフィードバックは指定されたメッセージに属していません |

***

### 会話記録一覧を取得 <a href="#undefined" id="undefined"></a>

GET `/api/records/`

#### パラメータ

| パラメータ名               | 必須 | 型       | 説明                                             |
| -------------------- | -- | ------- | ---------------------------------------------- |
| `chatbot`            | ❌  | string  | 特定の AI アシスタントで絞り込み (UUID)                      |
| `endDate`            | ❌  | string  | 終了日 (形式: YYYY-MM-DD、例: 2025-01-31)             |
| `keyword`            | ❌  | string  | キーワード検索 (ユーザーメッセージとボットの回答内容の両方を検索)             |
| `largeLanguageModel` | ❌  | string  | 特定の大規模言語モデルで絞り込み (UUID)                        |
| `page`               | ❌  | integer | A page number within the paginated result set. |
| `pageSize`           | ❌  | integer | Number of results to return per page.          |
| `startDate`          | ❌  | string  | 開始日 (形式: YYYY-MM-DD、例: 2025-01-01)             |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/records/?chatbot=example&endDate=example&keyword=example&largeLanguageModel=example&page=1&pageSize=1&startDate=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/records/?chatbot=example&endDate=example&keyword=example&largeLanguageModel=example&page=1&pageSize=1&startDate=example", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/records/?chatbot=example&endDate=example&keyword=example&largeLanguageModel=example&page=1&pageSize=1&startDate=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/records/?chatbot=example&endDate=example&keyword=example&largeLanguageModel=example&page=1&pageSize=1&startDate=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "count": integer
  "next"?: string (uri) // 任意
  "previous"?: string (uri) // 任意
  "results": [
    {
      "id": string (uuid)
      "senderName": string // ユーザーメッセージの送信者名を返します
      "feedback": 
      {
        "id": string (uuid)
        "type": 
        {
        }
        "suggestion"?: string // 任意
        "updatedAt": string (timestamp)
      }
      "inputMessage": string
      "condenseMessage": string // チャット履歴とコンテキストを統合し、整形したユーザーメッセージ
      "outputMessage": string
      "faithfulnessScore": number (double) // chatbot の回答がデータベースの内容に沿っているか、根拠なく創作していないかを判定します
      "displayFaithfulnessScore": integer
      "answerRelevancyScore": number (double) // chatbot の回答がユーザーの質問に関連しているかどうかを判定します
      "displayAnswerRelevancyScore": integer
      "contextPrecisionScore": number (double) // chatbot の回答が参考資料に関連しているかどうかを判定します
      "displayContextPrecisionScore": integer
      "answerCorrectnessScore": number (double) // chatbot の回答が正しいかどうかを判定します (標準解答が必要)
      "displayAnswerCorrectnessScore": integer
      "answerSimilarityScore": number (double) // chatbot の回答が標準解答に類似しているかどうかを判定します
      "displayAnswerSimilarityScore": integer
      "contextRecallScore": number (double) // chatbot の回答が参考資料から関連データを再現できているかどうかを判定します
      "displayContextRecallScore": integer
      "replyTime": string
      "createdAt": string (timestamp)
      "error": string // 実行中に発生したエラーメッセージを保存します
      "errorType": // 異なる種類が存在する可能性があります
      string (enum: system, llm, embedding, reranker, vector_db, workflow, tool, timeout, client_interrupt, evaluation, other) // エラーの発生源を区別します: システム、LLM、Embedding、Reranker など

* `system` - System
* `llm` - LLM
* `embedding` - Embedding
* `reranker` - Reranker
* `vector_db` - Vector DB
* `workflow` - Workflow
* `tool` - Tool
* `timeout` - Timeout
* `client_interrupt` - Client Interrupt
* `evaluation` - Evaluation
* `other` - Other
      "processingTime": object // 各処理段階の時間統計を返します
      "usage": object // 使用量の統計を返します。文字数と token 数を含みます
      "citationNodes": [
        {
          "id": string
          "text": string
          "chatbotFileId": string
          "fileName": string
        }
      ]
      "instructionId": string
      "llm": 
      {
        "id": string (uuid)
        "name": string
      }
      "effectiveMaxLlmOutputTokens": integer // この問答で実際に使用された max_tokens の設定値。Chatbot.custom_max_llm_output_tokens または LLM.max_tokens に由来する場合があります
      "chatbot": 
      {
        "id": string (uuid)
        "name": string
      }
      "context": string
      "conversationId": string (uuid)
      "inboxId": string (uuid)
      "botMessageId": string (uuid)
      "userMessageId": string (uuid)
      "creditCosts": [ // Return credit costs only for credit-mode organizations.
        object
      ]
    }
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "senderName": "レスポンス文字列",
      "feedback": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "type": {},
        "suggestion": "レスポンス文字列",
        "updatedAt": "レスポンス文字列"
      },
      "inputMessage": "レスポンス文字列",
      "condenseMessage": "レスポンス文字列",
      "outputMessage": "レスポンス文字列",
      "faithfulnessScore": 456,
      "displayFaithfulnessScore": 456,
      "answerRelevancyScore": 456,
      "displayAnswerRelevancyScore": 456,
      "contextPrecisionScore": 456,
      "displayContextPrecisionScore": 456,
      "answerCorrectnessScore": 456,
      "displayAnswerCorrectnessScore": 456,
      "answerSimilarityScore": 456,
      "displayAnswerSimilarityScore": 456,
      "contextRecallScore": 456,
      "displayContextRecallScore": 456,
      "replyTime": "レスポンス文字列",
      "createdAt": "レスポンス文字列",
      "error": "レスポンス文字列",
      "errorType": "system",
      "processingTime": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンスのサンプル名",
        "description": "レスポンスのサンプル説明"
      },
      "usage": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンスのサンプル名",
        "description": "レスポンスのサンプル説明"
      },
      "citationNodes": [
        {
          "id": "レスポンス文字列",
          "text": "レスポンス文字列",
          "chatbotFileId": "レスポンス文字列",
          "fileName": "レスポンス文字列"
        }
      ],
      "instructionId": "レスポンス文字列",
      "llm": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列"
      },
      "effectiveMaxLlmOutputTokens": 456,
      "chatbot": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列"
      },
      "context": "レスポンス文字列",
      "conversationId": "550e8400-e29b-41d4-a716-446655440000",
      "inboxId": "550e8400-e29b-41d4-a716-446655440000",
      "botMessageId": "550e8400-e29b-41d4-a716-446655440000",
      "userMessageId": "550e8400-e29b-41d4-a716-446655440000",
      "creditCosts": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンスのサンプル名",
          "description": "レスポンスのサンプル説明"
        }
      ]
    }
  ]
}
```

***

### 会話記録一覧を取得 <a href="#undefined" id="undefined"></a>

GET `/api/v1/records/`

#### パラメータ

| パラメータ名               | 必須 | 型       | 説明                                             |
| -------------------- | -- | ------- | ---------------------------------------------- |
| `chatbot`            | ❌  | string  | 特定の AI アシスタントで絞り込み (UUID)                      |
| `endDate`            | ❌  | string  | 終了日 (形式: YYYY-MM-DD、例: 2025-01-31)             |
| `keyword`            | ❌  | string  | キーワード検索 (ユーザーメッセージとボットの回答内容の両方を検索)             |
| `largeLanguageModel` | ❌  | string  | 特定の大規模言語モデルで絞り込み (UUID)                        |
| `page`               | ❌  | integer | A page number within the paginated result set. |
| `pageSize`           | ❌  | integer | Number of results to return per page.          |
| `startDate`          | ❌  | string  | 開始日 (形式: YYYY-MM-DD、例: 2025-01-01)             |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/records/?chatbot=example&endDate=example&keyword=example&largeLanguageModel=example&page=1&pageSize=1&startDate=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/records/?chatbot=example&endDate=example&keyword=example&largeLanguageModel=example&page=1&pageSize=1&startDate=example", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/records/?chatbot=example&endDate=example&keyword=example&largeLanguageModel=example&page=1&pageSize=1&startDate=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/records/?chatbot=example&endDate=example&keyword=example&largeLanguageModel=example&page=1&pageSize=1&startDate=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "count": integer
  "next"?: string (uri) // 任意
  "previous"?: string (uri) // 任意
  "results": [
    {
      "id": string (uuid)
      "senderName": string // ユーザーメッセージの送信者名を返します
      "feedback": 
      {
        "id": string (uuid)
        "type": 
        {
        }
        "suggestion"?: string // 任意
        "updatedAt": string (timestamp)
      }
      "inputMessage": string
      "condenseMessage": string // チャット履歴とコンテキストを統合し、整形したユーザーメッセージ
      "outputMessage": string
      "faithfulnessScore": number (double) // chatbot の回答がデータベースの内容に沿っているか、根拠なく創作していないかを判定します
      "displayFaithfulnessScore": integer
      "answerRelevancyScore": number (double) // chatbot の回答がユーザーの質問に関連しているかどうかを判定します
      "displayAnswerRelevancyScore": integer
      "contextPrecisionScore": number (double) // chatbot の回答が参考資料に関連しているかどうかを判定します
      "displayContextPrecisionScore": integer
      "answerCorrectnessScore": number (double) // chatbot の回答が正しいかどうかを判定します (標準解答が必要)
      "displayAnswerCorrectnessScore": integer
      "answerSimilarityScore": number (double) // chatbot の回答が標準解答に類似しているかどうかを判定します
      "displayAnswerSimilarityScore": integer
      "contextRecallScore": number (double) // chatbot の回答が参考資料から関連データを再現できているかどうかを判定します
      "displayContextRecallScore": integer
      "replyTime": string
      "createdAt": string (timestamp)
      "error": string // 実行中に発生したエラーメッセージを保存します
      "errorType": // 異なる種類が存在する可能性があります
      string (enum: system, llm, embedding, reranker, vector_db, workflow, tool, timeout, client_interrupt, evaluation, other) // エラーの発生源を区別します: システム、LLM、Embedding、Reranker など

* `system` - System
* `llm` - LLM
* `embedding` - Embedding
* `reranker` - Reranker
* `vector_db` - Vector DB
* `workflow` - Workflow
* `tool` - Tool
* `timeout` - Timeout
* `client_interrupt` - Client Interrupt
* `evaluation` - Evaluation
* `other` - Other
      "processingTime": object // 各処理段階の時間統計を返します
      "usage": object // 使用量の統計を返します。文字数と token 数を含みます
      "citationNodes": [
        {
          "id": string
          "text": string
          "chatbotFileId": string
          "fileName": string
        }
      ]
      "instructionId": string
      "llm": 
      {
        "id": string (uuid)
        "name": string
      }
      "effectiveMaxLlmOutputTokens": integer // この問答で実際に使用された max_tokens の設定値。Chatbot.custom_max_llm_output_tokens または LLM.max_tokens に由来する場合があります
      "chatbot": 
      {
        "id": string (uuid)
        "name": string
      }
      "context": string
      "conversationId": string (uuid)
      "inboxId": string (uuid)
      "botMessageId": string (uuid)
      "userMessageId": string (uuid)
      "creditCosts": [ // Return credit costs only for credit-mode organizations.
        object
      ]
    }
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "senderName": "レスポンス文字列",
      "feedback": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "type": {},
        "suggestion": "レスポンス文字列",
        "updatedAt": "レスポンス文字列"
      },
      "inputMessage": "レスポンス文字列",
      "condenseMessage": "レスポンス文字列",
      "outputMessage": "レスポンス文字列",
      "faithfulnessScore": 456,
      "displayFaithfulnessScore": 456,
      "answerRelevancyScore": 456,
      "displayAnswerRelevancyScore": 456,
      "contextPrecisionScore": 456,
      "displayContextPrecisionScore": 456,
      "answerCorrectnessScore": 456,
      "displayAnswerCorrectnessScore": 456,
      "answerSimilarityScore": 456,
      "displayAnswerSimilarityScore": 456,
      "contextRecallScore": 456,
      "displayContextRecallScore": 456,
      "replyTime": "レスポンス文字列",
      "createdAt": "レスポンス文字列",
      "error": "レスポンス文字列",
      "errorType": "system",
      "processingTime": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンスのサンプル名",
        "description": "レスポンスのサンプル説明"
      },
      "usage": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンスのサンプル名",
        "description": "レスポンスのサンプル説明"
      },
      "citationNodes": [
        {
          "id": "レスポンス文字列",
          "text": "レスポンス文字列",
          "chatbotFileId": "レスポンス文字列",
          "fileName": "レスポンス文字列"
        }
      ],
      "instructionId": "レスポンス文字列",
      "llm": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列"
      },
      "effectiveMaxLlmOutputTokens": 456,
      "chatbot": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "レスポンス文字列"
      },
      "context": "レスポンス文字列",
      "conversationId": "550e8400-e29b-41d4-a716-446655440000",
      "inboxId": "550e8400-e29b-41d4-a716-446655440000",
      "botMessageId": "550e8400-e29b-41d4-a716-446655440000",
      "userMessageId": "550e8400-e29b-41d4-a716-446655440000",
      "creditCosts": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "レスポンスのサンプル名",
          "description": "レスポンスのサンプル説明"
        }
      ]
    }
  ]
}
```

***

### 特定の会話記録を取得 <a href="#undefined" id="undefined"></a>

GET `/api/records/{id}/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                         |
| ------ | -- | ------ | ------------------------------------------ |
| `id`   | ✅  | string | A UUID string identifying this Chatbot 記録. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/records/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/records/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/records/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/records/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "senderName": string // ユーザーメッセージの送信者名を返します
  "feedback": 
  {
    "id": string (uuid)
    "type": 
    {
    }
    "suggestion"?: string // 任意
    "updatedAt": string (timestamp)
  }
  "inputMessage": string
  "condenseMessage": string // チャット履歴とコンテキストを統合し、整形したユーザーメッセージ
  "outputMessage": string
  "faithfulnessScore": number (double) // chatbot の回答がデータベースの内容に沿っているか、根拠なく創作していないかを判定します
  "displayFaithfulnessScore": integer
  "answerRelevancyScore": number (double) // chatbot の回答がユーザーの質問に関連しているかどうかを判定します
  "displayAnswerRelevancyScore": integer
  "contextPrecisionScore": number (double) // chatbot の回答が参考資料に関連しているかどうかを判定します
  "displayContextPrecisionScore": integer
  "answerCorrectnessScore": number (double) // chatbot の回答が正しいかどうかを判定します (標準解答が必要)
  "displayAnswerCorrectnessScore": integer
  "answerSimilarityScore": number (double) // chatbot の回答が標準解答に類似しているかどうかを判定します
  "displayAnswerSimilarityScore": integer
  "contextRecallScore": number (double) // chatbot の回答が参考資料から関連データを再現できているかどうかを判定します
  "displayContextRecallScore": integer
  "replyTime": string
  "createdAt": string (timestamp)
  "error": string // 実行中に発生したエラーメッセージを保存します
  "errorType": // 異なる種類が存在する可能性があります
  string (enum: system, llm, embedding, reranker, vector_db, workflow, tool, timeout, client_interrupt, evaluation, other) // エラーの発生源を区別します: システム、LLM、Embedding、Reranker など

* `system` - System
* `llm` - LLM
* `embedding` - Embedding
* `reranker` - Reranker
* `vector_db` - Vector DB
* `workflow` - Workflow
* `tool` - Tool
* `timeout` - Timeout
* `client_interrupt` - Client Interrupt
* `evaluation` - Evaluation
* `other` - Other
  "processingTime": object // 各処理段階の時間統計を返します
  "usage": object // 使用量の統計を返します。文字数と token 数を含みます
  "citationNodes": [
    {
      "id": string
      "text": string
      "chatbotFileId": string
      "fileName": string
    }
  ]
  "instructionId": string
  "llm": 
  {
    "id": string (uuid)
    "name": string
  }
  "effectiveMaxLlmOutputTokens": integer // この問答で実際に使用された max_tokens の設定値。Chatbot.custom_max_llm_output_tokens または LLM.max_tokens に由来する場合があります
  "chatbot": 
  {
    "id": string (uuid)
    "name": string
  }
  "context": string
  "conversationId": string (uuid)
  "inboxId": string (uuid)
  "botMessageId": string (uuid)
  "userMessageId": string (uuid)
  "creditCosts": [ // Return credit costs only for credit-mode organizations.
    object
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "senderName": "レスポンス文字列",
  "feedback": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": {},
    "suggestion": "レスポンス文字列",
    "updatedAt": "レスポンス文字列"
  },
  "inputMessage": "レスポンス文字列",
  "condenseMessage": "レスポンス文字列",
  "outputMessage": "レスポンス文字列",
  "faithfulnessScore": 456,
  "displayFaithfulnessScore": 456,
  "answerRelevancyScore": 456,
  "displayAnswerRelevancyScore": 456,
  "contextPrecisionScore": 456,
  "displayContextPrecisionScore": 456,
  "answerCorrectnessScore": 456,
  "displayAnswerCorrectnessScore": 456,
  "answerSimilarityScore": 456,
  "displayAnswerSimilarityScore": 456,
  "contextRecallScore": 456,
  "displayContextRecallScore": 456,
  "replyTime": "レスポンス文字列",
  "createdAt": "レスポンス文字列",
  "error": "レスポンス文字列",
  "errorType": "system",
  "processingTime": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "usage": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "citationNodes": [
    {
      "id": "レスポンス文字列",
      "text": "レスポンス文字列",
      "chatbotFileId": "レスポンス文字列",
      "fileName": "レスポンス文字列"
    }
  ],
  "instructionId": "レスポンス文字列",
  "llm": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "effectiveMaxLlmOutputTokens": 456,
  "chatbot": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "context": "レスポンス文字列",
  "conversationId": "550e8400-e29b-41d4-a716-446655440000",
  "inboxId": "550e8400-e29b-41d4-a716-446655440000",
  "botMessageId": "550e8400-e29b-41d4-a716-446655440000",
  "userMessageId": "550e8400-e29b-41d4-a716-446655440000",
  "creditCosts": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "レスポンスのサンプル名",
      "description": "レスポンスのサンプル説明"
    }
  ]
}
```

**ステータスコード: 404 - 指定された会話記録が見つかりません**

***

### 特定の会話記録を取得 <a href="#undefined" id="undefined"></a>

GET `/api/records/export-excel-requests/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明                                            |
| ----------- | -- | ------ | --------------------------------------------- |
| `endDate`   | ❌  | string | 終了日 (形式: YYYY-MM-DD、例: 2025-01-31)            |
| `keyword`   | ❌  | string | 特定のキーワードを含む会話記録で絞り込み (ユーザーメッセージとボットの返信の両方を検索) |
| `startDate` | ❌  | string | 開始日 (形式: YYYY-MM-DD、例: 2025-01-01)            |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/records/export-excel-requests/?endDate=example&keyword=example&startDate=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/records/export-excel-requests/?endDate=example&keyword=example&startDate=example", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/records/export-excel-requests/?endDate=example&keyword=example&startDate=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/records/export-excel-requests/?endDate=example&keyword=example&startDate=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

| ステータスコード | 説明                |
| -------- | ----------------- |
| 200      | Excel ファイルのダウンロード |

***

### 特定の会話記録を取得 <a href="#undefined" id="undefined"></a>

GET `/api/v1/records/{id}/`

#### パラメータ

| パラメータ名 | 必須 | 型      | 説明                                         |
| ------ | -- | ------ | ------------------------------------------ |
| `id`   | ✅  | string | A UUID string identifying this Chatbot 記録. |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/records/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/records/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/records/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/records/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "senderName": string // ユーザーメッセージの送信者名を返します
  "feedback": 
  {
    "id": string (uuid)
    "type": 
    {
    }
    "suggestion"?: string // 任意
    "updatedAt": string (timestamp)
  }
  "inputMessage": string
  "condenseMessage": string // チャット履歴とコンテキストを統合し、整形したユーザーメッセージ
  "outputMessage": string
  "faithfulnessScore": number (double) // chatbot の回答がデータベースの内容に沿っているか、根拠なく創作していないかを判定します
  "displayFaithfulnessScore": integer
  "answerRelevancyScore": number (double) // chatbot の回答がユーザーの質問に関連しているかどうかを判定します
  "displayAnswerRelevancyScore": integer
  "contextPrecisionScore": number (double) // chatbot の回答が参考資料に関連しているかどうかを判定します
  "displayContextPrecisionScore": integer
  "answerCorrectnessScore": number (double) // chatbot の回答が正しいかどうかを判定します (標準解答が必要)
  "displayAnswerCorrectnessScore": integer
  "answerSimilarityScore": number (double) // chatbot の回答が標準解答に類似しているかどうかを判定します
  "displayAnswerSimilarityScore": integer
  "contextRecallScore": number (double) // chatbot の回答が参考資料から関連データを再現できているかどうかを判定します
  "displayContextRecallScore": integer
  "replyTime": string
  "createdAt": string (timestamp)
  "error": string // 実行中に発生したエラーメッセージを保存します
  "errorType": // 異なる種類が存在する可能性があります
  string (enum: system, llm, embedding, reranker, vector_db, workflow, tool, timeout, client_interrupt, evaluation, other) // エラーの発生源を区別します: システム、LLM、Embedding、Reranker など

* `system` - System
* `llm` - LLM
* `embedding` - Embedding
* `reranker` - Reranker
* `vector_db` - Vector DB
* `workflow` - Workflow
* `tool` - Tool
* `timeout` - Timeout
* `client_interrupt` - Client Interrupt
* `evaluation` - Evaluation
* `other` - Other
  "processingTime": object // 各処理段階の時間統計を返します
  "usage": object // 使用量の統計を返します。文字数と token 数を含みます
  "citationNodes": [
    {
      "id": string
      "text": string
      "chatbotFileId": string
      "fileName": string
    }
  ]
  "instructionId": string
  "llm": 
  {
    "id": string (uuid)
    "name": string
  }
  "effectiveMaxLlmOutputTokens": integer // この問答で実際に使用された max_tokens の設定値。Chatbot.custom_max_llm_output_tokens または LLM.max_tokens に由来する場合があります
  "chatbot": 
  {
    "id": string (uuid)
    "name": string
  }
  "context": string
  "conversationId": string (uuid)
  "inboxId": string (uuid)
  "botMessageId": string (uuid)
  "userMessageId": string (uuid)
  "creditCosts": [ // Return credit costs only for credit-mode organizations.
    object
  ]
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "senderName": "レスポンス文字列",
  "feedback": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": {},
    "suggestion": "レスポンス文字列",
    "updatedAt": "レスポンス文字列"
  },
  "inputMessage": "レスポンス文字列",
  "condenseMessage": "レスポンス文字列",
  "outputMessage": "レスポンス文字列",
  "faithfulnessScore": 456,
  "displayFaithfulnessScore": 456,
  "answerRelevancyScore": 456,
  "displayAnswerRelevancyScore": 456,
  "contextPrecisionScore": 456,
  "displayContextPrecisionScore": 456,
  "answerCorrectnessScore": 456,
  "displayAnswerCorrectnessScore": 456,
  "answerSimilarityScore": 456,
  "displayAnswerSimilarityScore": 456,
  "contextRecallScore": 456,
  "displayContextRecallScore": 456,
  "replyTime": "レスポンス文字列",
  "createdAt": "レスポンス文字列",
  "error": "レスポンス文字列",
  "errorType": "system",
  "processingTime": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "usage": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "citationNodes": [
    {
      "id": "レスポンス文字列",
      "text": "レスポンス文字列",
      "chatbotFileId": "レスポンス文字列",
      "fileName": "レスポンス文字列"
    }
  ],
  "instructionId": "レスポンス文字列",
  "llm": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "effectiveMaxLlmOutputTokens": 456,
  "chatbot": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "context": "レスポンス文字列",
  "conversationId": "550e8400-e29b-41d4-a716-446655440000",
  "inboxId": "550e8400-e29b-41d4-a716-446655440000",
  "botMessageId": "550e8400-e29b-41d4-a716-446655440000",
  "userMessageId": "550e8400-e29b-41d4-a716-446655440000",
  "creditCosts": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "レスポンスのサンプル名",
      "description": "レスポンスのサンプル説明"
    }
  ]
}
```

**ステータスコード: 404 - 指定された会話記録が見つかりません**

***

### 特定の会話記録を取得 <a href="#undefined" id="undefined"></a>

GET `/api/v1/records/export-excel-requests/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明                                            |
| ----------- | -- | ------ | --------------------------------------------- |
| `endDate`   | ❌  | string | 終了日 (形式: YYYY-MM-DD、例: 2025-01-31)            |
| `keyword`   | ❌  | string | 特定のキーワードを含む会話記録で絞り込み (ユーザーメッセージとボットの返信の両方を検索) |
| `startDate` | ❌  | string | 開始日 (形式: YYYY-MM-DD、例: 2025-01-01)            |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/records/export-excel-requests/?endDate=example&keyword=example&startDate=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/records/export-excel-requests/?endDate=example&keyword=example&startDate=example", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/records/export-excel-requests/?endDate=example&keyword=example&startDate=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/records/export-excel-requests/?endDate=example&keyword=example&startDate=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

| ステータスコード | 説明                |
| -------- | ----------------- |
| 200      | Excel ファイルのダウンロード |

***

### 会話記録のエクスポートリクエストを作成 <a href="#undefined" id="undefined"></a>

POST `/api/records/export-excel-requests/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明                                            |
| ----------- | -- | ------ | --------------------------------------------- |
| `endDate`   | ❌  | string | 終了日 (形式: YYYY-MM-DD、例: 2025-01-31)            |
| `keyword`   | ❌  | string | 特定のキーワードを含む会話記録で絞り込み (ユーザーメッセージとボットの返信の両方を検索) |
| `startDate` | ❌  | string | 開始日 (形式: YYYY-MM-DD、例: 2025-01-01)            |

#### リクエスト内容

**リクエストパラメータ**

| フィールド              | 型             | 必須 | 説明                                                                                            |
| ------------------ | ------------- | -- | --------------------------------------------------------------------------------------------- |
| chatbot            | string        | 任意 | エクスポート対象の Chatbot UUID を指定します。カンマ区切りで複数の UUID を指定できます。空欄の場合は組織内で権限のあるすべての Chatbot をエクスポートします。 |
| chatbotId          | string (uuid) | 任意 | エクスポート対象の Chatbot UUID を指定します (chatbot のエイリアス。単一の UUID のみ対応)。                                 |
| largeLanguageModel | string        | 任意 | エクスポート対象の大規模言語モデル UUID を指定します。カンマ区切りで複数の UUID を指定できます。                                        |

**リクエスト構造の例**

```typescript
{
  "chatbot"?: string // エクスポート対象の Chatbot UUID を指定します。カンマ区切りで複数の UUID を指定できます。空欄の場合は組織内で権限のあるすべての Chatbot をエクスポートします。 (任意)
  "chatbotId"?: string (uuid) // エクスポート対象の Chatbot UUID を指定します (chatbot のエイリアス。単一の UUID のみ対応)。 (任意)
  "largeLanguageModel"?: string // エクスポート対象の大規模言語モデル UUID を指定します。カンマ区切りで複数の UUID を指定できます。 (任意)
}
```

**リクエストのサンプル値**

```json
{
  "chatbot": "サンプル文字列",
  "chatbotId": "550e8400-e29b-41d4-a716-446655440000",
  "largeLanguageModel": "サンプル文字列"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/records/export-excel-requests/?endDate=example&keyword=example&startDate=example" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "chatbot": "サンプル文字列",
    "chatbotId": "550e8400-e29b-41d4-a716-446655440000",
    "keyword": "サンプル文字列",
    "largeLanguageModel": "サンプル文字列",
    "startDate": "サンプル文字列",
    "endDate": "サンプル文字列"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "chatbot": "サンプル文字列",
    "chatbotId": "550e8400-e29b-41d4-a716-446655440000",
    "keyword": "サンプル文字列",
    "largeLanguageModel": "サンプル文字列",
    "startDate": "サンプル文字列",
    "endDate": "サンプル文字列"
  };

axios.post("https://api.maiagent.ai/api/records/export-excel-requests/?endDate=example&keyword=example&startDate=example", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/records/export-excel-requests/?endDate=example&keyword=example&startDate=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "chatbot": "サンプル文字列",
      "chatbotId": "550e8400-e29b-41d4-a716-446655440000",
      "keyword": "サンプル文字列",
      "largeLanguageModel": "サンプル文字列",
      "startDate": "サンプル文字列",
      "endDate": "サンプル文字列"
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/records/export-excel-requests/?endDate=example&keyword=example&startDate=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "chatbot": "サンプル文字列",
            "chatbotId": "550e8400-e29b-41d4-a716-446655440000",
            "keyword": "サンプル文字列",
            "largeLanguageModel": "サンプル文字列",
            "startDate": "サンプル文字列",
            "endDate": "サンプル文字列"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

| ステータスコード | 説明                |
| -------- | ----------------- |
| 200      | Excel ファイルのダウンロード |

***

### 会話記録のエクスポートリクエストを作成 <a href="#undefined" id="undefined"></a>

POST `/api/v1/records/export-excel-requests/`

#### パラメータ

| パラメータ名      | 必須 | 型      | 説明                                            |
| ----------- | -- | ------ | --------------------------------------------- |
| `endDate`   | ❌  | string | 終了日 (形式: YYYY-MM-DD、例: 2025-01-31)            |
| `keyword`   | ❌  | string | 特定のキーワードを含む会話記録で絞り込み (ユーザーメッセージとボットの返信の両方を検索) |
| `startDate` | ❌  | string | 開始日 (形式: YYYY-MM-DD、例: 2025-01-01)            |

#### リクエスト内容

**リクエストパラメータ**

| フィールド              | 型             | 必須 | 説明                                                                                            |
| ------------------ | ------------- | -- | --------------------------------------------------------------------------------------------- |
| chatbot            | string        | 任意 | エクスポート対象の Chatbot UUID を指定します。カンマ区切りで複数の UUID を指定できます。空欄の場合は組織内で権限のあるすべての Chatbot をエクスポートします。 |
| chatbotId          | string (uuid) | 任意 | エクスポート対象の Chatbot UUID を指定します (chatbot のエイリアス。単一の UUID のみ対応)。                                 |
| largeLanguageModel | string        | 任意 | エクスポート対象の大規模言語モデル UUID を指定します。カンマ区切りで複数の UUID を指定できます。                                        |

**リクエスト構造の例**

```typescript
{
  "chatbot"?: string // エクスポート対象の Chatbot UUID を指定します。カンマ区切りで複数の UUID を指定できます。空欄の場合は組織内で権限のあるすべての Chatbot をエクスポートします。 (任意)
  "chatbotId"?: string (uuid) // エクスポート対象の Chatbot UUID を指定します (chatbot のエイリアス。単一の UUID のみ対応)。 (任意)
  "largeLanguageModel"?: string // エクスポート対象の大規模言語モデル UUID を指定します。カンマ区切りで複数の UUID を指定できます。 (任意)
}
```

**リクエストのサンプル値**

```json
{
  "chatbot": "サンプル文字列",
  "chatbotId": "550e8400-e29b-41d4-a716-446655440000",
  "largeLanguageModel": "サンプル文字列"
}
```

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/records/export-excel-requests/?endDate=example&keyword=example&startDate=example" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "chatbot": "サンプル文字列",
    "chatbotId": "550e8400-e29b-41d4-a716-446655440000",
    "keyword": "サンプル文字列",
    "largeLanguageModel": "サンプル文字列",
    "startDate": "サンプル文字列",
    "endDate": "サンプル文字列"
  }'

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// リクエスト内容 (payload)
const data = {
    "chatbot": "サンプル文字列",
    "chatbotId": "550e8400-e29b-41d4-a716-446655440000",
    "keyword": "サンプル文字列",
    "largeLanguageModel": "サンプル文字列",
    "startDate": "サンプル文字列",
    "endDate": "サンプル文字列"
  };

axios.post("https://api.maiagent.ai/api/v1/records/export-excel-requests/?endDate=example&keyword=example&startDate=example", data, config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/records/export-excel-requests/?endDate=example&keyword=example&startDate=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# リクエスト内容 (payload)
data = {
      "chatbot": "サンプル文字列",
      "chatbotId": "550e8400-e29b-41d4-a716-446655440000",
      "keyword": "サンプル文字列",
      "largeLanguageModel": "サンプル文字列",
      "startDate": "サンプル文字列",
      "endDate": "サンプル文字列"
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/records/export-excel-requests/?endDate=example&keyword=example&startDate=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "chatbot": "サンプル文字列",
            "chatbotId": "550e8400-e29b-41d4-a716-446655440000",
            "keyword": "サンプル文字列",
            "largeLanguageModel": "サンプル文字列",
            "startDate": "サンプル文字列",
            "endDate": "サンプル文字列"
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

| ステータスコード | 説明                |
| -------- | ----------------- |
| 200      | Excel ファイルのダウンロード |

***

### 会話記録のエクスポート状態を取得 <a href="#undefined" id="undefined"></a>

GET `/api/records/export-excel-requests/{exportId}/`

#### パラメータ

| パラメータ名     | 必須 | 型      | 説明 |
| ---------- | -- | ------ | -- |
| `exportId` | ✅  | string |    |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/records/export-excel-requests/{exportId}/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/records/export-excel-requests/{exportId}/", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/records/export-excel-requests/{exportId}/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/records/export-excel-requests/{exportId}/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "senderName": string // ユーザーメッセージの送信者名を返します
  "inputMessage": string
  "outputMessage": string
  "chatbot": 
  {
    "id": string (uuid)
    "name": string
  }
  "condenseMessage": string // チャット履歴とコンテキストを統合し、整形したユーザーメッセージ
  "feedback": 
  {
    "id": string (uuid)
    "type": 
    {
    }
    "suggestion"?: string // 任意
    "updatedAt": string (timestamp)
  }
  "displayFaithfulnessScore": integer
  "displayAnswerRelevancyScore": integer
  "displayContextPrecisionScore": integer
  "displayAnswerCorrectnessScore": integer
  "displayAnswerSimilarityScore": integer
  "displayContextRecallScore": integer
  "replyTime": string
  "processingTime": object // フロントエンドの一覧ページで必要な処理時間統計を返します (streaming_metrics と reranker は含みません)
  "usage": object // 使用量の統計を返します。文字数と token 数を含みます
  "llm": 
  {
    "id": string (uuid)
    "name": string
  }
  "createdAt": string (timestamp)
  "conversationId": string (uuid)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "senderName": "レスポンス文字列",
  "inputMessage": "レスポンス文字列",
  "outputMessage": "レスポンス文字列",
  "chatbot": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "condenseMessage": "レスポンス文字列",
  "feedback": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": {},
    "suggestion": "レスポンス文字列",
    "updatedAt": "レスポンス文字列"
  },
  "displayFaithfulnessScore": 456,
  "displayAnswerRelevancyScore": 456,
  "displayContextPrecisionScore": 456,
  "displayAnswerCorrectnessScore": 456,
  "displayAnswerSimilarityScore": 456,
  "displayContextRecallScore": 456,
  "replyTime": "レスポンス文字列",
  "processingTime": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "usage": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "llm": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "createdAt": "レスポンス文字列",
  "conversationId": "550e8400-e29b-41d4-a716-446655440000"
}
```

***

### 会話記録のエクスポート状態を取得 <a href="#undefined" id="undefined"></a>

GET `/api/v1/records/export-excel-requests/{exportId}/`

#### パラメータ

| パラメータ名     | 必須 | 型      | 説明 |
| ---------- | -- | ------ | -- |
| `exportId` | ✅  | string |    |

#### コード例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# API 呼び出しの例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/records/export-excel-requests/{exportId}/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 実行前に YOUR_API_KEY を置き換え、リクエストデータを確認してください。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// リクエストヘッダーを設定
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/records/export-excel-requests/{exportId}/", config)
  .then(response => {
    console.log('レスポンスの取得に成功しました:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('リクエストでエラーが発生しました:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/records/export-excel-requests/{exportId}/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("レスポンスの取得に成功しました:")
    print(response.json())
except Exception as e:
    print("リクエストでエラーが発生しました:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/records/export-excel-requests/{exportId}/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "レスポンスの取得に成功しました:\n";
    print_r($data);
} catch (Exception $e) {
    echo 'リクエストでエラーが発生しました: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### レスポンス内容

**ステータスコード: 200**

**レスポンス構造の例**

```typescript
{
  "id": string (uuid)
  "senderName": string // ユーザーメッセージの送信者名を返します
  "inputMessage": string
  "outputMessage": string
  "chatbot": 
  {
    "id": string (uuid)
    "name": string
  }
  "condenseMessage": string // チャット履歴とコンテキストを統合し、整形したユーザーメッセージ
  "feedback": 
  {
    "id": string (uuid)
    "type": 
    {
    }
    "suggestion"?: string // 任意
    "updatedAt": string (timestamp)
  }
  "displayFaithfulnessScore": integer
  "displayAnswerRelevancyScore": integer
  "displayContextPrecisionScore": integer
  "displayAnswerCorrectnessScore": integer
  "displayAnswerSimilarityScore": integer
  "displayContextRecallScore": integer
  "replyTime": string
  "processingTime": object // フロントエンドの一覧ページで必要な処理時間統計を返します (streaming_metrics と reranker は含みません)
  "usage": object // 使用量の統計を返します。文字数と token 数を含みます
  "llm": 
  {
    "id": string (uuid)
    "name": string
  }
  "createdAt": string (timestamp)
  "conversationId": string (uuid)
}
```

**レスポンスのサンプル値**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "senderName": "レスポンス文字列",
  "inputMessage": "レスポンス文字列",
  "outputMessage": "レスポンス文字列",
  "chatbot": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "condenseMessage": "レスポンス文字列",
  "feedback": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "type": {},
    "suggestion": "レスポンス文字列",
    "updatedAt": "レスポンス文字列"
  },
  "displayFaithfulnessScore": 456,
  "displayAnswerRelevancyScore": 456,
  "displayContextPrecisionScore": 456,
  "displayAnswerCorrectnessScore": 456,
  "displayAnswerSimilarityScore": 456,
  "displayContextRecallScore": 456,
  "replyTime": "レスポンス文字列",
  "processingTime": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "usage": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンスのサンプル名",
    "description": "レスポンスのサンプル説明"
  },
  "llm": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "レスポンス文字列"
  },
  "createdAt": "レスポンス文字列",
  "conversationId": "550e8400-e29b-41d4-a716-446655440000"
}
```

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maiagent.ai/api/api-doc-ja/api-reference/dui-hua-he-xun-xi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
