> ## 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.

# Set Self-Schedule Settings

> Enable or disable the agent's self-scheduling capability and its per-task cap.

Enable or disable whether the agent can schedule its own future runs, and optionally set the per-task
cap on chained self-schedules.

## Request Body

<ParamField body="can_self_schedule" type="boolean" required>
  Whether the agent may schedule its own future runs.
</ParamField>

<ParamField body="max_self_schedules" type="integer">
  Per-task lifetime cap on chained self-schedules. Must be between 1 and 1000.
</ParamField>

## Example Request

```bash theme={"dark"}
curl -X PUT -H "x-api-key: <your-api-key>" -H "Content-Type: application/json" \
  "https://api.xpander.ai/v1/agents/<agent-id>/self-schedules/settings" \
  -d '{ "can_self_schedule": true, "max_self_schedules": 5 }'
```

## Example Response

```json theme={"dark"}
{
  "can_self_schedule": true,
  "max_self_schedules": 5
}
```


## OpenAPI

````yaml PUT /v1/agents/{agent_id}/self-schedules/settings
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}/self-schedules/settings:
    put:
      tags:
        - API v1
        - Agents
        - Self Schedules
      summary: Set Self-Schedule Settings
      description: >-
        Enable or disable the agent's self-scheduling capability (and optionally
        its per-task cap).
      operationId: >-
        Set_self_schedule_settings_v1_agents__agent_id__self_schedules_settings_put
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SelfScheduleSettings'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SelfScheduleSettings'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    SelfScheduleSettings:
      properties:
        can_self_schedule:
          type: boolean
          title: Can Self Schedule
          description: Whether the agent may schedule its own future runs.
        max_self_schedules:
          anyOf:
            - type: integer
              maximum: 1000
              minimum: 1
            - type: 'null'
          title: Max Self Schedules
          description: Per-task lifetime cap on chained self-schedules (1-1000).
      type: object
      required:
        - can_self_schedule
      title: SelfScheduleSettings
      description: >-
        Agent-level self-schedule capability — request and response for the
        enable/disable toggle.
    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

````