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

# Update Scheduled Task

> Update a scheduled task's cron, prompt, title, or enabled state.

Update any subset of a scheduled task's fields. Set `enabled: false` to **pause** a task without
losing its config; set `enabled: true` to resume. Changes take effect immediately.

## Request Body

<ParamField body="cron" type="string">New cron expression (5-field crontab, UTC).</ParamField>
<ParamField body="prompt" type="string">New instruction.</ParamField>
<ParamField body="title" type="string">New label.</ParamField>
<ParamField body="enabled" type="boolean">Pause (`false`) or resume (`true`) without losing config.</ParamField>

## Example Request

```bash theme={"dark"}
# Pause a task
curl -X PATCH -H "x-api-key: <your-api-key>" -H "Content-Type: application/json" \
  "https://api.xpander.ai/v1/agents/<agent-id>/scheduled-tasks/<task-id>" \
  -d '{ "enabled": false }'
```

## Example Response

```json theme={"dark"}
{
  "id": "<task-id>",
  "title": "Daily ticket digest",
  "cron": "0 9 * * *",
  "prompt": "Summarize yesterday's support tickets and post to #ops.",
  "enabled": false
}
```


## OpenAPI

````yaml PATCH /v1/agents/{agent_id}/scheduled-tasks/{task_id}
openapi: 3.1.0
info:
  title: xpander.ai API Service
  description: |2-

        The xpander.ai API Service provides a unified REST API for managing AI agents,
        executing tasks, managing knowledge bases, and integrating with external systems.
        
        Features:
        - Agent Management: Create, update, deploy, and delete AI agents
        - Task Execution: Invoke agents with support for sync, async, and streaming modes
        - Knowledge Bases: Manage knowledge bases and documents for RAG workflows
        - Tools: Discover, connect, and attach tools (connectors, custom functions, MCP servers, sub-agents, workflows) to agents and workflows
        - MCP Integration: Model Context Protocol support for standardized AI interactions
        
        Authentication: All endpoints require authentication via either an API key (`x-api-key`) or an OAuth2 JWT (`Authorization: Bearer <jwt>`).
        
  version: '0.001'
servers:
  - url: https://api.xpander.ai
security: []
paths:
  /v1/agents/{agent_id}/scheduled-tasks/{task_id}:
    patch:
      tags:
        - API v1
        - Agents
        - Scheduled Tasks
      summary: Update Scheduled Task
      description: >-
        Update a scheduled task's cron, prompt, title, or enabled state. Set
        enabled=false to pause without deleting.
      operationId: >-
        Update_scheduled_task_v1_agents__agent_id__scheduled_tasks__task_id__patch
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            title: Task Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateScheduledTaskRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduledTask'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    UpdateScheduledTaskRequest:
      properties:
        cron:
          anyOf:
            - type: string
            - type: 'null'
          title: Cron
          description: New cron expression.
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
          description: New instruction.
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: New label.
        enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Enabled
          description: Pause (false) or resume (true) without losing config.
      type: object
      title: UpdateScheduledTaskRequest
      description: Update a recurring scheduled task. Only provided fields change.
    ScheduledTask:
      properties:
        id:
          type: string
          title: Id
          description: Source-node id. Pass it to update/remove/run the task.
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: Human-readable label for the task.
        cron:
          type: string
          title: Cron
          description: Cron expression (5-field crontab, UTC), e.g. '0 9 * * *'.
        prompt:
          type: string
          title: Prompt
          description: Instruction the agent runs on each fire.
        enabled:
          type: boolean
          title: Enabled
          description: >-
            Whether the task is active. Disabled tasks keep their config but do
            not fire.
          default: true
      type: object
      required:
        - id
        - cron
        - prompt
      title: ScheduledTask
      description: >-
        A recurring scheduled task — the simplified view of one cron `task`
        source node.
    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:
    APIKeyHeader:
      type: apiKey
      description: API Key for authentication
      in: header
      name: x-api-key

````