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

# Send Message

> Send a message to a running agent task. The message ID is delivered via SSE (UserMessageEvent with action=queued).



## OpenAPI

````yaml /api-reference/tasks.yaml post /tasks/{task_id}/message
openapi: 3.1.0
info:
  title: Tasks
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /tasks/{task_id}/message:
    post:
      tags:
        - Tasks
      summary: Send Message
      description: >-
        Send a message to a running agent task. The message ID is delivered via
        SSE (UserMessageEvent with action=queued).
      operationId: send_message_tasks__task_id__message_post
      parameters:
        - in: path
          name: task_id
          required: true
          schema:
            format: uuid
            title: Task Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskMessageCreate'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskMessageResponse'
          description: Successful Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedResponse'
          description: Unauthorized
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Mobilerun from '@mobilerun/sdk';


            const client = new Mobilerun({
              apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
            });


            const response = await
            client.tasks.sendMessage('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
              message: 'x',
            });


            console.log(response.sent);
        - lang: Python
          source: |-
            import os
            from mobilerun_sdk import Mobilerun

            client = Mobilerun(
                api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"),  # This is the default and can be omitted
            )
            response = client.tasks.send_message(
                task_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                message="x",
            )
            print(response.sent)
components:
  schemas:
    TaskMessageCreate:
      properties:
        message:
          description: Message to send to the running agent
          maxLength: 4000000
          minLength: 1
          title: Message
          type: string
      required:
        - message
      title: TaskMessageCreate
      type: object
    TaskMessageResponse:
      properties:
        sent:
          description: Whether the message was queued for delivery
          title: Sent
          type: boolean
      required:
        - sent
      title: TaskMessageResponse
      type: object
    ErrorResponse:
      properties:
        detail:
          description: The detail of the error
          title: Detail
          type: string
        errors:
          description: The errors
          items: {}
          title: Errors
          type: array
        status:
          description: The status code of the error
          title: Status
          type: integer
        title:
          description: The title of the error
          title: Title
          type: string
      required:
        - title
        - status
        - detail
        - errors
      title: ErrorResponse
      type: object
    UnauthorizedResponse:
      properties:
        detail:
          default: You are not authorized to access this resource
          description: The detail of the error
          title: Detail
          type: string
        errors:
          default: []
          description: The errors
          items: {}
          title: Errors
          type: array
        status:
          default: 401
          description: The status code of the error
          title: Status
          type: integer
        title:
          default: Unauthorized
          description: The title of the error
          title: Title
          type: string
      title: UnauthorizedResponse
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.