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

# Send message

> Send additional instructions or answers to an existing task.

Send a follow-up message to a task. You can optionally set `userIntent` to update the task's intent before the new run starts, and include `files` attachments to pass additional context. Valid values are `"PLAN"` (produce a plan), `"SWE"` (implement directly), `"ASK"` (Q\&A mode), or `"DEV_ENVIRONMENT"` (dev environment setup).


## OpenAPI

````yaml /openapi.json POST /tasks/{taskIdOrSlug}/messages
openapi: 3.0.3
info:
  title: Twill API
  version: 1.0.0
  description: Programmatically create and manage Twill tasks via REST API.
servers:
  - url: https://twill.ai/api/v1
security:
  - bearerAuth: []
tags:
  - name: Tasks
    description: Create and manage tasks.
paths:
  /tasks/{taskIdOrSlug}/messages:
    post:
      tags:
        - Tasks
      summary: Send message
      description: >-
        Send a follow-up message to an existing task. Optionally override the
        task intent before starting the next run.
      operationId: sendMessage
      parameters:
        - name: taskIdOrSlug
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageRequest'
            example:
              message: Use CSS variables for the theme colors instead of inline styles
              userIntent: SWE
      responses:
        '200':
          description: Message accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessageResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '429':
          $ref: '#/components/responses/RateLimitedError'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    SendMessageRequest:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Follow-up message or instructions.
        userIntent:
          type: string
          enum:
            - SWE
            - PLAN
            - ASK
            - DEV_ENVIRONMENT
          description: Override task intent before starting the next run.
        files:
          type: array
          description: Optional file attachments provided as UI message file parts.
          items:
            $ref: '#/components/schemas/FilePart'
    SendMessageResponse:
      type: object
      required:
        - job
      properties:
        job:
          $ref: '#/components/schemas/JobSummary'
    FilePart:
      type: object
      required:
        - filename
        - mediaType
        - url
      properties:
        filename:
          type: string
          description: Original file name shown to the agent.
        mediaType:
          type: string
          description: MIME type (for example text/plain, image/png).
        url:
          type: string
          description: Publicly accessible URL for the file content.
    JobSummary:
      type: object
      required:
        - id
        - status
      properties:
        id:
          type: string
        status:
          $ref: '#/components/schemas/JobStatus'
    ApiErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
    JobStatus:
      type: string
      enum:
        - PENDING
        - IN_PROGRESS
        - COMPLETED
        - FAILED
        - CANCELLED
  responses:
    ValidationError:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          examples:
            invalidBody:
              value:
                error:
                  code: validation_error
                  message: Invalid request body
                  details:
                    issues:
                      - field: command
                        message: command is required
    UnauthorizedError:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: unauthorized
              message: Invalid or missing API key
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: not_found
              message: Task not found
    RateLimitedError:
      description: Too many requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: rate_limited
              message: Rate limit exceeded. Max 100 requests per minute.
    InternalError:
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: internal_error
              message: Server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````