> ## Documentation Index
> Fetch the complete documentation index at: https://dify-6c0370d8-docs-agent-app-service-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Stop Agent App Message Generation

> Stop a running Agent app streaming task.



## OpenAPI

````yaml /en/api-reference/openapi_agent.json post /chat-messages/{task_id}/stop
openapi: 3.0.1
info:
  title: Agent App API
  description: >-
    Agent apps expose a streaming service API for production integrations. Use
    the API key created from the Agent app API Access page. Public service API
    requests use the returned API base URL and do not include the Agent ID in
    the path; the API key identifies the backing app.
  version: 1.0.0
servers:
  - url: https://{api_base_url}
    description: >-
      Base URL of the Agent App API. Use the Service API Base URL shown in the
      Agent app API Access page. For self-hosted deployments, replace it with
      your own API base URL.
    variables:
      api_base_url:
        default: api.dify.ai/v1
        description: Host and path of the API base URL, without the `https://` prefix.
security:
  - ApiKeyAuth: []
tags:
  - name: Agent Messages
    description: Send Agent app messages and stop running tasks.
  - name: Agent Files
    description: Upload files for Agent app conversations.
  - name: Agent Conversations
    description: List Agent app conversations and conversation messages.
  - name: Agent App
    description: Retrieve Agent app parameters and metadata.
paths:
  /chat-messages/{task_id}/stop:
    post:
      tags:
        - Agent Messages
      summary: Stop Agent App Message Generation
      description: Stop a running Agent app streaming task.
      operationId: stopAgentAppMessageGeneration
      parameters:
        - name: task_id
          in: path
          required: true
          description: Task ID returned by the Send Agent App Message streaming response.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user
              properties:
                user:
                  type: string
                  description: >-
                    User identifier, must be consistent with the user passed in
                    the send message interface.
            examples:
              example:
                summary: Request Example
                value:
                  user: abc-123
      responses:
        '200':
          $ref: '#/components/responses/SuccessResult'
        '400':
          description: '`not_chat_app` : App mode does not match the API route.'
          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: Operation successful.
      content:
        application/json:
          schema:
            type: object
            properties:
              result:
                type: string
                description: Result status.
          examples:
            success:
              summary: Response Example
              value:
                result: success
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: >-
        API Key authentication. For all API requests, include your API Key in
        the `Authorization` HTTP Header, prefixed with `Bearer `. Example:
        `Authorization: Bearer {API_KEY}`. **Strongly recommend storing your API
        Key on the server-side, not shared or stored on the client-side, to
        avoid possible API-Key leakage that can lead to serious consequences.**

````