> ## Documentation Index
> Fetch the complete documentation index at: https://vastai-80aa3a82-auto-openapi-preview-pr-5002.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Batch Schedule Maintenances

> Schedules maintenance windows for multiple machines at once, notifying affected instance clients and sending the host a single confirmation email.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/v0/machines/maintenances/batch
openapi: 3.1.0
info:
  title: Vast.ai API
  description: >-
    Vast.ai REST API for managing GPU cloud instances, machine operations, and
    AI/ML workflows.


    ## AI Agent Quick-Start


    Install the CLI skill for your agent (Claude Code, Cursor, Windsurf, etc.):
      npx skills add vast-ai/vast-cli

    CLI reference:
    https://raw.githubusercontent.com/vast-ai/vast-cli/master/vastai/SKILL.md

    SDK reference:
    https://raw.githubusercontent.com/vast-ai/vast-cli/master/vastai_sdk/SKILL.md


    ## Auth

    All endpoints require `Authorization: Bearer $VAST_API_KEY`.

    Get your key at: https://cloud.vast.ai/manage-keys/


    ## Key Quirks

    - `gpu_ram` in CLI = GB; in REST API = MB (CLI auto-converts)

    - SSH keys must be registered BEFORE creating an instance (VM: no recovery;
    Docker: can add post-create)

    - `onstart` field is limited to 4048 characters -- gzip+base64 for longer
    scripts

    - `POST /api/v0/asks/{id}/` (create instance) returns `new_contract` as the
    instance ID, not `id`

    - Poll trap: if `actual_status` becomes `exited`, `unknown`, or `offline` it
    will never reach `running` -- destroy and retry
  version: 1.0.0
  contact:
    name: Vast.ai Support
    url: https://discord.gg/vast
  license:
    name: Vast.ai Terms of Service
    url: https://vast.ai/terms/
servers:
  - url: https://console.vast.ai
    description: Production server
security:
  - BearerAuth: []
paths:
  /api/v0/machines/maintenances/batch:
    post:
      tags:
        - Machines
      summary: Batch Schedule Maintenances
      description: >-
        Schedules maintenance windows for multiple machines at once, notifying
        affected instance clients and sending the host a single confirmation
        email.
      operationId: batchScheduleMaintenances
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                machine_ids:
                  type: array
                  description: >-
                    List of machine IDs (1–100 entries) to schedule maintenance
                    for; non-owned IDs are reported as failures.
                  example:
                    - 12345
                    - 67890
                sdate:
                  type: number
                  description: >-
                    Unix timestamp for the maintenance start time; must be in
                    the future and within 1 year.
                  example: 1718100000
                duration:
                  type: number
                  description: >-
                    Duration of the maintenance window in hours; minimum
                    effective value is 1. Defaults to 1 if omitted.
                  example: 4
                maintenance_category:
                  type: string
                  description: >-
                    Category describing the reason for maintenance. Defaults to
                    "other" if omitted.
                  example: power
                  enum:
                    - power
                    - internet
                    - disk
                    - gpu
                    - software
                    - other
      responses:
        '200':
          description: >-
            {success: true, results: [{success, machine_id, notifications_sent},
            ...]} when at least one machine was successfully scheduled.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: true if at least one machine was successfully scheduled
                  results:
                    type: array
                    description: >-
                      Per-machine outcome list, including successes, not-found,
                      and invalid entries
                    items:
                      type: object
                      properties:
                        success:
                          type: boolean
                          description: Whether this machine was scheduled
                        machine_id:
                          type: integer
                          description: Machine ID
                        notifications_sent:
                          type: integer
                          description: >-
                            Number of client notification emails sent (present
                            on success)
                        error:
                          type: string
                          description: Error code if failed (e.g. not_found)
                        msg:
                          type: string
                          description: Human-readable message if failed
              example:
                success: true
                results:
                  - success: true
                    machine_id: 1001
                    notifications_sent: 2
                  - success: false
                    machine_id: 9999
                    error: not_found
                    msg: No such machine id or not owned
        '400':
          description: >-
            "machine_ids must be a non-empty list", "machine_ids must contain at
            most 100 entries", "No valid machine_ids provided", "duration must
            be a positive number", or "maintenance_category must be one of:
            disk, gpu, internet, other, power, software" when input validation
            fails; also returned (with success:false) if no machines were owned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            "Missing sdate", "sdate must be a numeric timestamp", "sdate must be
            in the future", or "sdate must be within 1 year" when the start time
            is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
        msg:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key must be provided in the Authorization header

````