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

# 生成を停止

> チャットメッセージ生成タスクを停止します。`streaming` モードでのみサポートされます。



## OpenAPI

````yaml /ja/api-reference/openapi_chat.json post /chat-messages/{task_id}/stop
openapi: 3.0.1
info:
  title: チャットアプリAPI
  description: >-
    チャットアプリケーションはセッションの永続化をサポートしており、以前のチャット履歴をレスポンスのコンテキストとして使用できます。チャットボットやカスタマーサービス
    AI などに適用できます。
  version: 1.0.0
servers:
  - url: https://{api_base_url}
    description: チャットアプリ API のベース URL です。セルフホスト環境では、独自の API ベース URL に置き換えてください。
    variables:
      api_base_url:
        default: api.dify.ai/v1
        description: API ベース URL のホストとパス（`https://` を除く）。
security:
  - ApiKeyAuth: []
tags:
  - name: チャットメッセージ
    description: チャットメッセージとインタラクションに関連する操作です。
  - name: ファイル操作
    description: ファイルのアップロードとプレビューの操作です。
  - name: エンドユーザー
    description: エンドユーザー情報に関連する操作です。
  - name: メッセージフィードバック
    description: ユーザーフィードバックの操作です。
  - name: 会話管理
    description: 会話管理に関連する操作です。
  - name: 音声・テキスト変換
    description: テキスト読み上げと音声認識の操作です。
  - name: アプリケーション設定
    description: アプリケーション設定と情報を取得する操作です。
  - name: アノテーション管理
    description: ダイレクト返信用のアノテーション管理に関連する操作です。
paths:
  /chat-messages/{task_id}/stop:
    post:
      tags:
        - チャットメッセージ
      summary: 生成を停止
      description: チャットメッセージ生成タスクを停止します。`streaming` モードでのみサポートされます。
      operationId: stopBasicChatMessageGenerationJa
      parameters:
        - name: task_id
          in: path
          required: true
          description: >-
            タスク ID です。[チャットメッセージを送信](/api-reference/チャットメッセージ/チャットメッセージを送信) API
            のストリーミングチャンクレスポンスから取得できます。
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user
              properties:
                user:
                  type: string
                  description: ユーザー識別子。メッセージ送信インターフェースで渡された user と一致する必要があります。
            examples:
              example:
                summary: リクエスト例
                value:
                  user: abc-123
      responses:
        '200':
          $ref: '#/components/responses/SuccessResult'
        '400':
          description: '`not_chat_app` : アプリモードが API ルートと一致しません。'
          content:
            application/json:
              examples:
                not_chat_app:
                  summary: not_chat_app
                  value:
                    status: 400
                    code: not_chat_app
                    message: Please check if your app mode matches the right API route.
components:
  responses:
    SuccessResult:
      description: 操作が成功しました。
      content:
        application/json:
          schema:
            type: object
            properties:
              result:
                type: string
                description: 結果ステータス。
          examples:
            success:
              summary: レスポンス例
              value:
                result: success
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: >-
        API Key 認証です。すべての API リクエストにおいて、`Authorization` HTTP ヘッダーに `Bearer `
        プレフィックスを付けた API Key を含めてください。例：`Authorization: Bearer {API_KEY}`。**API
        Key はサーバーサイドに保存し、クライアントサイドで共有・保存しないことを強く推奨します。API Key
        の漏洩は深刻な結果につながる可能性があります。**

````