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

# Create Conversation

> Create a new agent conversation

## 创建智能体对话

**URL**: `/v1/agent/conversations`
**方法**: `POST`
**描述**: 创建一个新的智能体对话会话

### 请求参数

| 参数名                | 类型      | 必填 | 描述                                                                |
| ------------------ | ------- | -- | ----------------------------------------------------------------- |
| agent\_id          | integer | 否  | 智能体 ID（不传则使用系统默认智能体）                                              |
| title              | string  | 否  | 对话标题                                                              |
| conversation\_type | string  | 否  | 对话类型（agent\_chat, task\_chat, debug\_chat, bot\_chat）             |
| meta               | object  | 否  | 元数据                                                               |
| channel            | string  | 否  | 消息来源渠道（universal-bridge, openclaw-weixin, telegram），agent 完成后回调通知 |

### 响应参数

| 参数名         | 类型      | 描述        |
| ----------- | ------- | --------- |
| id          | integer | 对话 ID     |
| user\_id    | integer | 用户 ID     |
| agent\_id   | integer | 智能体 ID    |
| type        | string  | 对话类型      |
| title       | string  | 对话标题      |
| status      | string  | 对话状态      |
| url         | string  | 对话页面链接    |
| shared\_url | string  | 对话分享链接    |
| created\_at | integer | 创建时间戳（毫秒） |
| updated\_at | integer | 更新时间戳（毫秒） |

### 请求示例

**cURL**

```bash theme={null}
curl --request POST \
  --url https://api.reportify.cn/v1/agent/conversations \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "agent_id": 11887655289749510,
  "title": "nvidia 最新业绩分析",
  "conversation_type": "bot_chat"
}'
```

**Python**

```python theme={null}
import requests

url = "https://api.reportify.cn/v1/agent/conversations"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}
payload = {
    "agent_id": 11887655289749510,
    "title": "nvidia 最新业绩分析",
    "conversation_type": "bot_chat"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
```

### 响应示例

```json theme={null}
{
  "id": 123456789,
  "user_id": 987654321,
  "agent_id": 11887655289749510,
  "type": "agent_chat",
  "title": "nvidia 最新业绩分析",
  "status": "active",
  "url": "https://reportify.cn/agents/11887655289749510/chat/123456789",
  "shared_url": "https://reportify.cn/share/chat/11887655289749510-123456789",
  "created_at": 1765851195760,
  "updated_at": 1765851195768
}
```


## OpenAPI

````yaml POST /v1/agent/conversations
openapi: 3.1.0
info:
  title: Reportify API
  version: 1.0.0
  description: API documentation for Reportify's document management and search services.
servers:
  - url: https://api.reportify.cn
    description: Production server
security:
  - BearerAuth: []
paths:
  /v1/agent/conversations:
    post:
      tags:
        - openapi-agent
      summary: Create Conversation
      description: Create a new agent conversation
      operationId: create_conversation_reportify_api_v1_agent_conversations_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OAIAgentConversationCreateRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAIAgentConversationCreateResponse'
              example:
                id: 123456789
                user_id: 987654321
                agent_id: 11887655289749510
                type: agent_chat
                title: nvidia 最新业绩分析
                status: active
                url: https://reportify.cn/agents/11887655289749510/chat/123456789
                shared_url: https://reportify.cn/share/chat/11887655289749510-123456789
                created_at: 1765851195760
                updated_at: 1765851195768
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    OAIAgentConversationCreateRequest:
      properties:
        agent_id:
          type: integer
          title: Agent Id
          description: 智能体 ID（可选，不传则使用系统默认智能体）
          example: 11887655289749510
        title:
          type: string
          title: Title
          description: 对话标题
          example: nvidia 最新业绩分析
        conversation_type:
          type: string
          title: Conversation Type
          description: 对话类型（agent_chat, task_chat, debug_chat, bot_chat）
          example: bot_chat
        meta:
          type: object
          title: Meta
          description: 元数据
        channel:
          type: string
          title: Channel
          description: 消息来源渠道（如 feishu, wecom, web），agent 完成后会回调通知对应渠道
          example: feishu
      type: object
      title: OAIAgentConversationCreateRequest
      description: 创建 agent 对话请求
      example:
        agent_id: 11887655289749510
        title: nvidia 最新业绩分析
        conversation_type: bot_chat
    OAIAgentConversationCreateResponse:
      properties:
        id:
          type: integer
          title: Id
          description: 对话 ID
          example: 123456789
        user_id:
          type: integer
          title: User Id
          description: 用户 ID
          example: 987654321
        agent_id:
          type: integer
          title: Agent Id
          description: 智能体 ID
          example: 11887655289749510
        type:
          type: string
          title: Type
          description: 对话类型
          example: agent_chat
        title:
          type: string
          title: Title
          description: 对话标题
          example: nvidia 最新业绩分析
        status:
          type: string
          title: Status
          description: 对话状态
          example: active
        url:
          type: string
          title: Url
          description: 对话页面链接
          example: https://reportify.cn/agents/11887655289749510/chat/123456789
        shared_url:
          type: string
          title: Shared Url
          description: 对话分享链接
          example: https://reportify.cn/share/chat/11887655289749510-123456789
        created_at:
          type: integer
          title: Created At
          description: 创建时间戳（毫秒）
          example: 1765851195760
        updated_at:
          type: integer
          title: Updated At
          description: 更新时间戳（毫秒）
          example: 1765851195768
      type: object
      required:
        - id
        - user_id
        - agent_id
        - type
        - status
        - created_at
        - updated_at
      title: OAIAgentConversationCreateResponse
      description: 创建 agent 对话响应
      example:
        id: 123456789
        user_id: 987654321
        agent_id: 11887655289749510
        type: agent_chat
        title: nvidia 最新业绩分析
        status: active
        url: https://reportify.cn/agents/11887655289749510/chat/123456789
        shared_url: https://reportify.cn/share/chat/11887655289749510-123456789
        created_at: 1765851195760
        updated_at: 1765851195768
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your Bearer token

````