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.\n\n## AI Agent Quick-Start\n\nInstall the CLI skill for\
    \ your agent (Claude Code, Cursor, Windsurf, etc.):\n  npx skills add vast-ai/vast-cli\n\
    \nCLI reference: https://raw.githubusercontent.com/vast-ai/vast-cli/master/vastai/SKILL.md\n\
    SDK reference: https://raw.githubusercontent.com/vast-ai/vast-cli/master/vastai_sdk/SKILL.md\n\
    \n## Auth\nAll endpoints require `Authorization: Bearer $VAST_API_KEY`.\nGet your\
    \ key at: https://cloud.vast.ai/manage-keys/\n\n## Key Quirks\n- `gpu_ram` in\
    \ CLI = GB; in REST API = MB (CLI auto-converts)\n- SSH keys must be registered\
    \ BEFORE creating an instance (VM: no recovery; Docker: can add post-create)\n\
    - `onstart` field is limited to 4048 characters -- gzip+base64 for longer scripts\n\
    - `POST /api/v0/asks/{id}/` (create instance) returns `new_contract` as the instance\
    \ ID, not `id`\n- 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/instances/{id}/ssh:
    post:
      summary: attach ssh-key
      description: 'Attaches an SSH key to the specified instance, allowing SSH access
        using the provided key.


        CLI Usage: `vastai attach ssh <instance_id> <ssh_key>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: ID of the instance to attach the SSH key to
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ssh_key:
                  type: string
                  description: The SSH key to attach to the instance
                  example: ssh-rsa AAAAB3NzaC1yc2EAAA...
                  minLength: 1
      responses:
        '200':
          description: SSH key attached successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    example: SSH key attached successfully
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      tags:
      - Instances
      operationId: attachSshKey
    get:
      summary: show ssh-keys
      description: 'Retrieves the SSH keys associated with a specific instance.


        CLI Usage: `vastai show ssh-keys <instance_id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the instance to retrieve SSH keys for.
        example: 17816188
      responses:
        '200':
          description: Success response with SSH keys
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  ssh_keys:
                    type: string
                    description: JSON string containing array of SSH key objects
                    example: '[{"id": 1, "name": "my-key", "public_key": "ssh-rsa
                      AAAA..."}]'
        '400':
          description: Bad Request - Invalid instance ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Instance not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      tags:
      - Instances
      operationId: showSshKeys
  /api/v0/commands/copy_direct:
    delete:
      summary: cancel copy
      description: 'Cancel a remote copy operation specified by the destination ID
        (dst_id).


        CLI Usage: `vastai cancel copy --dst_id <destination_id>`'
      operationId: cancelRemoteRsync
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                dst_id:
                  type: string
                  description: ID of the copy instance target to cancel.
              required:
              - dst_id
      responses:
        '200':
          description: Remote copy canceled successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '400':
          description: Invalid arguments provided.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Invalid dst_id.
        '404':
          description: Destination ID not found or access denied.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: no_such_user
                  msg:
                    type: string
                    example: No such user.
      security:
      - BearerAuth: []
      x-rateLimit: 3.5
      tags:
      - Instances
    put:
      summary: copy
      description: 'Initiate a remote copy operation to transfer data from one instance
        to another or between an instance and the local machine.


        CLI Usage: `vastai copy <src_id> <dst_id> <src_path> <dst_path>`'
      operationId: initiateRemoteRsync
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                src_id:
                  type: string
                  description: ID of the source instance.
                dst_id:
                  type: string
                  description: ID of the destination instance.
                src_path:
                  type: string
                  description: Path of the source data.
                dst_path:
                  type: string
                  description: Path of the destination data.
              required:
              - src_path
              - dst_path
      responses:
        '200':
          description: Remote copy initiated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    example: Remote to Remote copy initiated - check instance status
                      bar for progress updates (~30 seconds delayed).
        '400':
          description: Invalid arguments provided.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Invalid src_path.
        '404':
          description: Source or destination ID not found or access denied.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: no_such_user
                  msg:
                    type: string
                    example: No such user.
      security:
      - BearerAuth: []
      x-rateLimit: 3.5
      tags:
      - Instances
  /api/v0/machines/{machine_id}/cancel_maint:
    put:
      summary: cancel maint
      description: 'Cancel a scheduled maintenance window for a specified machine.


        CLI Usage: `vastai cancel maint <machine_id>`'
      parameters:
      - name: machine_id
        in: path
        required: true
        description: ID of the machine to cancel maintenance for.
        schema:
          type: integer
      responses:
        '200':
          description: Maintenance window successfully canceled.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  ctime:
                    type: number
                    format: float
                    description: Current time in seconds since the epoch.
                  machine_id:
                    type: integer
                    description: ID of the machine.
                  msg:
                    type: string
                    example: deleted 1 scheduled maintenance window(s) on machine
                      1234
        '404':
          description: Machine not found or does not belong to the user.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  msg:
                    type: string
                    example: No such machine id
                  machine_id:
                    type: integer
                  user_id:
                    type: integer
      security:
      - BearerAuth: []
      tags:
      - Machines
      operationId: cancelMaint
  /api/v0/commands/rclone:
    delete:
      summary: cancel sync
      description: 'Cancels an in-progress remote sync operation identified by the
        destination instance ID.

        This operation cannot be resumed once canceled and must be restarted if needed.


        CLI Usage: `vastai cancel sync --dst_id <destination_id>`'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                dst_id:
                  type: integer
                  description: The destination instance ID of the sync operation to
                    cancel.
              required:
              - dst_id
      responses:
        '200':
          description: Sync operation canceled successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    example: Remote copy canceled - check instance status bar for
                      progress updates (~30 seconds delayed).
        '400':
          description: Invalid request due to missing or incorrect parameters.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Invalid dst_id.
        '404':
          description: Instance not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: no_such_instance
                  msg:
                    type: string
                    example: No such instance.
      tags:
      - Instances
      operationId: cancelSync
    post:
      summary: cloud copy
      description: 'Starts a cloud copy operation by sending a command to the remote
        server. The operation can transfer data between an instance and a cloud service.


        CLI Usage: `vastai cloud copy <instance_id> <src> <dst> [options]`'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instance_id:
                  type: string
                  description: ID of the instance.
                src:
                  type: string
                  description: Source path for the copy operation.
                dst:
                  type: string
                  description: Destination path for the copy operation.
                selected:
                  type: string
                  description: ID of the cloud connection.
                transfer:
                  type: string
                  description: Type of transfer (e.g., "Instance To Cloud" or "Cloud
                    To Instance").
                flags:
                  type: array
                  items:
                    type: string
                  description: Additional flags for the operation.
                api_key:
                  type: string
                  description: API key for authentication.
      responses:
        '200':
          description: Cloud copy operation initiated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  msg:
                    type: string
                  result_url:
                    type: string
        '400':
          description: Bad request due to invalid parameters or cloud service.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  msg:
                    type: string
      security:
      - BearerAuth: []
      tags:
      - Instances
      operationId: cloudCopy
  /api/v0/instances/bid_price/{id}:
    put:
      summary: change bid
      description: 'Change the current bid price of an instance to a specified price.


        CLI Usage: `vastai change bid <id> --price <price>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: Instance ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - client_id
              - price
              properties:
                client_id:
                  type: string
                  description: Client identifier (usually "me")
                  example: me
                price:
                  type: number
                  description: Bid price in $/hour
                  minimum: 0.001
                  maximum: 32.0
                  example: 0.17
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_args
                  msg:
                    type: string
                    example: Please set a bid price >= 0.001.
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - no_such_instance
                  msg:
                    type: string
                    example: Instance with that ID does not exist.
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=5.5
      tags:
      - Instances
      operationId: changeBid
  /api/v0/machines/{machine_id}/cleanup:
    put:
      summary: cleanup machine
      description: 'This endpoint removes expired contracts on a specified machine,
        freeing up space.


        CLI Usage: `vastai cleanup machine <machine_id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: machine_id
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the machine to clean up.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: An empty JSON object is expected.
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  ctime:
                    type: number
                    format: float
                    example: 1633036800.0
                  machine_id:
                    type: integer
                    example: 123
                  user_id:
                    type: integer
                    example: 456
                  num_deleted:
                    type: integer
                    example: 5
                  msg:
                    type: string
                    example: deleted 5 expired contracts on machine 123
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=8
      tags:
      - Machines
      operationId: cleanupMachine
  /api/v0/auth/apikeys:
    post:
      summary: create api-key
      description: 'Creates a new API key with specified permissions for the authenticated
        user.


        CLI Usage: `vastai create api-key --name <name> --permission_file <permissions_file>
        [--key_params <params>]`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - name
              properties:
                name:
                  type: string
                  description: Name for the API key
                  example: read-only-key
                permissions:
                  type: object
                  description: JSON object containing permission definitions
                  example:
                    read: true
                    write: false
                key_params:
                  type: object
                  description: Optional wildcard parameters for advanced keys
                  example:
                    ip_whitelist:
                    - 1.2.3.4
      responses:
        '200':
          description: API key created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: The ID of the created API key
                    example: 12345
                  key:
                    type: string
                    description: The newly generated API key
                    example: vast-123456789abcdef
                  permissions:
                    anyOf:
                    - type: boolean
                      description: False when permissions are disabled
                      example: false
                    - type: object
                      description: Object defining the permissions when enabled
                      example:
                        read: true
                        write: false
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_permissions
                    - missing_permissions
                  msg:
                    type: string
                    example: Invalid permission format
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  msg:
                    type: string
                    example: Unauthorized
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
      tags:
      - Accounts
      operationId: createApiKey
    get:
      summary: show api keys
      description: 'Retrieves all API keys associated with the authenticated user.


        CLI Usage: `vastai show api-keys`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: API keys successfully retrieved
          content:
            application/json:
              schema:
                type: object
                properties:
                  apikeys:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 123
                        user_id:
                          type: integer
                          example: 456
                        rights:
                          type: string
                          example: read
                        team_id:
                          type: integer
                          example: 789
                        team_name:
                          type: string
                          example: Team Alpha
        '400':
          description: Bad Request - API Key not provided or not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                    example: API Key not provided as bearer token.
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.0
      tags:
      - Accounts
      operationId: showApiKeys
  /api/v0/workergroups:
    post:
      summary: create workergroup
      description: 'Creates a new workergroup configuration that manages worker instances
        for a serverless endpoint.


        CLI Usage: `vastai create workergroup --template_hash <hash> --endpoint_name
        <name> [options]`'
      security:
      - BearerAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              required:
              - search_params
              properties:
                endpoint_id:
                  type: integer
                  description: ID of the endpoint this workergroup belongs to. Either
                    `endpoint_id` or `endpoint_name` is required.
                  example: 123
                endpoint_name:
                  type: string
                  description: Name of the endpoint this workergroup belongs to. Either
                    `endpoint_id` or `endpoint_name` is required. If you have no endpoint
                    with this name, one is created with default parameters.
                  example: vLLM-Qwen3-8B
                template_hash:
                  type: string
                  description: Hash ID of template to use for worker instances
                  example: abc123def456
                template_id:
                  type: integer
                  description: ID of template (alternative to template_hash)
                  example: 456
                search_params:
                  type: string
                  description: Search filters for the offers that workers are recruited
                    from, as a query string or JSON object. Combined with any search
                    filters defined by the template; where both set the same filter,
                    this value wins.
                  example: gpu_name=RTX_3090 rentable=true
                launch_args:
                  type: string
                  description: Additional launch arguments for worker instances
                  example: --env VAR=value
                gpu_ram:
                  type: number
                  description: Estimated GPU memory, in GB, that the model needs.
                    Used to estimate worker load times; to filter offers by GPU memory,
                    use `search_params`.
                  default: 8
                  exclusiveMinimum: 0
                  example: 24
      responses:
        '200':
          description: Successfully created workergroup
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  id:
                    type: integer
                    description: ID of created autoscaling job
                    example: 789
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_args
                  msg:
                    type: string
                    example: Please assign your workergroup to a valid endpoint identifier
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=4.0
      tags:
      - Serverless
      operationId: createWorkergroup
    get:
      summary: show workergroup
      description: 'Retrieves the list of workergroups associated with the authenticated
        user.


        CLI Usage: `vastai show workergroups`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 123
                        min_load:
                          type: number
                          example: 1.0
                        target_util:
                          type: number
                          example: 0.9
                        cold_mult:
                          type: number
                          example: 3.0
                        test_workers:
                          type: integer
                          example: 3
                        template_hash:
                          type: string
                          example: abc123def456
                        template_id:
                          type: integer
                          example: 456
                        search_query:
                          type: object
                          description: Parsed search parameters as JSON object
                          example: verified=true rentable=true rented=false
                        launch_args:
                          type: string
                          example: --env VAR=value
                        gpu_ram:
                          type: number
                          example: 24
                        endpoint_name:
                          type: string
                          example: my_endpoint
                        endpoint_id:
                          type: integer
                          example: 789
                        api_key:
                          type: string
                          example: your_api_key_here
                        created_at:
                          type: string
                          format: date-time
                          example: '2023-10-01T12:00:00Z'
                        user_id:
                          type: integer
                          example: 456
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  msg:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  msg:
                    type: string
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
      tags:
      - Serverless
      operationId: showWorkergroup
  /api/v0/endptjobs:
    post:
      summary: create endpoint
      description: 'This endpoint creates a new job processing endpoint with specified
        parameters.


        CLI Usage: `vastai create endpoint [options]`'
      security:
      - BearerAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                endpoint_name:
                  type: string
                  description: Name of the endpoint. Must be unique among your endpoints.
                    If omitted, a random 8-character name is generated.
                  minLength: 1
                  maxLength: 512
                  example: my_endpoint
                min_load:
                  type: number
                  description: Minimum active capacity to maintain, in load per second.
                    `0` allows the endpoint to scale to zero active workers.
                  default: 0.0
                  minimum: 0
                  example: 50.0
                min_cold_load:
                  type: number
                  description: Floor on the load used to size the total pool of active
                    and inactive workers, in load per second.
                  default: 0.0
                  minimum: 0
                  example: 0.0
                target_util:
                  type: number
                  description: Target ratio of anticipated load to active capacity.
                    Lower values keep more spare capacity.
                  default: 0.9
                  minimum: 0
                  maximum: 1
                  example: 0.75
                cold_mult:
                  type: number
                  description: Total capacity (active and inactive) to maintain, as
                    a multiple of the active capacity target.
                  default: 3.0
                  minimum: 0
                  exclusiveMaximum: 100
                  example: 2.0
                cold_workers:
                  type: integer
                  description: Minimum number of workers (active and inactive) to
                    maintain. Shown as **Minimum Workers** in the console. Must not
                    be greater than `max_workers`.
                  default: 5
                  minimum: 0
                  example: 5
                max_workers:
                  type: integer
                  description: Maximum number of workers (active and inactive) the
                    serverless engine will recruit.
                  default: 20
                  minimum: 0
                  example: 20
                max_queue_time:
                  type: number
                  description: Maximum seconds of expected queue time allowed to build
                    up on each worker before new requests wait in the endpoint queue.
                  default: 30.0
                  exclusiveMinimum: 0
                  example: 30.0
                target_queue_time:
                  type: number
                  description: Endpoint-wide queue time, in seconds, above which the
                    serverless engine scales up aggressively. Must not be greater
                    than `max_queue_time`.
                  default: 10.0
                  exclusiveMinimum: 0
                  example: 10.0
                inactivity_timeout:
                  type: number
                  description: Seconds without queued or in-progress requests after
                    which active workers are stopped down to the `min_load` floor.
                    Not set by default. Once set, it can be changed but not removed.
                  exclusiveMinimum: 0
                  example: 600
                endpoint_state:
                  type: string
                  description: Initial state of the endpoint.
                  enum:
                  - active
                  - suspended
                  - stopped
                  default: active
                  example: active
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  result:
                    type: integer
                    description: The ID of the created endpoint
                    example: 12345
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Error'
                  properties:
                    error:
                      type: string
                      enum:
                      - invalid_args
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=4.0
      tags:
      - Serverless
      operationId: createEndpoint
    get:
      summary: show endpoints
      description: 'Retrieve a list of endpoint jobs for the authenticated user.


        CLI Usage: `vastai show endpoints`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: A list of endpoint jobs
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 123
                        min_load:
                          type: number
                          example: 0.0
                        target_util:
                          type: number
                          example: 0.9
                        cold_mult:
                          type: number
                          example: 2.5
                        cold_workers:
                          type: integer
                          example: 5
                        max_workers:
                          type: integer
                          example: 20
                        endpoint_name:
                          type: string
                          example: vLLM-Qwen3-8B
                        api_key:
                          type: string
                          example: your_api_key_here
                        user_id:
                          type: integer
                          example: 456
                        created_at:
                          type: string
                          format: date-time
                          example: '2023-10-01T12:00:00Z'
                        endpoint_state:
                          type: string
                          example: active
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: No endpoints for user found
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  msg:
                    type: string
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Serverless
      operationId: showEndpoints
  /api/v0/secrets:
    post:
      summary: create env-var
      description: 'Creates a new encrypted environment variable for the authenticated
        user.

        Keys are automatically converted to uppercase. Values are encrypted before
        storage.

        There is a limit on the total number of environment variables per user.


        CLI Usage: `vastai create env-var <key> <value>`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - key
              - value
              properties:
                key:
                  type: string
                  description: Environment variable key name (will be converted to
                    uppercase)
                  example: API_TOKEN
                value:
                  type: string
                  description: Secret value to be encrypted and stored
                  pattern: ^[a-zA-Z0-9_\-\.]+$
                  example: abc123xyz
      responses:
        '200':
          description: Environment variable created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    example: Environment variable added successfully
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - missing_input
                    - max_secrets
                    - existing_key
                  msg:
                    type: string
                    example: Both 'key' and 'value' are required.
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - User is blacklisted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Accounts
      operationId: createEnvVar
    delete:
      summary: delete env var
      description: 'Deletes an environment variable associated with the authenticated
        user.

        The variable must exist and belong to the requesting user.


        CLI Usage: `vastai delete env-var <name>`'
      operationId: deleteUserSecret
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - key
              properties:
                key:
                  type: string
                  description: Name of the environment variable to delete
                  example: MY_API_KEY
      responses:
        '200':
          description: Environment variable deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '400':
          description: Bad request - missing or invalid input
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Error'
                - type: object
                  properties:
                    error:
                      type: string
                      enum:
                      - missing_input
                      - nonexistent_key
                      example: missing_input
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - User is blacklisted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too many requests - rate limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Accounts
    get:
      summary: show env vars
      description: 'Retrieve a list of environment variables (secrets) for the authenticated
        user.


        CLI Usage: `vastai show env-vars [-s]`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Success response with user secrets
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  secrets:
                    type: object
                    additionalProperties:
                      type: string
                      example: '*****'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=5.0
      tags:
      - Accounts
      operationId: showEnvVars
    put:
      summary: update env var
      description: 'Updates the value of an existing environment variable for the
        authenticated user.


        CLI Usage: `vastai update env-var <key> <value>`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - key
              - value
              properties:
                key:
                  type: string
                  description: The key of the environment variable to update (will
                    be converted to uppercase)
                  example: MY_API_KEY
                  pattern: ^[a-zA-Z_]\w*$
                value:
                  type: string
                  description: The new value for the environment variable
                  example: xyz123
      responses:
        '200':
          description: Environment variable updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    example: Environment variable updated successfully
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Error'
                properties:
                  error:
                    type: string
                    enum:
                    - missing_input
                    - empty_input
                    - input_too_long
                    - invalid_characters
                    - nonexistent_key
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Accounts
      operationId: updateEnvVar
  /api/v0/asks/{id}:
    put:
      summary: create instance
      description: 'Creates a new instance by accepting an "ask" contract from a provider.


        - Use the search offers endpoint to discover available machines.

        - If `template_id` is provided, those template defaults are either merged
        or overridden by parameters specified in the request body.


        **Template Precedence Rules:**

        - **Scalar fields** (image, disk, runtype, etc.): Request value overrides
        template value

        - **`env`**: Merged by key. Request values win on key conflicts

        - **`extra_filters`**: Merged by key. Request values win on key conflicts


        For detailed template usage, see [Creating and Using Templates with API](/api-reference/creating-and-using-templates-with-api).


        CLI Usage: `vastai create instance <offer_id> <image> [options]`'
      security:
      - BearerAuth: []
      tags:
      - Instances
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: ID of the offer to accept (ask_id)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - image
              properties:
                image:
                  type: string
                  default: vastai/base-image:@vastai-automatic-tag
                  description: 'Docker image to use for the instance.

                    '
                template_hash_id:
                  type: string
                  description: 'Content-based hash ID of a template to use as base
                    configuration. Template values are merged with or overridden by
                    request parameters (see precedence rules in endpoint description).
                    When using a template, the `image` field is optional as the template
                    provides it.


                    Example: `4e17788f74f075dd9aab7d0d4427968f`

                    '
                label:
                  type: string
                  description: Custom name for the instance
                disk:
                  type: number
                  format: float
                  description: 'Size of local disk partition (in GB)

                    '
                runtype:
                  type: string
                  description: 'Launch mode for the instance. If omitted, defaults
                    to ''ssh'' unless `args/args_str` is provided.

                    '
                  enum:
                  - ssh
                  - jupyter
                  - args
                  - ssh_proxy
                  - ssh_direct
                  - jupyter_proxy
                  - jupyter_direct
                target_state:
                  type: string
                  description: 'Desired initial state of the instance

                    '
                  enum:
                  - running
                  - stopped
                price:
                  type: number
                  description: Bid price per machine (in $/hour). Only for interruptible
                    instances
                  minimum: 0.001
                  maximum: 128.0
                env:
                  type: string
                  description: 'Environment variables and port mappings in Docker
                    flag format. When using a template, request `env` is merged with
                    template `env` - existing keys are retained, new keys are appended,
                    conflicting keys use the request value.


                    Example: `"-e HF_TOKEN=hf_xxx123456789 -e MODEL_ID=TheBloke/Llama-2-7B-Chat-GPTQ
                    -p 8000:8000"`

                    '
                cancel_unavail:
                  type: boolean
                  description: Whether to cancel if instance cannot start immediately.
                    Defaults to false for interruptibles. Defaults to true for on-demand
                    with target_state='running'
                vm:
                  type: boolean
                  description: Whether this is a VM instance
                onstart:
                  type: string
                  description: "Commands to run when instance starts\n\nExample :\
                    \ `env | grep _ >> /etc/environment; echo 'starting up'` \n"
                args:
                  type: array
                  items:
                    type: string
                  description: 'Arguments array to passed to the image entrypoint


                    Example : `["bash", "-c", "env | grep _ >> /etc/environment; echo
                    ''starting up''"]`

                    '
                args_str:
                  type: string
                  description: 'Arguments string to pass to the entrypoint (alternative
                    to args)


                    Example : `args_str: bash -c "env | grep _ >> /etc/environment;
                    echo ''starting up''"`

                    '
                use_jupyter_lab:
                  type: boolean
                  description: Launch instance with jupyter lab instead of notebook
                jupyter_dir:
                  type: string
                  description: 'Directory to launch Jupyter from


                    Example : `/home/notebooks`

                    '
                python_utf8:
                  type: boolean
                  description: Set python's locale to C.UTF-8
                lang_utf8:
                  type: boolean
                  description: Set locale to C.UTF-8
                force:
                  type: boolean
                  description: Skip sanity checks when creating from an existing instance
                user:
                  type: string
                  description: User to use with docker create (breaks some images,
                    use with caution)
                image_login:
                  type: string
                  description: Docker registry credentials if needed
                volume_info:
                  type: object
                  description: Volume creation/linking information
                  properties:
                    create_new:
                      type: boolean
                      description: Set to `true` to create a new volume, `false` to
                        link an existing volume
                    volume_id:
                      type: integer
                      description: 'If `create_new` is false: existing volume ID (from
                        `show volumes`). If `create_new` is true: volume offer ID
                        (from `search volumes`)

                        '
                    size:
                      type: integer
                      description: Size of the volume in GB. Only used when `create_new`
                        is true
                    mount_path:
                      type: string
                      description: Mount path for the volume inside the container
                        (e.g., `/workspace`)
            example:
              image: vastai/base-image:@vastai-automatic-tag
      responses:
        '200':
          description: Instance created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: If the instance was created successfully
                    example: true
                  new_contract:
                    type: integer
                    description: ID of the newly created instance contract
                    example: 1234568
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_args
                    - invalid_price
                    - no_ssh_key_for_vm
                  msg:
                    type: string
                    example: 'error 400/3467: Invalid args: ''id'' is required and
                      must be a valid offer ID'
                  ask_id:
                    type: integer
                    example: 1234567
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: 'error 403/3586: Offer 1234567 is not your own. Hosts
                      can only rent their own machines.'
                  ask_id:
                    type: integer
                    example: 1234567
        '404':
          description: Offer not found or not available
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: 'error 404/3603: no_such_ask Instance type by id 1234567
                      is not available.'
                  ask_id:
                    type: integer
                    example: 1234567
        '410':
          description: Offer no longer available (when cancel_unavail is true and
            instance cannot start)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: no_such_ask
                  msg:
                    type: string
                    example: 'error 410/3907: no_such_ask Instance type 1234567 is
                      no longer available.'
                  ask_id:
                    type: integer
                    example: 1234567
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=4.5
      operationId: createInstance
  /api/v0/ssh:
    post:
      summary: create ssh-key
      description: 'Creates a new SSH key and associates it with your account.

        The key will be automatically added to all your current instances.


        CLI Usage: `vastai create ssh-key <ssh_key>`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - ssh_key
              properties:
                ssh_key:
                  type: string
                  description: The public SSH key to add (from .pub file)
                  example: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...
      responses:
        '200':
          description: SSH key created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  key:
                    type: object
                    properties:
                      id:
                        type: integer
                        description: The ID of the created SSH key
                        example: 123
                      user_id:
                        type: integer
                        description: The user ID who owns the key
                        example: 456
                      public_key:
                        type: string
                        description: The public SSH key content
                        example: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...
                      created_at:
                        type: string
                        format: date-time
                        example: '2023-01-01T12:00:00Z'
                      deleted_at:
                        type:
                        - string
                        - 'null'
                        format: date-time
                        example: null
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - no_ssh_key
                  msg:
                    type: string
                    example: No ssh key provided
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.0
      tags:
      - Accounts
      operationId: createSshKey
    get:
      summary: show ssh keys
      description: 'Retrieve a list of SSH keys associated with the authenticated
        user''s account.


        CLI Usage: `vastai show ssh-keys`'
      operationId: getSshKeysUser
      parameters:
      - name: Authorization
        in: header
        required: true
        description: Bearer token for user authentication.
        schema:
          type: string
      responses:
        '200':
          description: A list of SSH keys.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: The unique identifier of the SSH key.
                    user_id:
                      type: integer
                      description: The ID of the user to whom the SSH key belongs.
                    key:
                      type: string
                      description: The SSH public key.
                    created_at:
                      type: string
                      format: date-time
                      description: The timestamp when the SSH key was created.
                    deleted_at:
                      type:
                      - string
                      - 'null'
                      format: date-time
                      description: The timestamp when the SSH key was deleted, if
                        applicable.
        '401':
          description: Unauthorized access due to invalid or missing authentication
            token.
        '404':
          description: No SSH keys found for the user.
      security:
      - BearerAuth: []
      tags:
      - Accounts
  /api/v0/users:
    post:
      summary: create subaccount
      description: 'Creates either a standalone user account or a subaccount under
        a parent account. Subaccounts can be restricted to host-only functionality.


        CLI Usage: `vastai create subaccount --email <email> --username <username>
        --password <password> [--type host]`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - email
              - username
              - password
              properties:
                email:
                  type: string
                  description: User's email address
                  maxLength: 64
                  example: user@example.com
                  pattern: ^(?!.*@vast)[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
                username:
                  type: string
                  description: Desired username
                  maxLength: 64
                  example: testuser123
                password:
                  type: string
                  description: Account password
                  maxLength: 256
                  example: securepass123
                host_only:
                  type: boolean
                  description: If true, account is restricted to host functionality
                    only
                  example: true
                parent_id:
                  type: string
                  description: Parent account ID for subaccounts. Use "me" for current
                    user.
                  example: me
                ssh_key:
                  type: string
                  description: Optional SSH public key
                  maxLength: 4096
                captcha:
                  type: string
                  description: Captcha token (required for non-subaccounts)
                  maxLength: 8192
      responses:
        '200':
          description: Account created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: User ID
                  username:
                    type: string
                  email:
                    type: string
                  key_id:
                    type: integer
                    description: API key for the new account
                example:
                  id: 12345
                  username: testuser
                  email: user@example.com
                  key_id: 67890
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                    - invalid_email
                    - invalid_request
                    - missing_auth_value
                  msg:
                    type: string
                example:
                  error: invalid_email
                  msg: Email address not allowed
        '403':
          description: Forbidden - billing blacklisted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: User already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                    - user_exists
                  msg:
                    type: string
                example:
                  error: user_exists
                  msg: user already exists.
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Accounts
      operationId: createSubaccount
    put:
      summary: set user
      description: 'Updates the user data for the authenticated user.


        CLI Usage: `vastai set user --file <file_path>`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                normalized_email:
                  type: string
                  description: Normalized email address.
                  example: user@example.com
                username:
                  type: string
                  description: Username of the user.
                  example: johndoe
                fullname:
                  type: string
                  description: Full name of the user.
                  example: John Doe
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Error'
                properties:
                  error:
                    type: string
                    enum:
                    - missing_input
                    - empty_input
                    - input_too_long
                    - invalid_characters
                    - nonexistent_key
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=5.0
      tags:
      - Accounts
      operationId: setUser
  /api/v0/team:
    post:
      summary: create team
      description: 'Creates a new [team](https://docs.vast.ai/documentation/teams/teams-overview)
        with given name and following default roles:

        - **Owner**: Full access to all team resources, settings, and member management.
        The team owner is the user who creates the team.

        - **Manager**: All permissions of owner except team deletion.

        - **Member**: Can view, create, and interact with instances, but cannot access
        billing, team management, autoscaler, or machines.


        - The API key used to create the team becomes the team key and is used for
        all team operations (e.g., creating roles, deleting the team).

        - You can optionally transfer credits from your personal account to the new
        team account using the `transfer_credit` field.


        CLI Usage: `vastai create team --team_name <team_name> [--transfer_credit
        <amount>]`'
      security:
      - BearerAuth: []
      tags:
      - Team
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - team_name
              properties:
                team_name:
                  type: string
                  example: my-awesome-team
                transfer_credit:
                  type: number
                  format: float
                  description: Credits to transfer from personal account to team
                  example: 0
      responses:
        '200':
          description: Team Successfully Created!
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    example: Team Successfully Created!
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  msg:
                    type: string
                    example: Team name already exists
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: auth_error
                  msg:
                    type: string
                    example: Invalid user key
      operationId: createTeam
    delete:
      summary: destroy team
      description: 'Deletes a team and all associated data including API keys, rights,
        invitations, memberships and metadata. The team owner''s master API key is
        converted to a normal client key.


        CLI Usage: `vastai destroy team`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Team successfully deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    example: Team Successfully Deleted!
                  pkey_id:
                    type: integer
                    description: ID of the user's team API key which was converted
                      back to a client key.
                    example: 12345
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: auth_error
                msg: Invalid user key
        '403':
          description: Forbidden - Only the Team's Owner may delete the team
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: not_allowed
                msg: Only the Team's Owner may delete the team
        '404':
          description: Not Found - Team does not exist or user is not a team account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                not_a_team:
                  summary: User is not a team account
                  value:
                    success: false
                    error: not_found
                    msg: Cannot Delete Team. User is not a team account
                owner_not_found:
                  summary: Team owner not found
                  value:
                    success: false
                    error: not_found
                    msg: Team owner not found
      tags:
      - Team
      operationId: destroyTeam
  /api/v0/team/roles:
    post:
      summary: create team role
      description: 'Creates a new role within a team. Only team owners or managers
        with the appropriate permissions can perform this operation.


        CLI Usage: `vastai create team role --name <role_name> --permissions <permissions_json>`'
      security:
      - BearerAuth: []
      tags:
      - Team
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - name
              - permissions
              properties:
                name:
                  type: string
                  description: Name for the new role
                  example: developer
                permissions:
                  type: object
                  description: JSON object containing permission definitions
                  properties:
                    api:
                      type: object
                      description: API permissions
                      allOf:
                      - title: User Read
                        type: object
                        properties:
                          user_read:
                            type: object
                            description: Permission to read user info
                            default: {}
                          instance_write:
                            type: object
                            description: Permission to write instances
                            default: {}
      responses:
        '200':
          description: Role created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                    example: success
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  msg:
                    type: string
                    example: Missing permissions parameter
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - User lacks permission
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: createTeamRole
  /api/v0/template:
    post:
      summary: create template
      description: 'Creates a new template for launching instances.


        Templates store default configuration values that can be used when creating
        instances. When an instance is created with a template reference, template
        values serve as defaults that can be overridden by request parameters.


        For detailed usage, see [Creating and Using Templates with API](/api-reference/creating-and-using-templates-with-api).


        CLI Usage: `vastai create template --name <name> --image <image> [options]`'
      tags:
      - Templates
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - name
              - image
              properties:
                name:
                  type: string
                  default: Example Template
                  description: Name of the template
                image:
                  type: string
                  default: vastai/base-image
                  description: Docker image path. Used when launching instances from
                    this template.
                tag:
                  type: string
                  default: latest
                  description: 'Docker image tag specifying version of the image.
                    Defaults to `latest`. Can also be included in the `image` field
                    instead.

                    '
                env:
                  type: string
                  description: 'Environment variables and port mappings in Docker
                    flag format.


                    Example: `"-e HF_TOKEN=hf_xxx123456789 -e MODEL_ID=TheBloke/Llama-2-7B-Chat-GPTQ
                    -p 8000:8000"`

                    '
                onstart:
                  type: string
                  description: "Commands to run when instance starts\n\nExample :\
                    \ `env | grep _ >> /etc/environment; echo 'starting up'` \n"
                runtype:
                  type: string
                  enum:
                  - ssh
                  - jupyter
                  - args
                  default: args
                  description: 'Launch mode for the instance. Defaults to `args`.
                    Recommended - use `ssh` with `ssh_direct: true` for reliable SSH
                    access.

                    '
                ssh_direct:
                  type: boolean
                  description: Enable direct SSH connection
                jup_direct:
                  type: boolean
                  description: Enable direct Jupyter connection
                jupyter_dir:
                  type: string
                  description: 'Directory to launch Jupyter from


                    Example : `/home/notebooks`

                    '
                use_jupyter_lab:
                  type: boolean
                  description: Use JupyterLab instead of Jupyter Notebook
                docker_login_repo:
                  type: string
                  description: Name of the private Docker repo (i.e docker.io)
                docker_login_user:
                  type: string
                  description: Username for private Docker repo
                docker_login_pass:
                  type: string
                  description: Access token or password for private Docker repo.
                extra_filters:
                  type: object
                  description: 'Additional machine search filters. Example: `{"cuda_max_good":
                    {"gte": 12.6}}`

                    '
                recommended_disk_space:
                  type: number
                  description: Recommended disk space in GB. Defaults to 8GB if not
                    specified.
                desc:
                  type: string
                  description: Short description of the template
                readme:
                  type: string
                  description: Longer documentation/readme content for the template
                args_str:
                  type: string
                  description: Arguments string passed to the container entrypoint
                    when runtype is `args`
                use_ssh:
                  type: boolean
                  description: Enable SSH access to instances created from this template
                href:
                  type: string
                  description: Link to Docker Hub or image documentation
                repo:
                  type: string
                  description: Repository identifier (e.g., `library/ubuntu`)
                private:
                  type: boolean
                  description: Whether the template is private (not publicly searchable)
                volume_info:
                  type:
                  - object
                  - 'null'
                  description: 'UI hint for volume configuration. Note: This does
                    not affect instance creation - use `volume_info` in the instance
                    creation request to actually attach volumes.

                    '
                hash_id:
                  type: string
                  description: Content-based hash ID of the template. Can be included
                    when editing but will change based on new content.
            example:
              name: Example Template
              image: vastai/base-image
              tag: latest
              env: -e MY_VAR=value -p 8000:8000
              runtype: ssh
              ssh_direct: true
      responses:
        '200':
          description: Template created or existing template found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether operation was successful
                  msg:
                    type: string
                    description: Status message
                    example: 'Template Created Successfully! New Template ID: 123456'
                  template:
                    type: object
                    description: Template details
                    properties:
                      name:
                        type: string
                        description: Template name
                      id:
                        type: integer
                        description: Template ID
                      hash_id:
                        type: string
                        description: Template hash identifier
        '400':
          description: Bad request - invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Template name is required
        '429':
          description: Rate limit exceeded
        '401':
          description: Unauthorized - invalid or missing API key
      operationId: createTemplate
    delete:
      summary: delete template
      description: 'Deletes an existing template.


        Pass the template''s numeric `id` (not `hash_id`) in the request body.


        For detailed usage, see [Creating and Using Templates with API](/api-reference/creating-and-using-templates-with-api).


        CLI Usage: `vastai delete template --template-id <id>`'
      tags:
      - Templates
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - template_id
              properties:
                template_id:
                  type: integer
                  description: Numeric ID of the template to delete (not hash_id)
            example:
              template_id: 334548
      responses:
        '200':
          description: Template deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '401':
          description: Unauthorized - invalid or missing API key
        '404':
          description: Template not found
      operationId: deleteTemplate
    get:
      summary: search templates
      description: 'Searches for templates using filter-based queries.


        Use `select_filters` to search by specific field conditions. Results include
        both your own templates and publicly shared templates.


        **Available filter fields:** `creator_id`, `created_at`, `count_created`,
        `default_tag`, `docker_login_repo`, `id`, `image`, `jup_direct`, `hash_id`,
        `name`, `recent_create_date`, `recommended_disk_space`, `recommended`, `ssh_direct`,
        `tag`, `use_ssh`


        **Operators:** `eq`, `neq`, `lt`, `lte`, `gt`, `gte`, `in`, `notin`


        For detailed usage, see [Creating and Using Templates with API](/api-reference/creating-and-using-templates-with-api).


        CLI Usage: `vastai search templates`'
      parameters:
      - name: select_filters
        in: query
        required: false
        schema:
          type: string
        description: 'JSON-encoded filter object. Format: `{"field": {"op": value}}`.
          Example: `{"use_ssh": {"eq": true}, "recommended": {"eq": true}}` or `{"count_created":
          {"gt": 100}}`

          '
      - name: select_cols
        in: query
        required: false
        schema:
          type: string
        description: 'JSON-encoded array of columns to return. Example: `["*"]` for
          all columns or `["id", "name", "hash_id"]` for specific columns.

          '
      - name: order_by
        in: query
        required: false
        schema:
          type: string
        description: Column to order the results by.
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Successfully retrieved templates
          content:
            application/json:
              schema:
                type: object
                required:
                - success
                - templates_found
                - templates
                properties:
                  success:
                    type: boolean
                    example: true
                  templates_found:
                    type: integer
                    description: Number of templates found.
                    example: 5
                  templates:
                    type: array
                    description: List of templates matching the search criteria.
                    items:
                      $ref: '#/components/schemas/Template'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Search
      operationId: searchTemplates
  /api/v0/auth/apikeys/{id}:
    delete:
      summary: delete api key
      description: 'Deletes an existing API key belonging to the authenticated user.

        The API key is soft-deleted by setting a deleted_at timestamp.


        CLI Usage: `vastai delete api-key <id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        description: ID of the API key to delete
        schema:
          type: integer
          minimum: 1
        example: 123
      responses:
        '200':
          description: API key successfully deleted
          content:
            application/json:
              schema:
                type: string
                example: Successfully Deleted API Key
        '400':
          description: Bad Request - API key ID not provided
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                    example: API Key ID not provided.
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - API key belongs to a different user
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                    example: You do not have permission to delete this API Key.
        '404':
          description: Not Found - API key does not exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                    example: API Key not found.
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
      tags:
      - Accounts
      operationId: deleteApiKey
  /api/v0/workergroups/{id}:
    delete:
      summary: delete workergroup
      description: 'Deletes an existing workergroup.


        CLI Usage: `vastai delete workergroup <id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        description: ID of the workergroup to delete
        schema:
          type: integer
          example: 4242
      responses:
        '200':
          description: Workergroup deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  deleted_workers:
                    type: array
                    description: List of worker instances that were deleted
                    items:
                      type: integer
                    example:
                    - 1001
                    - 1002
                  failed_workers:
                    type: array
                    description: List of worker instances that failed to delete
                    items:
                      type: integer
                    example: []
                  msg:
                    type: string
                    description: Additional information about the deletion
                    example: Deleted workergroup and 2 workers
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Invalid autojob ID
        '404':
          description: Workergroup not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: no_such_workergroup
                  msg:
                    type: string
                    example: No workergroup by that id is available.
                  id:
                    type: integer
                    example: 4242
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  msg:
                    type: string
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Serverless
      operationId: deleteWorkergroup
    put:
      summary: update workergroup
      description: 'Updates the properties of an existing workergroup based on the
        provided parameters. Fields you omit are left unchanged.


        CLI Usage: `vastai update workergroup <id> [options]`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        description: The ID of the workergroup to update.
        schema:
          type: integer
          example: 4242
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              required:
              - endpoint_id
              properties:
                endpoint_id:
                  type: integer
                  description: ID of the endpoint the workergroup belongs to.
                  example: 123
                template_hash:
                  type: string
                  description: Template hash for the workergroup.
                  example: abc123def456
                template_id:
                  type: integer
                  description: Template ID for the workergroup.
                  example: 456
                search_params:
                  type: string
                  description: Search filters for offers, as a query string or JSON
                    object. Merged into the workergroup's current filters; where both
                    set the same filter, this value wins.
                  example: gpu_name=RTX_3090 rentable=true
                launch_args:
                  type: string
                  description: Launch arguments for creating instances.
                  example: --env VAR=value
                gpu_ram:
                  type: number
                  description: Estimated GPU memory, in GB, that the model needs.
                    Used to estimate worker load times.
                  example: 24
      responses:
        '200':
          description: Successfully updated the workergroup.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Workgroup not found for user
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  msg:
                    type: string
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
      tags:
      - Serverless
      operationId: updateWorkergroup
  /api/v0/endptjobs/{id}:
    delete:
      summary: delete endpoint
      description: 'Deletes an endpoint group by ID. Associated workergroups will
        also be deleted.


        CLI Usage: `vastai delete endpoint <id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        description: ID of the endpoint group to delete
        schema:
          type: integer
          example: 4242
      responses:
        '200':
          description: Endpoint group successfully deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  deleted_workers:
                    type: array
                    description: List of worker instances that were deleted (if any)
                    items:
                      type: integer
                    example:
                    - 1001
                    - 1002
                  failed_workers:
                    type: array
                    description: List of worker instances that failed to delete (if
                      any)
                    items:
                      type: integer
                    example: []
                  msg:
                    type: string
                    description: Additional information about the deletion
                    example: Deleted endpoint job and 2 workers
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Routegroup not found for user
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  msg:
                    type: string
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Serverless
      operationId: deleteEndpoint
    put:
      summary: update endpoint
      description: 'Updates the specified endpoint group with the provided parameters.
        Fields you omit are left unchanged. For what each parameter controls, see
        [Endpoint Parameters](/guides/serverless/serverless-parameters).


        CLI Usage: `vastai update endpoint <id> [options]`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        description: ID of the endpoint group to update
        schema:
          type: integer
          example: 4242
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                min_load:
                  type: number
                  description: Minimum floor load in perf units/s (token/s for LLMs)
                  example: 0.0
                target_util:
                  type: number
                  description: Target capacity utilization (fraction, max 1.0)
                  example: 0.9
                cold_mult:
                  type: number
                  description: Cold/stopped instance capacity target as multiple of
                    hot capacity target
                  example: 2.5
                cold_workers:
                  type: integer
                  description: Min number of workers to keep 'cold' when you have
                    no load
                  example: 5
                max_workers:
                  type: integer
                  description: Max number of workers your endpoint group can have
                  example: 20
                min_cold_load:
                  type: number
                  description: Floor on the load used to size the total pool of active
                    and inactive workers, in load per second
                  minimum: 0
                  example: 0.0
                max_queue_time:
                  type: number
                  description: Maximum seconds of expected queue time allowed to build
                    up on each worker
                  exclusiveMinimum: 0
                  example: 30.0
                target_queue_time:
                  type: number
                  description: Endpoint-wide queue time, in seconds, above which the
                    serverless engine scales up aggressively
                  exclusiveMinimum: 0
                  example: 10.0
                inactivity_timeout:
                  type: number
                  description: Seconds without queued or in-progress requests after
                    which active workers are stopped down to the `min_load` floor.
                    Can be changed but not removed once set.
                  exclusiveMinimum: 0
                  example: 600
                endpoint_state:
                  type: string
                  description: Set to `suspended` or `stopped` to pause the serverless
                    engine, or `active` to resume it. See [Pricing](/guides/serverless/pricing)
                    for how each state is billed.
                  enum:
                  - active
                  - suspended
                  - stopped
                  example: active
                endpoint_name:
                  type: string
                  description: Deployment endpoint name
                  example: my_endpoint
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Endpointgroup not found for user
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  msg:
                    type: string
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
      tags:
      - Serverless
      operationId: updateEndpoint
  /api/v0/ssh/{id}:
    delete:
      summary: delete ssh key
      description: 'Removes an SSH key from the authenticated user''s account


        CLI Usage: `vastai delete ssh-key <id>`'
      operationId: deleteSshKey
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        description: ID of the SSH key to delete
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: SSH key successfully deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                required:
                - success
              example:
                success: true
        '400':
          description: Invalid request or SSH key not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: no_ssh_key
                  msg:
                    type: string
                    example: No ssh key provided
                required:
                - success
                - error
                - msg
              examples:
                not_found:
                  value:
                    success: false
                    error: no_ssh_key
                    msg: No ssh key provided
                invalid:
                  value:
                    success: false
                    error: invalid_request
                    msg: Invalid request parameters
      tags:
      - Accounts
    put:
      summary: update ssh key
      description: 'Updates the specified SSH key with the provided value.


        CLI Usage: `vastai update ssh-key <id> <ssh_key>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: ID of the SSH key to update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - ssh_key
              properties:
                ssh_key:
                  type: string
                  description: The new value for the SSH key
                  example: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3...
      responses:
        '200':
          description: SSH key updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  key:
                    type: object
                    description: The updated SSH key data
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.0
      tags:
      - Accounts
      operationId: updateSshKey
  /api/v0/volumes:
    delete:
      summary: delete volume
      description: 'Delete a volume by its ID.


        CLI Usage: `vastai delete volume <volume_id>`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: integer
                  description: ID of the volume to delete
                  example: 100
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_args
                  msg:
                    type: string
                    example: Please provide a valid volume ID.
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - no_such_volume
                  msg:
                    type: string
                    example: Volume with that ID does not exist.
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=5.5
      tags:
      - Volumes
      operationId: deleteVolume
    put:
      summary: rent volume
      description: 'Rent/create a new volume with specified parameters.


        CLI Usage: `vastai create volume <id> --size <size_gb>`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: integer
                  description: ID for the volume
                  example: 420
                size:
                  type: integer
                  description: Size in GB (Defaults to 15)
                  example: 15
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  volume_name:
                    type: string
                    description: Name of the created/resized volume
                    example: V.20118481
      tags:
      - Volumes
      operationId: rentVolume
    get:
      summary: list volumes
      description: 'Retrieve information about all volumes rented by you.


        CLI Usage: `vastai show volumes`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  volumes:
                    type: array
                    items:
                      $ref: '#/components/schemas/Volume'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: Authentication credentials were not provided.
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=5.5
      tags:
      - Volumes
      operationId: listVolumes
  /api/v0/instances/{id}:
    delete:
      summary: destroy instance
      description: 'Destroys/deletes an instance permanently. This is irreversible
        and will delete all data.


        CLI Usage: `vastai destroy instance <id>`'
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: integer
        description: ID of the instance to destroy
        example: 4242
      responses:
        '200':
          description: Instance destroyed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                    description: Whether the destruction was successful
                  msg:
                    type: string
                    description: Optional status message
                    example: Instance destroyed successfully
        '400':
          description: Bad request - invalid instance ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: invalid instance_id
        '404':
          description: Instance not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: not_found
                  msg:
                    type: string
                    example: Instance not found
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: rate_limit_exceeded
                  msg:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      security:
      - BearerAuth: []
      tags:
      - Instances
      operationId: destroyInstance
    put:
      summary: manage instance
      description: 'Manage instance state and labels. The operation is determined
        by the request body parameters.


        CLI Usage:

        - To stop: `vastai stop instance <id>`

        - To start: `vastai start instance <id>`

        - To label: `vastai label instance <id> <label>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: ID of the instance to modify
        example: 1234
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: At least one of these parameters should be provided
              properties:
                state:
                  type: string
                  description: Change instance state (optional)
                  enum:
                  - stopped
                  - running
                  example: stopped
                label:
                  type: string
                  description: Text label to assign to the instance (optional)
                  maxLength: 1024
                  example: My ML Training Job
      responses:
        '200':
          description: Operation completed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleBooleanSuccessResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.0
      tags:
      - Instances
      operationId: manageInstance
    get:
      summary: show instance
      description: 'Retrieves the details of a specific instance for the authenticated
        user.


        CLI Usage: `vastai show instance [--api-key <api_key>] [--raw]`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        description: The instance (contract) ID to retrieve.
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: Success response with instance details.
          content:
            application/json:
              schema:
                type: object
                properties:
                  instances:
                    $ref: '#/components/schemas/Instance'
        '400':
          description: "Bad Request \u2013 Invalid instance ID or invalid arguments."
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: "Unauthorized \u2013 Invalid or missing authentication."
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: auth_error
                msg: Invalid user key
        '429':
          description: "Too Many Requests \u2013 API requests are too frequent."
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
      tags:
      - Instances
      operationId: showInstance
  /api/v0/instances/{id}/ssh/{ssh_key_id}:
    delete:
      summary: detach ssh-key
      description: 'Detaches an SSH key from a specified instance, removing SSH access
        for that key.


        CLI Usage: `vastai detach <instance_id> <ssh_key_id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        description: ID of the instance to detach the SSH key from
        schema:
          type: integer
          example: 99999
      - name: ssh_key_id
        in: path
        required: true
        description: 'Numeric ID of the SSH key to detach. Obtainable via `show ssh-keys`
          command

          '
        schema:
          type: integer
          example: 12345
      responses:
        '200':
          description: SSH key successfully detached
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    example: SSH key removed from instance.
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_request
                  msg:
                    type: string
                    example: Invalid request parameters
        '404':
          description: Instance or SSH key not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - no_such_instance
                    - no_such_ssh_key
                  msg:
                    type: string
                    example: Instance not found.
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: delete_ssh_from_instance
                  msg:
                    type: string
                    example: Error deleting SSH key from instance
      tags:
      - Instances
      operationId: detachSshKey
  /api/v1/template:
    put:
      summary: edit template
      description: 'Edits an existing template by creating a new version of it.


        Template versions are immutable. Send the template''s numeric `id` and its
        current `hash_id` together with the full set of fields the new version should
        have; fields you leave out are not carried over from the previous version.
        The response contains the new version with a new numeric `id` and a new content-based
        `hash_id`. The previous version keeps its `id` and `hash_id`, so running instances
        and shared links that reference it stay valid.


        If the template was created by someone else, the new version is created as
        your own copy. If the body hashes to the same `hash_id` as the current version,
        nothing is created and the response reports that no edits were made.


        If a read returned `********` for `docker_login_user` or `docker_login_pass`,
        sending that placeholder back keeps the stored credential. Only the template''s
        creator can do this.


        `PUT /api/v0/template/` is deprecated and returns `410 Gone`. Use this endpoint
        instead.


        For detailed usage, see [Creating and Using Templates with API](/api-reference/creating-and-using-templates-with-api).


        CLI Usage: `vastai update template <hash_id> [options]`'
      tags:
      - Templates
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - id
              - hash_id
              properties:
                id:
                  type: integer
                  description: Numeric ID of the template version to edit. Must be
                    the version identified by `hash_id`.
                hash_id:
                  type: string
                  description: Current hash ID of the template version to edit.
                name:
                  type: string
                  description: Name of the template
                image:
                  type: string
                  description: Docker image path
                tag:
                  type: string
                  description: Docker image tag. Can also be included in the `image`
                    field instead.
                env:
                  type: string
                  description: 'Environment variables and port mappings in Docker
                    flag format.


                    Example: `"-e HF_TOKEN=hf_xxx123456789 -p 8000:8000"`

                    '
                onstart:
                  type: string
                  description: Commands to run when the instance starts
                runtype:
                  type: string
                  enum:
                  - ssh
                  - jupyter
                  - args
                  description: Launch mode for instances created from this template
                ssh_direct:
                  type: boolean
                  description: Enable direct SSH connection
                use_ssh:
                  type: boolean
                  description: Enable SSH access to instances created from this template
                jup_direct:
                  type: boolean
                  description: Enable direct Jupyter connection
                jupyter_dir:
                  type: string
                  description: Directory to launch Jupyter from
                use_jupyter_lab:
                  type: boolean
                  description: Use JupyterLab instead of Jupyter Notebook
                docker_login_repo:
                  type: string
                  description: Name of the private Docker repo (i.e docker.io)
                docker_login_user:
                  type: string
                  description: Username for private Docker repo
                docker_login_pass:
                  type: string
                  description: Access token or password for private Docker repo
                extra_filters:
                  type: object
                  description: 'Additional machine search filters. Example: `{"cuda_max_good":
                    {"gte": 12.6}}`

                    '
                recommended_disk_space:
                  type: number
                  description: Recommended disk space in GB
                desc:
                  type: string
                  description: Short description of the template
                readme:
                  type: string
                  description: Longer documentation/readme content for the template
                args_str:
                  type: string
                  description: Arguments string passed to the container entrypoint
                    when runtype is `args`
                href:
                  type: string
                  description: Link to Docker Hub or image documentation
                repo:
                  type: string
                  description: Repository identifier (e.g., `library/ubuntu`)
                private:
                  type: boolean
                  description: Whether the template is private (not publicly searchable)
                volume_info:
                  type:
                  - object
                  - 'null'
                  description: UI hint for volume configuration
              additionalProperties: true
            example:
              id: 123456
              hash_id: 5915f1dc1ce881defb572015eb9d8178
              name: Example Template
              desc: Updated description
              image: vastai/base-image
              tag: latest
              env: -e MY_VAR=value -p 8000:8000
              runtype: ssh
              ssh_direct: true
              use_ssh: true
              docker_login_repo: ''
              docker_login_user: ''
              docker_login_pass: ''
              recommended_disk_space: 16
              private: true
      responses:
        '200':
          description: New template version created, or no edits were needed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the operation was successful
                  msg:
                    type: string
                    description: Status message
                    example: 'Created an Edited Copy of Template 123456. New Template
                      ID: 123457'
                  template:
                    type: object
                    description: The new template version
                    properties:
                      id:
                        type: integer
                        description: Numeric ID of the new version
                      hash_id:
                        type: string
                        description: Content-based hash ID of the new version
        '400':
          description: Bad request - missing `id` or `hash_id`, or invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Template ID is required for update
        '401':
          description: Unauthorized - invalid or missing API key
        '404':
          description: Template not found - no template has this `id` and `hash_id`,
            or it was deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_template
                  msg:
                    type: string
                    example: 'error 404: Template not found'
        '429':
          description: Rate limit exceeded
      operationId: editTemplate
  /api/v0/instances/command/{id}:
    put:
      summary: execute
      description: 'Executes a constrained remote command on a specified instance.

        The command output can be retrieved from the returned result URL.


        CLI Usage: `vastai execute <instance_id> <command>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        description: ID of the instance to execute command on
        schema:
          type: integer
          example: 12345
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - command
              properties:
                command:
                  type: string
                  description: Command to execute on the instance
                  example: ls -l
                  maxLength: 512
      responses:
        '200':
          description: Command queued successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  writeable_path:
                    type: string
                    description: Container writeable path
                    example: /workspace
                  result_url:
                    type: string
                    description: URL to fetch command execution results
                    example: https://s3.amazonaws.com/vast.ai/instance_logs/abc123.log
                  msg:
                    type: string
                    example: Command is executing, wait a few seconds and then view
                      the result_url
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_args
                    - invalid_container_id
                    - invalid_container
                  msg:
                    type: string
                    example: Invalid command given.
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - User is blacklisted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.5
        '483':
          description: Invalid JSON body
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Invalid json_body
      tags:
      - Instances
      operationId: execute
  /get_workergroup_logs:
    post:
      servers:
      - url: https://run.vast.ai
        description: Production server
      summary: get workergroup logs
      description: 'Retrieves logs for a specific workergroup by ID.


        The response contains one string per log level. Each level keeps up to about
        16 MB of recent history; use `tail` to choose how much of it to return.


        CLI Usage: `vastai get wrkgrp-logs <id> [--level <0-3>] [--tail <bytes>]`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: integer
                  description: ID of the workergroup
                  default: 12345
                  example: 12345
                  minimum: 1
                tail:
                  type: integer
                  description: Number of bytes to return from the end of each log
                  default: 10000
                  example: 100000
                  minimum: 1
      responses:
        '200':
          description: Logs successfully retrieved.
          content:
            application/json:
              schema:
                oneOf:
                - title: Success - Logs Retrieved
                  type: object
                  properties:
                    info0:
                      type: string
                      description: User log, shown as **User** in the console. Worker
                        creation, starts, stops, state changes with their reasons,
                        worker errors, and PyWorker stack traces.
                      example: 'Worker 67890: model_loading -> idle (received loadtime)

                        '
                    info1:
                      type: string
                      description: Info-level engine log, shown as **Info** in the
                        console. Includes the user log plus additional scaling details.
                    debug:
                      type: string
                      description: Debug-level engine log
                    trace:
                      type: string
                      description: Trace-level engine log, the most detailed level
                - title: Error Response
                  type: object
                  properties:
                    error_msg:
                      type: string
                      description: Returned when the workergroup does not exist or
                        the API key does not own it
                      example: autogroup 12345 not found or unauthorized
      tags:
      - Serverless
      operationId: getWorkergroupLogs
  /get_workergroup_workers:
    post:
      servers:
      - url: https://run.vast.ai
        description: Production server
      summary: get workergroup workers
      description: 'Retrieves the current list and status of workers for a specific
        workergroup.

        Useful for monitoring, debugging connectivity issues, and understanding resource
        usage within a workergroup.


        The response is a JSON object containing a `workers` array with one object
        per worker. To receive the same data as a push stream instead of polling,
        see [Streaming Worker Status](/guides/serverless/worker-status-websocket).'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: integer
                  description: ID of the workergroup to monitor
                  default: 12345
                  example: 12345
                  minimum: 1
      responses:
        '200':
          description: Workers successfully retrieved.
          content:
            application/json:
              schema:
                oneOf:
                - title: Success - Workers Retrieved
                  type: object
                  properties:
                    workers:
                      type: array
                      description: List of workers in this workergroup
                      items:
                        type: object
                        properties:
                          id:
                            type: integer
                            description: Worker instance ID
                            example: 67890
                          gpu_name:
                            type: string
                            description: GPU model of the worker's machine
                            example: RTX 4090
                          num_gpus:
                            type: integer
                            description: Number of GPUs allocated to the worker
                            example: 1
                          perf:
                            type: number
                            description: Performance (load per second) the serverless
                              engine expects from this worker when planning capacity.
                              Unavailable and Offline workers count for a fraction
                              of their full performance, and workers that are in Error
                              or being destroyed count for `0`.
                            example: 812.4
                          measured_perf:
                            type: number
                            description: Performance (load per second) measured on
                              this worker. Reported as `0` until the worker has been
                              ready at least once (`ready_ever`).
                            example: 830.1
                          reliability:
                            type: number
                            description: Share of routed requests that the worker
                              has completed, from 0 to 1. Reset to 1 each time the
                              worker starts.
                            example: 0.98
                          dlperf:
                            type: number
                            description: DLPerf score of the worker's machine
                            example: 105.6
                          cur_perf:
                            type: number
                            description: Current throughput of the worker, in load
                              per second
                            example: 640.2
                          new_load:
                            type: number
                            description: Load assigned to the worker since its last
                              status report
                            example: 0
                          cur_load:
                            type: number
                            description: Load currently assigned to the worker that
                              has not completed yet
                            example: 1500
                          cur_load_rolling_avg:
                            type: number
                            description: Smoothed load per second handled by the worker
                            example: 580.7
                          reqs_working:
                            type: integer
                            description: Number of requests currently assigned to
                              the worker
                            example: 3
                          loaded_at:
                            type: number
                            description: Unix timestamp (seconds) when the worker
                              became ready after its most recent start, or `0` if
                              it is not ready yet
                            example: 1760000000.0
                          ready_ever:
                            type: boolean
                            description: Whether the worker has been ready at least
                              once since it was created or since its last template
                              update
                            example: true
                          started_at:
                            type: number
                            description: Unix timestamp (seconds) when the worker
                              was last started
                            example: 1759999700.0
                          disk_usage:
                            type: number
                            description: Disk space used by the worker's model, as
                              reported by the worker
                            example: 16.2
                          status:
                            type: string
                            description: Current worker state. See [Worker States](/guides/serverless/worker-states).
                            enum:
                            - pending
                            - creating
                            - created
                            - loading
                            - model_loading
                            - idle
                            - starting
                            - stopping
                            - stopped
                            - rebooting
                            - unavail
                            - offline
                            - error
                            - destroying
                            - update_ready
                            - update_rebooting
                            - update_starting
                            - unknown
                            example: idle
                          available:
                            type: boolean
                            description: Whether the worker's machine can currently
                              run it. An inactive worker whose GPUs are rented by
                              someone else reports `false`.
                            example: true
                          outdated:
                            type: boolean
                            description: Whether the worker is running an older PyWorker
                              version than the latest stable release
                            example: false
                          hidden:
                            type: boolean
                            description: Whether the worker is a replacement that
                              is still being prepared. Hidden workers do not receive
                              requests.
                            example: false
                          contract_end_date:
                            type: number
                            description: Unix timestamp (seconds) when the worker's
                              rental contract ends, or `0` if it has no end date
                            example: 0
                          replaces_worker_id:
                            type: integer
                            description: ID of the worker this worker is replacing
                              before its contract ends, or `0` if it is not a replacement
                            example: 0
                    active_update:
                      type: boolean
                      description: Whether a rolling update of the workergroup's workers
                        is in progress
                      example: false
                - title: Error Response
                  type: object
                  properties:
                    error_msg:
                      type: string
                      description: Returned when the workergroup does not exist or
                        the API key does not own it
                      example: autogroup 12345 not found or unauthorized
      tags:
      - Serverless
      operationId: getWorkergroupWorkers
  /get_endpoint_logs:
    post:
      servers:
      - url: https://run.vast.ai
        description: Production server
      summary: get endpoint logs
      description: 'Retrieves logs for a specific endpoint, identified by ID or by
        name.


        The response contains one string per log level. Each level keeps up to about
        16 MB of recent history; use `tail` to choose how much of it to return.


        CLI Usage: `vastai get endpt-logs <id> [--level <0-3>] [--tail <bytes>]`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  description: ID of the endpoint. Either `id` or `endpoint` is required.
                  example: 12345
                  minimum: 1
                endpoint:
                  type: string
                  description: Name of the endpoint. Either `id` or `endpoint` is
                    required.
                  example: vLLM-Qwen3-8B
                tail:
                  type: integer
                  description: Number of bytes to return from the end of each log
                  default: 10000
                  example: 100000
                  minimum: 1
      responses:
        '200':
          description: Successfully retrieved endpoint logs.
          content:
            application/json:
              schema:
                oneOf:
                - title: Success - Logs Retrieved
                  type: object
                  properties:
                    info0:
                      type: string
                      description: User log, shown as **User** in the console. Worker
                        creation, starts, stops, state changes with their reasons,
                        worker errors, and PyWorker stack traces.
                      example: 'Worker 67890: model_loading -> idle (received loadtime)

                        '
                    info1:
                      type: string
                      description: Info-level engine log, shown as **Info** in the
                        console. Includes the user log plus additional scaling details.
                    debug:
                      type: string
                      description: Debug-level engine log
                    trace:
                      type: string
                      description: Trace-level engine log, the most detailed level
                - title: Error Response
                  type: object
                  properties:
                    error_msg:
                      type: string
                      description: Returned when the endpoint does not exist or the
                        API key does not own it
                      example: endpoint 12345 does not exist or unauthorized
      tags:
      - Serverless
      operationId: getEndpointLogs
  /get_endpoint_workers:
    post:
      servers:
      - url: https://run.vast.ai
        description: Production server
      summary: get endpoint workers
      description: 'Retrieves the current list and status of workers for a specific
        endpoint.

        Useful for monitoring, debugging connectivity issues, and understanding resource
        usage.


        The response is a JSON array with one object per worker. To receive the same
        data as a push stream instead of polling, see [Streaming Worker Status](/guides/serverless/worker-status-websocket).


        CLI Usage: `vastai get endpt-workers <id>`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: integer
                  description: ID of the endpoint to monitor
                  default: 12345
                  example: 12345
                  minimum: 1
      responses:
        '200':
          description: Successfully retrieved endpoint workers.
          content:
            application/json:
              schema:
                oneOf:
                - title: Success - Workers Retrieved
                  type: array
                  description: List of workers for this endpoint
                  items:
                    type: object
                    properties:
                      id:
                        type: integer
                        description: Worker instance ID
                        example: 67890
                      gpu_name:
                        type: string
                        description: GPU model of the worker's machine
                        example: RTX 4090
                      num_gpus:
                        type: integer
                        description: Number of GPUs allocated to the worker
                        example: 1
                      perf:
                        type: number
                        description: Performance (load per second) the serverless
                          engine expects from this worker when planning capacity.
                          Unavailable and Offline workers count for a fraction of
                          their full performance, and workers that are in Error or
                          being destroyed count for `0`.
                        example: 812.4
                      measured_perf:
                        type: number
                        description: Performance (load per second) measured on this
                          worker
                        example: 830.1
                      reliability:
                        type: number
                        description: Share of routed requests that the worker has
                          completed, from 0 to 1. Reset to 1 each time the worker
                          starts.
                        example: 0.98
                      dlperf:
                        type: number
                        description: DLPerf score of the worker's machine
                        example: 105.6
                      cur_perf:
                        type: number
                        description: Current throughput of the worker, in load per
                          second
                        example: 640.2
                      new_load:
                        type: number
                        description: Load assigned to the worker since its last status
                          report
                        example: 0
                      cur_load:
                        type: number
                        description: Load currently assigned to the worker that has
                          not completed yet
                        example: 1500
                      cur_load_rolling_avg:
                        type: number
                        description: Smoothed load per second handled by the worker
                        example: 580.7
                      reqs_working:
                        type: integer
                        description: Number of requests currently assigned to the
                          worker
                        example: 3
                      loaded_at:
                        type: number
                        description: Unix timestamp (seconds) when the worker became
                          ready after its most recent start, or `0` if it is not ready
                          yet
                        example: 1760000000.0
                      ready_ever:
                        type: boolean
                        description: Whether the worker has been ready at least once
                          since it was created or since its last template update
                        example: true
                      started_at:
                        type: number
                        description: Unix timestamp (seconds) when the worker was
                          last started
                        example: 1759999700.0
                      disk_usage:
                        type: number
                        description: Disk space used by the worker's model, as reported
                          by the worker
                        example: 16.2
                      status:
                        type: string
                        description: Current worker state. See [Worker States](/guides/serverless/worker-states).
                        enum:
                        - pending
                        - creating
                        - created
                        - loading
                        - model_loading
                        - idle
                        - starting
                        - stopping
                        - stopped
                        - rebooting
                        - unavail
                        - offline
                        - error
                        - destroying
                        - update_ready
                        - update_rebooting
                        - update_starting
                        - unknown
                        example: idle
                      available:
                        type: boolean
                        description: Whether the worker's machine can currently run
                          it. An inactive worker whose GPUs are rented by someone
                          else reports `false`.
                        example: true
                      outdated:
                        type: boolean
                        description: Whether the worker is running an older PyWorker
                          version than the latest stable release
                        example: false
                      hidden:
                        type: boolean
                        description: Whether the worker is a replacement that is still
                          being prepared. Hidden workers do not receive requests.
                        example: false
                      contract_end_date:
                        type: number
                        description: Unix timestamp (seconds) when the worker's rental
                          contract ends, or `0` if it has no end date
                        example: 0
                      replaces_worker_id:
                        type: integer
                        description: ID of the worker this worker is replacing before
                          its contract ends, or `0` if it is not a replacement
                        example: 0
                - title: Error Response
                  type: object
                  properties:
                    error_msg:
                      type: string
                      description: Returned when the endpoint does not exist or the
                        API key does not own it
                      example: endpoint 12345 not found or unauthorized
      tags:
      - Serverless
      operationId: getEndpointWorkers
  /api/v0/team/invite:
    post:
      summary: invite team member
      description: 'Sends an invitation email to the specified user to join the team
        with the given role.


        CLI Usage: `vastai invite team-member --email <email> --role <role>`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - email
              - role
              properties:
                email:
                  type: string
                  description: Email address of the user to invite
                  format: email
                  example: user@example.com
                role:
                  type: string
                  description: Role to assign to the new team member
                  example: developer
      responses:
        '200':
          description: Invitation sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    example: New invitation sent to ${email}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                    enum:
                    - User is a not a team member
                    - User cannot be invited to their own team.
                    - User is already a member of this team.
        '403':
          description: Forbidden - User not authenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Team metadata not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                    example: Team metadata not found
        '429':
          description: Too Many Requests - Duplicate invitation
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                    example: 'Error: invitation already sent to user@example.com only
                      300 seconds ago.'
      tags:
      - Team
      operationId: inviteTeamMember
  /api/v0/machines/create_asks:
    put:
      summary: list machine
      description: 'Creates or updates ask contracts for a machine to list it for
        rent on the vast.ai platform.

        Allows setting pricing, minimum GPU requirements, end date and discount rates.


        CLI Usage: `vastai list machine <machine_id> [options]`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - machine
              properties:
                machine:
                  type: integer
                  description: ID of the machine to list
                price_gpu:
                  type: number
                  format: float
                  description: Price per GPU per hour
                price_disk:
                  type: number
                  format: float
                  description: Price per GB of disk storage
                price_inetu:
                  type: number
                  format: float
                  description: Price per GB of upload bandwidth
                price_inetd:
                  type: number
                  format: float
                  description: Price per GB of download bandwidth
                price_min_bid:
                  type: number
                  format: float
                  description: Minimum bid price allowed
                min_chunk:
                  type: integer
                  description: Minimum number of GPUs that must be rented together
                  default: 1
                end_date:
                  type: number
                  format: float
                  description: Unix timestamp for when the listing expires
                credit_discount_max:
                  type: number
                  format: float
                  description: Maximum discount rate allowed for prepaid credits
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  extended:
                    type: integer
                    description: Number of client contracts extended to new end date
                  msg:
                    type: string
                    description: Status message if success is false
                example:
                  success: true
                  extended: 2
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: invalid_args
                  msg:
                    type: string
                    example: Invalid machine id or parameters
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: not_authorized
                  msg:
                    type: string
                    example: Only machine owner can create ask contracts
      tags:
      - Machines
      operationId: listMachine
  /api/v0/instances/request_logs/{id}:
    put:
      summary: show logs
      description: 'Request logs from a specific instance. The logs will be uploaded
        to S3 and can be retrieved from a generated URL. Supports both container logs
        and daemon system logs.


        CLI Usage: `vastai show logs <instance_id> [--tail <lines>] [--filter <grep>]
        [--daemon-logs]`'
      parameters:
      - name: id
        in: path
        required: true
        description: ID of the instance to get logs from
        schema:
          type: integer
      security:
      - BearerAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                tail:
                  type: string
                  description: Number of lines to show from end of logs
                  example: '1000'
                filter:
                  type: string
                  description: Grep filter to apply to log entries
                daemon_logs:
                  type: string
                  enum:
                  - 'true'
                  description: If "true", fetch daemon system logs instead of container
                    logs
      responses:
        '200':
          description: Success response with S3 URL for log retrieval
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  result_url:
                    type: string
                    description: S3 URL where logs can be downloaded
                    example: https://s3.amazonaws.com/vast.ai/instance_logs/{hash}.log
                  msg:
                    type: string
                    description: Status message
        '404':
          description: Instance not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: invalid_id
                  msg:
                    type: string
                    example: Invalid instance id.
        '403':
          description: Not authorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: not_authorized
                  msg:
                    type: string
                    example: Not authorized to view logs for this instance
      tags:
      - Instances
      operationId: showLogs
  /api/v0/metrics/gpu/current:
    get:
      summary: show gpu metrics
      description: 'Returns a current snapshot of supply, demand, and pricing across
        all GPU types on the Vast marketplace. Use filters to narrow results to verified
        or datacenter machines.


        CLI Usage: `vastai metrics gpu [options]`'
      security:
      - BearerAuth: []
      parameters:
      - name: verified
        in: query
        required: false
        description: Filter by verification status
        schema:
          type: string
          enum:
          - 'yes'
          - 'no'
          - all
          default: 'yes'
      - name: hosting_type
        in: query
        required: false
        description: Filter by hosting type
        schema:
          type: string
          enum:
          - all
          - secure_cloud
          - community
          default: all
      - name: num_gpus
        in: query
        required: false
        description: GPU count bucket or "all" for true population
        schema:
          type: string
          default: all
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  gpus:
                    type: array
                    items:
                      type: object
                      properties:
                        gpu_name:
                          type: string
                          example: RTX 4090
                        total:
                          type: integer
                          description: Total number of machines
                        available:
                          type: integer
                          description: Available machines
                        rented_verified:
                          type: integer
                          description: Rented verified machines
                        avail_verified:
                          type: integer
                          description: Available verified machines
                        rented_unverified:
                          type: integer
                          description: Rented unverified machines
                        avail_unverified:
                          type: integer
                          description: Available unverified machines
                        usage:
                          type: number
                          description: Current utilization percentage
                        usage_30d:
                          type: number
                          description: 30-day average utilization percentage
                        dlperf:
                          type: number
                          description: Deep learning performance score
                        tflops:
                          type: number
                          description: GPU TFLOPS rating
                        price_p10:
                          type: number
                          description: 10th percentile price per GPU per hour
                        price_p25:
                          type: number
                          description: 25th percentile price
                        price_median:
                          type: number
                          description: Median price per GPU per hour
                        price_p75:
                          type: number
                          description: 75th percentile price
                        price_p90:
                          type: number
                          description: 90th percentile price
                        tflops_per_dollar:
                          type: number
                          description: TFLOPS per dollar
                        dlperf_per_dollar:
                          type: number
                          description: Deep learning performance per dollar
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Machines
      operationId: showGpuMetrics
  /api/v0/metrics/gpu/locations:
    get:
      summary: show gpu locations
      description: 'Returns the geographic distribution of GPUs across the Vast marketplace.
        The CLI supports client-side filtering by GPU type, verification, datacenter,
        and rental status.


        CLI Usage: `vastai metrics gpu-locations [options]`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  locations:
                    type: array
                    items:
                      type: object
                      properties:
                        latitude:
                          type: number
                          example: 37.7749
                        longitude:
                          type: number
                          example: -122.4194
                        city:
                          type: string
                          example: San Francisco
                        country_code:
                          type: string
                          example: US
                        gpu_name:
                          type: string
                          example: RTX 4090
                        rented:
                          type: boolean
                        verified:
                          type: boolean
                        datacenter:
                          type: boolean
                        num_gpus:
                          type: integer
                          example: 4
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Machines
      operationId: showGpuLocations
  /api/v0/metrics/gpu/history:
    get:
      summary: show gpu trends
      description: 'Returns time-series data for GPU supply, demand, and pricing.
        By default queries the last 24 hours and returns a sampled set of roughly
        20 data points. Use start/end/step for custom time ranges.


        CLI Usage: `vastai metrics gpu-trends [GPU_NAMES] [options]`'
      security:
      - BearerAuth: []
      parameters:
      - name: gpu_name
        in: query
        required: false
        description: Comma-separated GPU names (e.g. "RTX 4090, H100_SXM") or "all".
          Defaults to RTX 5090, 4090, and 3090.
        schema:
          type: string
          example: RTX 4090
      - name: verified
        in: query
        required: false
        description: Filter by verification status
        schema:
          type: string
          enum:
          - 'yes'
          - 'no'
          - all
          default: 'yes'
      - name: hosting_type
        in: query
        required: false
        description: Filter by hosting type
        schema:
          type: string
          enum:
          - all
          - secure_cloud
          - community
          default: all
      - name: num_gpus
        in: query
        required: false
        description: GPU count bucket or "all"
        schema:
          type: string
          default: all
      - name: start
        in: query
        required: false
        description: Unix timestamp for range start
        schema:
          type: integer
      - name: end
        in: query
        required: false
        description: Unix timestamp for range end
        schema:
          type: integer
      - name: step
        in: query
        required: false
        description: Seconds between data points (e.g. 3600 for hourly)
        schema:
          type: integer
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  gpus:
                    type: object
                    description: Keyed by GPU name
                    additionalProperties:
                      type: object
                      properties:
                        supply_demand:
                          type: object
                          description: Time-series arrays of supply and demand counts
                          properties:
                            timestamps:
                              type: array
                              items:
                                type: integer
                              example:
                              - 1779736460
                              - 1779736632
                            rented_verified:
                              type: array
                              items:
                                type: integer
                              example:
                              - 3789
                              - 3756
                            avail_verified:
                              type: array
                              items:
                                type: integer
                              example:
                              - 165
                              - 200
                            rented_unverified:
                              type: array
                              items:
                                type: integer
                              example:
                              - 385
                              - 390
                            avail_unverified:
                              type: array
                              items:
                                type: integer
                              example:
                              - 107
                              - 100
                            total:
                              type: array
                              items:
                                type: integer
                              example:
                              - 4446
                              - 4446
                        pricing:
                          type: object
                          description: Time-series arrays of pricing percentiles
                          properties:
                            timestamps:
                              type: array
                              items:
                                type: integer
                              example:
                              - 1779736460
                              - 1779736632
                            rented_p10:
                              type: array
                              items:
                                type: number
                              example:
                              - 0.246
                              - 0.246
                            rented_median:
                              type: array
                              items:
                                type: number
                              example:
                              - 0.39
                              - 0.38
                            rented_p90:
                              type: array
                              items:
                                type: number
                              example:
                              - 0.599
                              - 0.55
                            avail_p10:
                              type: array
                              items:
                                type: number
                              example:
                              - 0.254
                              - 0.289
                            avail_median:
                              type: array
                              items:
                                type: number
                              example:
                              - 0.5
                              - 0.5
                            avail_p90:
                              type: array
                              items:
                                type: number
                              example:
                              - 0.973
                              - 0.85
                        stats:
                          type: object
                          description: Static performance metrics for this GPU
                          properties:
                            tflops:
                              type: number
                              example: 82.6
                            dlperf:
                              type: number
                              example: 97.5
                            tflops_per_dollar:
                              type: number
                              example: 127.1
                            dlperf_per_dollar:
                              type: number
                              example: 150.0
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Machines
      operationId: showGpuTrends
  /api/v0/notification-types:
    get:
      summary: list notification types
      description: List the notification types available to the authenticated user,
        including their display names, contexts, topics, and default channel settings.
      security:
      - BearerAuth: []
      tags:
      - Notifications
      responses:
        '200':
          description: Notification types returned successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  notification_types:
                    type: array
                    items:
                      $ref: '#/components/schemas/NotificationType'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: listNotificationTypes
  /api/v0/users/{user_id}/notification-prefs:
    get:
      summary: get notification preferences
      description: Read notification preferences for the authenticated user.
      security:
      - BearerAuth: []
      tags:
      - Notifications
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: integer
        description: ID of the authenticated user.
      responses:
        '200':
          description: Notification preferences returned successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  notification_preferences:
                    $ref: '#/components/schemas/NotificationPreferences'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getNotificationPreferences
    put:
      summary: update notification preferences
      description: Replace notification preferences for the authenticated user.
      security:
      - BearerAuth: []
      tags:
      - Notifications
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: integer
        description: ID of the authenticated user.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - notification_preferences
              properties:
                notification_preferences:
                  $ref: '#/components/schemas/NotificationPreferences'
            example:
              notification_preferences:
                client:
                  low_credit:
                    email: true
                    webhooks: false
      responses:
        '200':
          description: Notification preferences updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  notification_preferences:
                    $ref: '#/components/schemas/NotificationPreferences'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: updateNotificationPreferences
  /api/v0/webhooks:
    get:
      summary: list notification webhooks
      description: List notification webhooks for the authenticated user.
      security:
      - BearerAuth: []
      tags:
      - Notifications
      responses:
        '200':
          description: Webhooks returned successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  webhooks:
                    type: array
                    items:
                      $ref: '#/components/schemas/NotificationWebhook'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: listNotificationWebhooks
    post:
      summary: create notification webhook
      description: Create a notification webhook for one or more notification type
        keys. The response includes the signing secret; store it immediately.
      security:
      - BearerAuth: []
      tags:
      - Notifications
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationWebhookCreateRequest'
            example:
              name: Ops notifications
              webhook_url: https://example.com/vast/webhooks
              event_types:
              - client:low_credit
              - host:machine_offline
      responses:
        '200':
          description: Webhook created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  webhook:
                    $ref: '#/components/schemas/NotificationWebhookWithSecret'
                  enabled_notification_preferences:
                    type: array
                    items:
                      type: string
                    example:
                    - client:low_credit
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: createNotificationWebhook
  /api/v0/webhooks/{id}:
    put:
      summary: update notification webhook
      description: Update a notification webhook's name, URL, or event subscriptions.
      security:
      - BearerAuth: []
      tags:
      - Notifications
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: Webhook ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationWebhookUpdateRequest'
            example:
              name: Primary ops notifications
              event_types:
              - client:low_credit
              - client:outbid
      responses:
        '200':
          description: Webhook updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  webhook:
                    $ref: '#/components/schemas/NotificationWebhook'
                  enabled_notification_preferences:
                    type: array
                    items:
                      type: string
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: updateNotificationWebhook
    delete:
      summary: delete notification webhook
      description: Delete a notification webhook.
      security:
      - BearerAuth: []
      tags:
      - Notifications
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: Webhook ID.
      responses:
        '200':
          description: Webhook deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: deleteNotificationWebhook
  /api/v0/webhooks/{id}/rotate-secret:
    post:
      summary: rotate notification webhook secret
      description: Rotate the webhook signing secret. Store the returned secret immediately.
      security:
      - BearerAuth: []
      tags:
      - Notifications
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: Webhook ID.
      responses:
        '200':
          description: Webhook secret rotated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  webhook:
                    $ref: '#/components/schemas/NotificationWebhookWithSecret'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: rotateNotificationWebhookSecret
  /api/v0/webhooks/{id}/test:
    post:
      summary: test notification webhook
      description: Send a test delivery to the webhook URL using the same request
        format and signature headers as normal webhook delivery.
      security:
      - BearerAuth: []
      tags:
      - Notifications
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: Webhook ID.
      responses:
        '200':
          description: Test delivery accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    example: Test webhook delivered
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: testNotificationWebhook
  /api/v0/instances/prepay/{id}:
    put:
      summary: prepay instance
      description: 'Deposit credits into a reserved instance to receive usage discounts.

        The discount rate is calculated based on how many months of usage the prepaid
        amount covers. Maximum discount is typically 40%.


        CLI Usage: `vastai prepay instance <id> <amount>`'
      security:
      - BearerAuth: []
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: integer
        description: ID of the instance to prepay for
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - amount
              properties:
                amount:
                  type: number
                  format: float
                  description: Amount of credits to prepay
                  example: 500.0
      responses:
        '200':
          description: Successfully applied prepayment
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  timescale:
                    type: number
                    format: float
                    description: Number of months the prepayment will cover
                    example: 3.5
                  discount_rate:
                    type: number
                    format: float
                    description: Applied discount rate (0.0-0.4)
                    example: 0.3
        '400':
          description: Invalid instance ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  msg:
                    type: string
                    example: No such instance
        '411':
          description: Insufficient credit balance
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  msg:
                    type: string
                    example: Insufficient credit
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
      tags:
      - Instances
      operationId: prepayInstance
  /api/v0/instances/reboot/{id}:
    put:
      summary: reboot instance
      description: 'Stops and starts a container without losing GPU priority. Updates
        container status to ''rebooting'' and executes docker stop/start commands
        on the host machine.


        CLI Usage: `vastai reboot instance <id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: ID of the instance to reboot
        example: 1234
      responses:
        '200':
          description: Instance reboot initiated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_args
                  msg:
                    type: string
                    example: invalid instance_id
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.0
      tags:
      - Instances
      operationId: rebootInstance
  /api/v0/instances/recycle/{id}:
    put:
      summary: recycle instance
      description: 'Destroys and recreates container in place (from newly pulled image)
        without losing GPU priority.

        Updates container status to ''recycling'' and executes docker stop/remove
        commands on the host machine.


        CLI Usage: `vastai recycle instance <id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: ID of the instance to recycle
        example: 1234
      responses:
        '200':
          description: Instance recycle initiated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '400':
          description: Bad Request - Invalid instance ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_id
                  msg:
                    type: string
                    example: Invalid instance id.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.0
      tags:
      - Instances
      operationId: recycleInstance
  /api/v0/machines/{machine_id}/defjob:
    delete:
      summary: remove defjob
      description: 'Deletes the default job (background instances) for a specified
        machine.


        CLI Usage: `vastai remove defjob <machine_id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: machine_id
        in: path
        required: true
        description: ID of the machine to remove the default job from.
        schema:
          type: integer
          example: 12345
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  machine_id:
                    type: integer
                    example: 12345
                  user_id:
                    type: integer
                    example: 67890
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.2
      tags:
      - Machines
      operationId: removeDefjob
  /api/v0/team/members/{id}:
    delete:
      summary: remove team member
      description: 'Removes a member from the team by revoking their team-related
        API keys and updating membership status. Cannot remove the team owner.


        CLI Usage: `vastai remove team-member <id>`'
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: integer
        description: User ID of the team member to remove
        example: 12345
      responses:
        '200':
          description: Member removed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                    - success
                    example: success
                  message:
                    type: string
                    example: User removed from the team.
        '400':
          description: Bad request - cannot remove team owner
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                    example: Cannot remove the team owner from the team
        '401':
          description: Unauthorized - invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: unauthorized
                  msg:
                    type: string
                    example: Invalid or missing API key
        '403':
          description: Forbidden - user is blacklisted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: forbidden
                  msg:
                    type: string
                    example: User is blacklisted
        '404':
          description: Member not found or already removed
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                    - failure
                    example: failure
                  message:
                    type: string
                    example: No user was removed from the team.
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: rate_limit_exceeded
                  msg:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      security:
      - BearerAuth: []
      tags:
      - Team
      operationId: removeTeamMember
  /api/v0/team/roles/{name}:
    delete:
      summary: remove team role
      description: 'Removes a role from the team. Cannot remove the team owner role.


        CLI Usage: `vastai remove team-role <name>`'
      security:
      - BearerAuth: []
      tags:
      - Team
      parameters:
      - in: path
        name: name
        required: true
        schema:
          type: string
        description: Name of the role to remove
        example: developer
      responses:
        '200':
          description: Role removed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                    - success
                    example: success
                  message:
                    type: string
                    example: Role removed from team
        '400':
          description: Bad request - role name is required
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                    example: Role name is required
        '401':
          description: Unauthorized - invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: unauthorized
                  msg:
                    type: string
                    example: Invalid or missing API key
        '403':
          description: Forbidden - cannot delete owner role or user is blacklisted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: forbidden
                  msg:
                    type: string
                    example: You cannot delete the owner role.
        '404':
          description: Role not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: not_found
                  msg:
                    type: string
                    example: Specified role not found
      operationId: removeTeamRole
    get:
      summary: show team role
      description: 'Retrieve details of a specific team role by its name.


        CLI Usage: `vastai show team-role <name>`'
      security:
      - BearerAuth: []
      parameters:
      - name: name
        in: path
        required: true
        description: Name of the team role
        schema:
          type: string
        example: admin
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Role ID
                    example: 1
                  name:
                    type: string
                    description: Name of the role
                    example: admin
                  permissions:
                    type: array
                    description: Permissions associated with the role
                    items:
                      type: string
                    example:
                    - read
                    - write
        '404':
          description: Role not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      tags:
      - Team
      operationId: showTeamRole
    put:
      summary: update team role
      description: 'Update an existing team role with new name and permissions.


        CLI Usage: `vastai update team-role <id> --name <new_name> --permissions <new_permissions_json>`'
      parameters:
      - name: name
        in: path
        required: true
        description: ID of the role to update.
        schema:
          type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: New name for the role.
                permissions:
                  type: object
                  description: JSON encoded permissions for the role.
              required:
              - name
              - permissions
      responses:
        '200':
          description: Successfully updated team role.
          content:
            application/json:
              schema:
                type: string
                example: Successfully Updated Team Role For <role_name>
      security:
      - BearerAuth: []
      tags:
      - Team
      operationId: updateTeamRole
  /api/v0/machines/{machine_id}/reports:
    get:
      summary: show reports
      description: 'Retrieves a list of the most recent reports for a given machine.
        Each report includes details such as the problem identified, a message describing
        the issue, and the timestamp when the report was created.


        CLI Usage: `vastai reports <machine_id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: machine_id
        in: path
        required: true
        schema:
          type: integer
        description: The unique identifier of the machine.
      responses:
        '200':
          description: An array of reports for the specified machine.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    problem:
                      type: string
                      description: The type of problem reported.
                    message:
                      type: string
                      description: Detailed message describing the problem.
                    created_at:
                      type: string
                      format: date-time
                      description: Timestamp when the report was created.
        '404':
          description: Machine not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      tags:
      - Machines
      operationId: showReports
  /route:
    post:
      servers:
      - url: https://run.vast.ai
        description: Production server
      summary: route
      description: 'Calls on the serverless engine to retrieve a GPU instance address
        within your endpoint for processing a request.

        The engine will return either a ready worker URL or status information if
        no workers are available.


        CLI Usage: `vastai route <endpoint> <cost>`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - endpoint
              - cost
              properties:
                endpoint:
                  type: string
                  description: Name of the endpoint
                  example: vLLM-Qwen3-8B
                cost:
                  type: number
                  format: float
                  description: The estimated compute resources for the request
                  default: 100.0
                  example: 242.0
                  minimum: 0
      responses:
        '200':
          description: Success response - either worker assignment or status
          content:
            application/json:
              schema:
                oneOf:
                - title: Worker Available
                  type: object
                  properties:
                    endpoint:
                      type: string
                      description: Same as the input parameter
                      example: vLLM-Qwen3-8B
                    url:
                      type: string
                      description: The address of the worker instance to send the
                        request to
                      example: http://192.168.1.10:8000
                    cost:
                      type: number
                      description: Same as the input parameter
                      example: 242.0
                    reqnum:
                      type: integer
                      description: Request number corresponding to this worker instance
                      example: 12345
                    signature:
                      type: string
                      description: Cryptographic signature authenticating the response
                      example: a1b2c3d4e5f60708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20
                    __request_id:
                      type: string
                      description: Unique identifier generated by the server for this
                        request
                      example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
                - title: No Worker Available
                  type: object
                  properties:
                    endpoint:
                      type: string
                      description: Same as the input parameter
                      example: vLLM-Qwen3-8B
                    status:
                      type: string
                      description: Breakdown of workers in your endpoint group by
                        status
                      example: Stopped
                    __request_id:
                      type: string
                      description: Unique identifier generated by the server for this
                        request
                      example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
        '401':
          description: Unauthorized - authentication failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Authentication failed
        '400':
          description: Bad Request - invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Invalid endpoint or missing required parameters
      tags:
      - Serverless
      operationId: route
  /api/v0/machines/{machine_id}/dnotify:
    put:
      summary: schedule maint
      description: 'Schedules a maintenance window for a specified machine and notifies
        clients.


        CLI Usage: `vastai schedule maint <machine_id> --sdate <sdate> --duration
        <duration>`'
      security:
      - BearerAuth: []
      parameters:
      - name: machine_id
        in: path
        required: true
        description: ID of the machine to schedule maintenance for.
        schema:
          type: integer
          example: 12345
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - sdate
              - duration
              properties:
                sdate:
                  type: string
                  format: date-time
                  description: Start date and time of the maintenance window.
                  example: '2023-10-30T14:00:00Z'
                duration:
                  type: integer
                  description: Duration of the maintenance window in hours.
                  example: 2
                maintenance_reason:
                  type: string
                  description: Reason for the maintenance.
                  example: Routine hardware check
                maintenance_category:
                  type: string
                  description: Category of the maintenance.
                  enum:
                  - power
                  - internet
                  - disk
                  - gpu
                  - software
                  - other
                  example: software
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  you_sent:
                    type: string
                    example: 2 notifications sent
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.5
      tags:
      - Machines
      operationId: scheduleMaint
  /api/v0/benchmarks:
    get:
      summary: search benchmarks
      description: 'Retrieve benchmark data based on search parameters.


        CLI Usage: `vastai search benchmarks`'
      security:
      - BearerAuth: []
      parameters:
      - name: query
        in: query
        required: false
        schema:
          type: string
        description: Search query string to filter benchmarks.
        example: score>1000
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    contract_id:
                      type: integer
                      description: ID of instance/contract reporting benchmark
                    id:
                      type: integer
                      description: Benchmark unique ID
                    image:
                      type: string
                      description: Image used for benchmark
                    last_update:
                      type: number
                      format: float
                      description: Date of benchmark
                    machine_id:
                      type: integer
                      description: ID of machine benchmarked
                    model:
                      type: string
                      description: Name of model used in benchmark
                    name:
                      type: string
                      description: Name of benchmark
                    num_gpus:
                      type: integer
                      description: Number of GPUs used in benchmark
                    score:
                      type: number
                      format: float
                      description: Benchmark score result
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Search
      operationId: searchBenchmarks
  /api/v0/bundles:
    post:
      summary: search offers
      description: 'Search for available GPU machine offers with advanced filtering
        and sorting.


        Each filter parameter (such as `verified`, `gpu_name`, `num_gpus`, etc.) should
        be an object specifying the operator and value you want to match.


        **Filter operators:**


        | Operator | Meaning                | Example                        |

        |:---------|:-----------------------|:-------------------------------|

        | `eq`     | Equal to               | `{ "eq": true }`               |

        | `neq`    | Not equal to           | `{ "neq": false }`             |

        | `gt`     | Greater than           | `{ "gt": 0.99 }`               |

        | `lt`     | Less than              | `{ "lt": 10000 }`              |

        | `gte`    | Greater than or equal  | `{ "gte": 4 }`                 |

        | `lte`    | Less than or equal     | `{ "lte": 8 }`                 |

        | `in`     | Value is in a list     | `{ "in": ["RTX_3090", "RTX_4090"] }`
        |

        | `notin`  | Value is not in a list | `{ "notin": ["TW", "SE"] }`    |


        CLI Usage: `vastai search offers ''reliability > 0.99 num_gpus>=4'' --order=dph_total`'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                limit:
                  type: integer
                  description: Max offers to return
                type:
                  type: string
                  enum:
                  - ondemand
                  - bid
                  - reserved
                  description: 'Instance type for the offer. Affects pricing calculation.


                    - **ondemand**: Fixed pricing based on listed rates. Default.

                    - **bid** (interruptible): Uses minimum bid price. Lower cost
                    but may be interrupted if outbid.

                    - **reserved**: Reserved instance pricing.

                    '
                verified:
                  type: object
                  description: Machine verification status
                  properties:
                    eq:
                      type: boolean
                  default:
                    eq: true
                rentable:
                  type: object
                  description: Whether machine is rentable
                  properties:
                    eq:
                      type: boolean
                  default:
                    eq: true
                rented:
                  type: object
                  description: 'When set to true, include offers where the calling
                    user already has rented GPUs.

                    This is useful for finding offers on machines you''re already
                    renting.

                    '
                  properties:
                    eq:
                      type: boolean
                  default:
                    eq: false
                gpu_name:
                  type: object
                  description: 'GPU model name. Example: {"eq": "RTX_4090"} or {"in":
                    ["RTX_3090", "RTX_4090"]}'
                  properties:
                    in:
                      type: array
                      items:
                        type: string
                      example:
                      - RTX_3090
                      - RTX_4090
                reliability:
                  type: object
                  description: 'Machine reliability score (0-1). Example: {"gte":
                    0.99}'
                num_gpus:
                  type: object
                  description: 'Number of GPUs. Example: {"gte": 4} or {"in": [1,
                    2, 4, 8]}'
                  properties:
                    in:
                      type: array
                      items:
                        type: integer
                      example:
                      - 1
                      - 2
                      - 4
                      - 8
                gpu_ram:
                  type: object
                  description: 'GPU RAM in MB. Example: {"gte": 24000}'
                duration:
                  type: object
                  description: Minimum required rental duration in seconds (the offer
                    must be available for at least this long from now).
                machine_id:
                  type: object
                  description: Filter by specific host machine ID
                dlperf_per_dphtotal:
                  type: object
                  description: DLPerf per dollar per hour
                dph_total:
                  type: object
                  description: 'Total $/hour rental cost. Example: {"lte": 0.5}'
                flops_per_dphtotal:
                  type: object
                  description: TFLOPs per $/hour
                geolocation:
                  type: object
                  description: 'Machine location (two letter country code). Example:
                    {"in": ["US", "CA"]}'
                  properties:
                    in:
                      type: array
                      items:
                        type: string
                      example:
                      - US
                      - CA
                gpu_arch:
                  type: object
                  description: 'Host machine GPU architecture (e.g. nvidia, amd).
                    Example: {"eq": "nvidia"}'
                dlperf:
                  type: object
                  description: Deep Learning performance score
                cuda_max_good:
                  type: object
                  description: Maximum supported CUDA version
                inet_down:
                  type: object
                  description: Download bandwidth (MB/s)
                inet_up:
                  type: object
                  description: Upload bandwidth (MB/s)
                inet_down_cost:
                  type: object
                  description: Download bandwidth cost ($/GB)
                inet_up_cost:
                  type: object
                  description: Upload bandwidth cost ($/GB)
                driver_version:
                  type: object
                  description: NVIDIA driver version in the format "XXX.XX.XX"
                compute_cap:
                  type: object
                  description: CUDA compute capability x 100. Use 650 for compute
                    capability 6.5 or 700 for 7.0.
                cpu_arch:
                  type: object
                  description: 'Host machine CPU architecture (Default is amd64).
                    Example: {"eq": "amd64"}'
                has_avx:
                  type: object
                  description: CPU supports AVX instruction set
                cpu_cores:
                  type: object
                  description: Number of virtual CPUs
                cpu_cores_effective:
                  type: object
                  description: Effective vCPU count for the offer
                cpu_ghz:
                  type: object
                  description: CPU clock speed in GHz
                cpu_ram:
                  type: object
                  description: CPU RAM in MB
                datacenter:
                  type: object
                  description: Show only datacenter offers
                external:
                  type: object
                  description: Show external offers in addition to datacenter offers
                disk_bw:
                  type: object
                  description: Disk read bandwidth in MB/s
                disk_space:
                  type: object
                  description: Disk storage space in GB
                bw_nvlink:
                  type: object
                  description: NVLink interconnect bandwidth in GB/s. Use when filtering
                    for multi-GPU systems with high-speed NVLink.
                gpu_max_power:
                  type: object
                  description: GPU power limit in watts
                gpu_max_temp:
                  type: object
                  description: GPU temperature limit in Celsius
                gpu_mem_bw:
                  type: object
                  description: GPU memory bandwidth in GB/s
                gpu_total_ram:
                  type: object
                  description: Total GPU RAM across all GPUs in MB
                gpu_frac:
                  type: object
                  description: Fraction of the total GPU resources being offered
                gpu_display_active:
                  type: object
                  description: Whether the GPU has an attached display
                direct_port_count:
                  type: object
                  description: Number of direct ports
                host_id:
                  type: object
                  description: Host user ID
                id:
                  type: object
                  description: Offer ID
                min_bid:
                  type: object
                  description: Minimum bid price ($/hour)
                mobo_name:
                  type: object
                  description: Motherboard name
                pci_gen:
                  type: object
                  description: PCIe generation
                pcie_bw:
                  type: object
                  description: PCIe bandwidth (CPU to GPU)
                storage_cost:
                  type: object
                  description: Storage cost in $/GB/month
                static_ip:
                  type: object
                  description: Whether the IP address is static/stable
                total_flops:
                  type: object
                  description: Total theoretical GPU compute performance (TFLOPs)
                    across all GPUs.
                os_version:
                  type: object
                  description: Host machine Ubuntu OS version
                ubuntu_version:
                  type: object
                  description: Host machine Ubuntu OS version (alias for os_version)
                verification:
                  type: object
                  description: 'Machine verification status string (verified, deverified,
                    unverified). Example: {"eq": "verified"}'
                vms_enabled:
                  type: object
                  description: Whether the machine is a VM instance
                order:
                  type: array
                  description: 'List of sort fields and directions.

                    Each entry should contain two elements:

                    1. The field name to sort by (string)

                    2. The sort direction ("asc" or "desc")

                    '
                  items:
                    type: array
                    items:
                      type: string
                  minItems: 2
                  maxItems: 2
                allocated_storage:
                  type: number
                  description: 'Storage allocation size in GB for the instance.

                    This sets the disk size when creating the instance and cannot
                    be changed later.

                    Default is 8GB.

                    '
            example:
              limit: 100
              type: on-demand
              verified:
                eq: true
              rentable:
                eq: true
              rented:
                eq: false
      responses:
        '200':
          description: Successful search response
          content:
            application/json:
              schema:
                type: object
                properties:
                  offers:
                    type: array
                    items:
                      type: object
                      additionalProperties: true
              example:
                offers:
                  id: 12345678
                  ask_contract_id: 12345678
                  bundle_id: 987654321
                  bundled_results: null
                  bw_nvlink: 0
                  compute_cap: 900
                  cpu_arch: amd64
                  cpu_cores: 64
                  cpu_cores_effective: 32
                  cpu_ghz: 2.99
                  cpu_name: QuantumX 128-Core Processor
                  cpu_ram: 65536
                  credit_discount_max: 0.15
                  cuda_max_good: 11.2
                  direct_port_count: 42
                  disk_bw: 1234.5
                  disk_name: HYPERDISK 8TB
                  disk_space: 2048.5
                  dlperf: 222.22
                  dlperf_per_dphtotal: 333.33
                  dph_base: 0.123456
                  dph_total: 0.234567
                  driver_version: 999.99.99
                  driver_vers: 999999999
                  duration: 1234567.89
                  end_date: 1893456000
                  external: null
                  flops_per_dphtotal: 444.44
                  geolocation: Atlantis, AT
                  geolocode: 42424242
                  gpu_arch: nvidia
                  gpu_display_active: false
                  gpu_frac: 0.75
                  gpu_ids:
                  - 1111
                  - 2222
                  gpu_lanes: 16
                  gpu_mem_bw: 888.8
                  gpu_name: Imaginary RTX 9999
                  gpu_ram: 24576
                  gpu_total_ram: 49152
                  gpu_max_power: 450
                  gpu_max_temp: 42
                  has_avx: 1
                  host_id: 55555
                  hosting_type: 0
                  hostname: null
                  inet_down: 9876.5
                  inet_down_cost: 0.00123
                  inet_up: 8765.4
                  inet_up_cost: 0.00456
                  is_bid: false
                  logo: /static/logos/fake_logo.png
                  machine_id: 88888
                  min_bid: 0.111111
                  mobo_name: FANTASY-MOBO-2025
                  num_gpus: 4
                  os_version: '42.42'
                  pci_gen: 6
                  pcie_bw: 99.9
                  public_ipaddr: 203.0.113.42
                  reliability: 0.9999
                  reliability_mult: 0.8888
                  rentable: true
                  rented: false
                  score: 1234.5678
                  start_date: 1893450000.5
                  static_ip: true
                  storage_cost: 0.987654
                  storage_total_cost: 0.123456
                  total_flops: 999.99
                  verification: verified
                  vericode: 1
                  vram_costperhour: 0.009876
                  webpage: null
                  vms_enabled: false
                  expected_reliability: 0.5
                  is_vm_deverified: false
                  resource_type: gpu
                  cluster_id: null
                  avail_vol_ask_id: 333333
                  avail_vol_dph: 0.000321
                  avail_vol_size: 4096
                  nw_disk_min_bw: null
                  nw_disk_max_bw: null
                  nw_disk_avg_bw: null
                  rn: 1
                  dph_total_adj: 0.345678
                  reliability2: 0.9999
                  discount_rate: 0.05
                  discounted_hourly: 0.01
                  discounted_dph_total: 0.224567
                  search:
                    gpuCostPerHour: 0.123456
                    diskHour: 0.123456
                    totalHour: 0.234567
                    discountTotalHour: 0.01
                    discountedTotalPerHour: 0.224567
                  instance:
                    gpuCostPerHour: 0.01
                    diskHour: 0.02
                    totalHour: 0.03
                    discountTotalHour: 0.001
                    discountedTotalPerHour: 0.029
                  time_remaining: ''
                  time_remaining_isbid: ''
                  internet_up_cost_per_tb: 1.23
                  internet_down_cost_per_tb: 4.56
        '400':
          description: Bad request - invalid query parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: invalid_request
                  msg:
                    type: string
                    example: Invalid json body
        '404':
          description: Unauthorized - invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  msg:
                    type: string
                    example: Invalid user key
      tags:
      - Search
      operationId: searchOffers
  /api/v0/volumes/search:
    post:
      summary: search volumes
      description: 'Search for available volumes based on specified criteria.


        CLI Usage: `vastai search volumes <query> [options]`'
      security:
      - BearerAuth: []
      parameters:
      - name: q
        in: query
        required: false
        schema:
          type: object
          properties:
            limit:
              type: integer
              description: Maximum number of results to return
              default: 64
              example: 100
        description: Query parameters for filtering volume search results
        example:
          limit: 100
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                limit:
                  type: integer
                  description: Maximum number of results to return
                  default: 64
                  example: 100
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  offers:
                    type: array
                    items:
                      $ref: '#/components/schemas/VolumeOffer'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_args
                    - invalid_request
                  msg:
                    type: string
                    example: 'Invalid query: {query}, must be dict of conditions'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=5.5
      tags:
      - Volumes
      operationId: searchVolumes
  /api/v0/machines/create_bids:
    put:
      summary: set defjob
      description: 'Creates default jobs (background instances) for a specified machine
        with the given parameters.


        CLI Usage: `vastai set defjob <machine_id> --price_gpu <price> --price_inetu
        <price> --price_inetd <price> --image <image> [--args <args>]`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - machine
              - price_gpu
              - price_inetu
              - price_inetd
              - image
              properties:
                machine:
                  type: integer
                  description: ID of the machine to create jobs for.
                  example: 12345
                price_gpu:
                  type: number
                  format: float
                  description: Price per GPU per day.
                  example: 0.5
                price_inetu:
                  type: number
                  format: float
                  description: Price for internet upload.
                  example: 0.1
                price_inetd:
                  type: number
                  format: float
                  description: Price for internet download.
                  example: 0.1
                image:
                  type: string
                  description: Docker image to use for the job.
                  example: vastai/tensorflow
                args:
                  type: array
                  items:
                    type: string
                  description: Arguments for the Docker image.
                  example:
                  - --arg1
                  - --arg2
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  machine_id:
                    type: integer
                    example: 12345
                  user_id:
                    type: integer
                    example: 67890
                  you_sent:
                    type: object
                    description: The original request JSON.
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.8
      tags:
      - Machines
      operationId: setDefjob
  /api/v0/machines/{machine_id}/minbid:
    put:
      summary: set min-bid
      description: 'Sets the minimum bid price for a specified machine.


        CLI Usage: `vastai set min-bid <machine_id> --price <price>`'
      security:
      - BearerAuth: []
      parameters:
      - name: machine_id
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the machine.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - price
              properties:
                price:
                  type: number
                  format: float
                  description: Minimum bid price for the machine.
                  example: 0.5
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  you_sent:
                    type: object
                    description: The original request JSON.
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.5
      tags:
      - Machines
      operationId: setMinBid
  /api/v0/charges:
    get:
      summary: show charges
      description: 'Shows charges per instance, including GPU, storage, and bandwidth.
        For invoice/payment records (Stripe top-ups, transfers, payouts), use [show
        invoices](/api-reference/billing/show-invoices) instead.


        CLI: `vastai show invoices-v1 --charges`'
      security:
      - BearerAuth: []
      parameters:
      - name: select_filters
        in: query
        required: true
        description: '**`day`** (required). Date range in unix seconds (UTC). Operators:
          `gte`, `lte`.


          **`type`** (optional). Filter by contract type: `instance`, `volume`, `serverless`.
          Operator: `in`.


          **Examples**:

          ```json

          // All charges in January 2026

          {"day":{"gte":1767225600,"lte":1769903999}}


          // Only instance charges

          {"day":{"gte":1767225600,"lte":1769903999},"type":{"in":["instance"]}}


          // Volumes and serverless only

          {"day":{"gte":1767225600,"lte":1769903999},"type":{"in":["volume","serverless"]}}

          ```

          '
        schema:
          type: string
      - name: format
        in: query
        required: false
        description: '- `table` (default) flat list of per-contract rows with `type:
          "instance"` or `"volume"`.

          - `tree` serverless contracts are collapsed under endpoint/workergroup wrappers
          with `type: "serverless"` and `source: "endpoint-<id>"` / `"workergroup-<id>"`.
          Regular instances and volumes are unchanged.

          '
        schema:
          type: string
          enum:
          - table
          - tree
          default: table
          example: table
      - name: latest_first
        in: query
        required: false
        description: Sort by most recent charges first.
        schema:
          type: boolean
          default: true
          example: true
      - name: limit
        in: query
        required: false
        description: Max results per page. Server maximum 500.
        schema:
          type: integer
          minimum: 1
          default: 100
          example: 20
      - name: after_token
        in: query
        required: false
        description: 'Pass the `next_token` value from the previous response to fetch
          the next page of results. When the response returns `next_token: null`,
          there are no more pages.'
        schema:
          type: string
          example: eyJ2YWx1ZXMiOiB7ImlkIjogMTIzNDU2Nzh9fQ==
      responses:
        '200':
          description: Paginated per-instance charge results
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  count:
                    type: integer
                    description: Number of contracts returned in this page.
                    example: 2
                  total:
                    type: integer
                    description: Total number of contracts matching the filters.
                    example: 14
                  next_token:
                    type:
                    - string
                    - 'null'
                    description: Pagination cursor for the next page. `null` when
                      no more pages.
                    example: eyJ2YWx1ZXMiOiB7ImlkIjogMTIzNDU2Nzh9fQ==
                  results:
                    type: array
                    description: List of per-contract charge entries.
                    items:
                      type: object
                      properties:
                        start:
                          type: integer
                          description: Contract start time (unix seconds UTC).
                          example: 1730419200
                        end:
                          type: integer
                          description: Contract end time (unix seconds UTC).
                          example: 1730678400
                        type:
                          type: string
                          description: Contract type. `instance` or `volume` in table
                            format, or `serverless` (wrapper) in tree format.
                          example: instance
                        source:
                          type: string
                          description: Identifier in the form `{type}-{id}`. For tree-format
                            serverless wrappers, uses `endpoint-<id>` or `workergroup-<id>`.
                          example: instance-12345678
                        description:
                          type: string
                          example: Instance 12345678 Charges - 4 days
                        amount:
                          type: number
                          format: float
                          description: Total charge for this contract (rounded to
                            3 decimals).
                          example: 38.421
                        metadata:
                          type: object
                          description: Optional instance metadata. Keys present only
                            when non-null on the contract.
                          properties:
                            template_id:
                              type: integer
                              example: 101
                            label:
                              type: string
                              example: my-training-job
                            endpoint_id:
                              type: integer
                              example: 19392
                            workergroup_id:
                              type: integer
                              example: 25355
                        items:
                          type: array
                          description: Per-charge-type breakdown (`gpu`, `disk`, `bwd`,
                            `bwu`). Empty for tree-format wrappers above the contract
                            level.
                          items:
                            type: object
                            properties:
                              start:
                                type: integer
                                example: 1730419200
                              end:
                                type: integer
                                example: 1730678400
                              type:
                                type: string
                                enum:
                                - gpu
                                - disk
                                - bwd
                                - bwu
                                example: gpu
                              source:
                                type:
                                - string
                                - 'null'
                                example: null
                              description:
                                type: string
                                example: 96.000 hours at $0.389/hour
                              amount:
                                type: number
                                format: float
                                example: 37.344
                              metadata:
                                type: object
                                example: {}
                              items:
                                type: array
                                example: []
        '400':
          description: 'Invalid request. Returned when the required `day.gte` / `day.lte`
            filters are missing, or when the supplied `after_token` cannot be decoded.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing_date_range:
                  summary: Missing required `day` range
                  value:
                    success: false
                    msg: Must provide both 'day' gte and lte filters for instance
                      charges
                invalid_pagination_token:
                  summary: Bad `after_token`
                  value:
                    success: false
                    error: invalid_token
                    msg: Invalid pagination token
        '401':
          description: Unauthorized. May be returned in framework-level authentication
            failure cases.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden. Returned when no `Authorization` header is provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: auth_error
                msg: This action requires login.
        '404':
          description: Not Found. Returned when the supplied API key does not match
            any user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: auth_error
                msg: Invalid user key
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.0
      tags:
      - Billing
      operationId: showCharges
  /api/v0/users/cloud_integrations:
    get:
      summary: show connections
      description: 'Retrieves the list of cloud connections associated with the authenticated
        user.


        CLI Usage: `vastai show connections`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: Unique identifier for the cloud connection.
                    cloud_type:
                      type: string
                      description: Type of cloud service.
                    name:
                      type: string
                      description: User-given name for the cloud connection.
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.9
      tags:
      - Accounts
      operationId: showConnections
  /api/v0/deployment/{id}:
    get:
      summary: show deployment
      description: 'Returns detailed information about a single deployment, including
        endpoint state and worker count.


        CLI Usage: `vastai show deployment <id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: Deployment ID
        example: 644
      responses:
        '200':
          description: Deployment details
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  deployment:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 644
                      name:
                        type: string
                        example: square
                      tag:
                        type: string
                        example: default
                      image:
                        type: string
                        example: vastai/base-image:latest
                      endpoint_id:
                        type:
                        - integer
                        - 'null'
                        example: 25121
                      endpoint_state:
                        type:
                        - string
                        - 'null'
                        description: Current state of the endpoint
                        example: active
                      env:
                        type:
                        - string
                        - 'null'
                        description: Environment variables and port mappings
                      s3_key:
                        type:
                        - string
                        - 'null'
                        description: S3 object key for the current code version
                      file_hash:
                        type:
                        - string
                        - 'null'
                        description: Content hash of the deployed code
                      search_params:
                        type:
                        - string
                        - 'null'
                        description: Search query for instance selection
                      current_version_id:
                        type:
                        - integer
                        - 'null'
                      last_healthy_version_id:
                        type:
                        - integer
                        - 'null'
                      storage:
                        type: number
                        example: 16.0
                      ttl:
                        type:
                        - number
                        - 'null'
                      last_client_heartbeat:
                        type:
                        - number
                        - 'null'
                        description: Unix timestamp of last client heartbeat
                      created_at:
                        type: number
                        description: Unix timestamp
                      updated_at:
                        type: number
                        description: Unix timestamp
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Deployment not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Serverless
      operationId: showDeployment
  /api/v0/deployments:
    get:
      summary: show deployments
      description: 'Returns all deployments owned by the authenticated user.


        CLI Usage: `vastai show deployments`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: A list of deployments
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  deployments:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 644
                        name:
                          type: string
                          example: square
                        tag:
                          type: string
                          example: default
                        image:
                          type: string
                          example: vastai/base-image:latest
                        endpoint_id:
                          type:
                          - integer
                          - 'null'
                          example: 25121
                        env:
                          type:
                          - string
                          - 'null'
                          description: Environment variables and port mappings
                        file_hash:
                          type:
                          - string
                          - 'null'
                          description: Content hash of the deployed code
                        s3_key:
                          type:
                          - string
                          - 'null'
                          description: S3 object key for the current code version
                        search_params:
                          type:
                          - string
                          - 'null'
                          description: Search query for instance selection
                        current_version_id:
                          type:
                          - integer
                          - 'null'
                        last_healthy_version_id:
                          type:
                          - integer
                          - 'null'
                        storage:
                          type: number
                          example: 16.0
                        ttl:
                          type:
                          - number
                          - 'null'
                        last_client_heartbeat:
                          type:
                          - number
                          - 'null'
                          description: Unix timestamp of last client heartbeat
                        created_at:
                          type: number
                          description: Unix timestamp
                        updated_at:
                          type: number
                          description: Unix timestamp
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Serverless
      operationId: showDeployments
  /api/v0/instances/balance/{id}:
    get:
      summary: show deposit
      description: 'Retrieves the deposit details for a specified instance.


        CLI Usage: `vastai show deposit <id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the instance.
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  refundable_deposit:
                    type: number
                    description: The refundable deposit amount.
                    example: 100.0
                  total_discount:
                    type: number
                    description: The total discount applied.
                    example: 10.0
                  discount_months:
                    type: integer
                    description: The number of months the discount applies.
                    example: 3
        '404':
          description: Instance Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Billing
      operationId: showDeposit
  /api/v0/users/{user_id}/machine-earnings:
    get:
      summary: show earnings
      description: 'Retrieves the earnings history for a specified time range and
        optionally per machine.


        CLI Usage: `vastai show earnings [options]`'
      security:
      - BearerAuth: []
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the user.
      - name: sday
        in: query
        schema:
          type: integer
        description: Start day for the earnings report.
      - name: eday
        in: query
        schema:
          type: integer
        description: End day for the earnings report.
      - name: machid
        in: query
        schema:
          type: integer
        description: Optional machine ID to filter earnings.
      - name: last_days
        in: query
        schema:
          type: integer
        description: Number of days to look back from today.
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  summary:
                    type: object
                    properties:
                      total_gpu:
                        type: number
                      total_stor:
                        type: number
                      total_bwu:
                        type: number
                      total_bwd:
                        type: number
                  username:
                    type: string
                  email:
                    type: string
                  fullname:
                    type: string
                  address1:
                    type: string
                  address2:
                    type: string
                  city:
                    type: string
                  zip:
                    type: string
                  country:
                    type: string
                  taxinfo:
                    type: string
                  current:
                    type: object
                    properties:
                      balance:
                        type: number
                      service_fee:
                        type: number
                      total:
                        type: number
                      credit:
                        type: number
                  per_machine:
                    type: array
                    items:
                      type: object
                      properties:
                        machine_id:
                          type: integer
                        gpu_earn:
                          type: number
                        sto_earn:
                          type: number
                        bwu_earn:
                          type: number
                        bwd_earn:
                          type: number
                  per_day:
                    type: array
                    items:
                      type: object
                      properties:
                        day:
                          type: integer
                        gpu_earn:
                          type: number
                        sto_earn:
                          type: number
                        bwu_earn:
                          type: number
                        bwd_earn:
                          type: number
        '400':
          description: Bad Request - Invalid input syntax
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
      tags:
      - Billing
      operationId: showEarnings
  /api/v1/instances:
    get:
      summary: show instances
      description: 'Retrieve a paginated list of instances for the authenticated user.

        Supports keyset pagination (max 25 per page), filtering, column selection,
        and sorting.


        CLI Usage: `vastai show instances [OPTIONS] [--api-key API_KEY] [--raw]`'
      security:
      - BearerAuth: []
      parameters:
      - name: limit
        in: query
        required: false
        description: "Instances per page. Default 25, max 25. Values \u2264 0 are\
          \ treated as 5."
        schema:
          type: integer
          default: 25
          maximum: 25
        example: 25
      - name: after_token
        in: query
        required: false
        description: Keyset pagination cursor from the previous response's `next_token`.
          An invalid token returns a 400 error.
        schema:
          type: string
        example: eyJ2YWx1ZXMiOiB7ImlkIjogMTIzfX0=
      - name: order_by
        in: query
        required: false
        description: 'JSON array of sort directives, e.g. `[{"col":"id","dir":"asc"}]`.
          Valid `dir` values: `asc`, `desc` (anything else treated as `asc`). `id`
          is always appended as a tiebreaker. Invalid column returns 400.'
        schema:
          type: string
        example: '[{"col":"id","dir":"asc"}]'
      - name: select_cols
        in: query
        required: false
        description: JSON array of column names to return, e.g. `["id","label","actual_status"]`.
          Use `["*"]` for all columns (default). Unknown column names are returned
          as `null`.
        schema:
          type: string
          default: '["*"]'
        example: '["id","label","actual_status","dph_total"]'
      - name: select_filters
        in: query
        required: false
        description: 'JSON object of column filters. Supported operators: `eq`, `neq`,
          `gt`, `gte`, `lt`, `lte`, `in`, `notin`.

          Filterable columns: `actual_status`, `gpu_name`, `verification`, `id`, `label`,
          and other columns stored directly on the contract record. Computed fields
          (e.g. `dph_total`, `num_gpus`) are not filterable and return 400.

          '
        schema:
          type: string
          default: '{}'
        example: '{"actual_status":{"eq":"running"}}'
      responses:
        '200':
          description: Paginated list of instances
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  instances_found:
                    type: integer
                    description: Number of instances returned in this page.
                    example: 5
                  total_instances:
                    type: integer
                    description: Total number of instances matching the filters.
                    example: 42
                  label_counts:
                    type: object
                    description: Count of instances grouped by label. Unlabelled instances
                      are keyed by empty string.
                    example:
                      ML Training Job: 3
                      ? ''
                      : 2
                  next_token:
                    type:
                    - string
                    - 'null'
                    description: Pagination cursor for the next page. `null` when
                      no more pages.
                    example: eyJ2YWx1ZXMiOiB7ImlkIjogMTIzfX0=
                  instances:
                    type: array
                    description: List of instance objects.
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 312
                        actual_status:
                          type:
                          - string
                          - 'null'
                          example: running
                        cur_state:
                          type: string
                          example: running
                        next_state:
                          type: string
                          example: running
                        intended_status:
                          type: string
                          example: running
                        label:
                          type:
                          - string
                          - 'null'
                          example: ML Training Job 2025
                        template_id:
                          type:
                          - integer
                          - 'null'
                          example: 2048
                        template_hash_id:
                          type:
                          - string
                          - 'null'
                          example: abcde12345
                        template_name:
                          type:
                          - string
                          - 'null'
                          example: Tensorflow GPU Template
                        image_uuid:
                          type: string
                          example: nvidia/cuda:11.0.3-devel-ubuntu18.04
                        image_args:
                          type: array
                          items:
                            type: string
                          example:
                          - bash
                          - -c
                          - apt update; apt install -y wget
                        image_runtype:
                          type: string
                          example: ssh ssh_direc ssh_proxy
                        extra_env:
                          type: array
                          items:
                            type: array
                            items:
                              type: string
                          example:
                          - - DOG
                            - CAT
                          - - -p 70001:70001
                            - '1'
                        onstart:
                          type: string
                          example: echo 'hello'; echo $DOG;
                        jupyter_token:
                          type: string
                          example: df77e27085bd4b3bd5d9024bdefb9e6df614b27adb0689e9d8f066fce5e01f0c
                        status_msg:
                          type:
                          - string
                          - 'null'
                          example: success, running nvidia/cuda_11.0.3-devel-ubuntu18.04/ssh
                        public_ipaddr:
                          type: string
                          example: 192.0.2.45
                        local_ipaddrs:
                          type: string
                          example: 10.0.0.5 172.17.0.2
                        ssh_host:
                          type: string
                          example: ssh123.vast.ai
                        ssh_idx:
                          type: string
                          example: '6'
                        ssh_port:
                          type: integer
                          example: 10600
                        machine_dir_ssh_port:
                          type: integer
                          example: 21000
                        machine_id:
                          type: integer
                          example: 12
                        start_date:
                          type: number
                          format: float
                          example: 1668804745.1223178
                        end_date:
                          type: number
                          format: float
                          example: 1735689600.0
                        uptime_mins:
                          type:
                          - number
                          - 'null'
                          example: null
                        duration:
                          type: number
                          format: float
                          example: 86400.0
                        cpu_arch:
                          type: string
                          example: amd64
                        cpu_cores:
                          type: integer
                          example: 4
                        cpu_cores_effective:
                          type: number
                          format: float
                          example: 4.0
                        cpu_name:
                          type: string
                          example: "Core\u2122 i5-6500"
                        cpu_ram:
                          type: integer
                          example: 15989
                        cpu_util:
                          type: number
                          format: float
                          example: 0.0
                        mem_limit:
                          type:
                          - number
                          - 'null'
                          example: 15.71815424
                        mem_usage:
                          type:
                          - number
                          - 'null'
                          example: 0.00996352
                        vmem_usage:
                          type:
                          - number
                          - 'null'
                          example: 0.543945
                        gpu_name:
                          type: string
                          example: RTX 4090
                        gpu_arch:
                          type: string
                          example: nvidia
                        gpu_totalram:
                          type: integer
                          example: 24576
                        gpu_ram:
                          type: integer
                          example: 24576
                        gpu_util:
                          type:
                          - number
                          - 'null'
                          example: 0.0
                        gpu_temp:
                          type:
                          - number
                          - 'null'
                          example: 38.999981
                        gpu_frac:
                          type: number
                          format: float
                          example: 1.0
                        gpu_lanes:
                          type: integer
                          example: 16
                        gpu_mem_bw:
                          type: number
                          format: float
                          example: 1008.0
                        bw_nvlink:
                          type: number
                          format: float
                          example: 0.0
                        disk_name:
                          type: string
                          example: Samsung SSD 870
                        disk_space:
                          type: number
                          format: float
                          example: 10.08
                        disk_bw:
                          type: number
                          format: float
                          example: 500.0
                        disk_util:
                          type: number
                          format: float
                          example: 0.05
                        disk_usage:
                          type: number
                          format: float
                          example: 0.05
                        direct_port_count:
                          type: integer
                          example: 1001
                        direct_port_start:
                          type: integer
                          example: 20000
                        direct_port_end:
                          type: integer
                          example: 20002
                        ports:
                          type:
                          - object
                          - 'null'
                          description: Port mappings. Only present on running instances.
                          additionalProperties:
                            type: array
                            items:
                              type: object
                              properties:
                                HostIp:
                                  type: string
                                HostPort:
                                  type: string
                          example:
                            8888/tcp:
                            - HostIp: 0.0.0.0
                              HostPort: '8888'
                            22/tcp:
                            - HostIp: 0.0.0.0
                              HostPort: '20000'
                        static_ip:
                          type: boolean
                          example: false
                        geolocation:
                          type: string
                          example: California, United States
                        verification:
                          type: string
                          example: verified
                        rentable:
                          type: boolean
                          example: true
                        host_id:
                          type: integer
                          example: 7
                        min_bid:
                          type: number
                          format: float
                          example: 0.296
                        is_bid:
                          type: boolean
                          example: false
                        dph_base:
                          type: number
                          format: float
                          example: 0.8
                        dph_total:
                          type: number
                          format: float
                          example: 0.8021
                        dlperf:
                          type:
                          - number
                          - 'null'
                          example: null
                        dlperf_per_dphtotal:
                          type:
                          - number
                          - 'null'
                          example: null
                        flops_per_dphtotal:
                          type: number
                          format: float
                          example: 15.41
                        total_flops:
                          type: number
                          format: float
                          example: 12.36
                        score:
                          type:
                          - number
                          - 'null'
                          example: null
                        reliability2:
                          type: number
                          format: float
                          example: 0.9686655
                        os_version:
                          type:
                          - string
                          - 'null'
                          example: null
                        mobo_name:
                          type: string
                          example: Z790 Gaming
                        pci_gen:
                          type: number
                          format: float
                          example: 4.0
                        pcie_bw:
                          type: number
                          format: float
                          example: 28.0
                        num_gpus:
                          type: integer
                          example: 1
                        webpage:
                          type:
                          - string
                          - 'null'
                          example: null
                        search:
                          type: object
                          example:
                            gpuCostPerHour: 0.8
                            diskHour: 0.0021
                            totalHour: 0.8021
                            discountTotalHour: 0
                            discountedTotalPerHour: 0.8013
                        instance:
                          type: object
                          example:
                            gpuCostPerHour: 0.8
                            diskHour: 0.0013
                            totalHour: 0.8021
                            discountTotalHour: 0
                            discountedTotalPerHour: 0.5034
                        storage_cost:
                          type: number
                          format: float
                          example: 0.15
                        storage_total_cost:
                          type: number
                          format: float
                          example: 0.0021
                        vram_costperhour:
                          type: number
                          format: float
                          example: 4.94e-05
                        credit_balance:
                          type:
                          - number
                          - 'null'
                          example: 4792.99
                        credit_discount:
                          type:
                          - number
                          - 'null'
                          example: 0.37
                        credit_discount_max:
                          type:
                          - number
                          - 'null'
                          example: 0.4
                        client_run_time:
                          type: number
                          format: float
                          example: 100000000.0
                        host_run_time:
                          type: number
                          format: float
                          example: 1.0
                        external:
                          type: boolean
                          example: false
                        time_remaining:
                          type: string
                          example: 12 Mon 24 D 16 Hr
                        time_remaining_isbid:
                          type: string
                          example: 11 Mon 26 D 6 Hr
                        country_code:
                          type:
                          - string
                          - 'null'
                          example: null
                        volume_info:
                          type: array
                          items:
                            type: object
                          example: []
        '400':
          description: Bad request. Returned for invalid filter column/operator, invalid
            `order_by` column, or invalid `after_token`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                    - invalid_request
                    - invalid_token
                    example: invalid_request
                  msg:
                    type: string
                    example: 'Error in query parameters: dph_total is not a valid
                      search key'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.0
      tags:
      - Instances
      operationId: showInstances
  /api/v1/invoices:
    get:
      summary: show invoices
      description: 'Returns Stripe top-ups, transfers, payouts, coinbase payments,
        and other billing transactions. For per-instance cost breakdowns, use [show
        charges](/api-reference/billing/show-charges) instead.


        CLI: `vastai show invoices-v1 --invoices`'
      security:
      - BearerAuth: []
      parameters:
      - name: select_filters
        in: query
        required: true
        description: '**`when`** (required). Date range in unix seconds (UTC). Operators:
          `gte`, `gt`, `lte`, `lt`.


          **`service`** (optional). Filter by payment service: `transfer`, `stripe_payments`,
          `bitpay`, `coinbase`, `crypto.com`, `instance_prepay`, `paypal_manual`,
          `wise_manual`. Operators: `eq`, `neq`, `in`, `notin`.


          **Examples**:

          ```json

          // January 2026, all services

          {"when":{"gte":1767225600,"lte":1769903999}}


          // Only PayPal and Wise payouts

          {"when":{"gte":1767225600,"lte":1769903999},"service":{"in":["paypal_manual","wise_manual"]}}


          // Everything except crypto

          {"when":{"gte":1767225600,"lte":1769903999},"service":{"notin":["bitpay","coinbase","crypto.com"]}}

          ```

          '
        schema:
          type: string
      - name: order_by
        in: query
        required: false
        description: 'Sort results by column. Columns: `paid_on`, `amount_cents`,
          `when`. Direction: `asc` or `desc` (default `desc`).


          Example: `[{"col":"paid_on","dir":"desc"}]`

          '
        schema:
          type: string
      - name: latest_first
        in: query
        required: false
        description: Sort newest invoices first. If `order_by` is also set, `order_by`
          takes precedence.
        schema:
          type: boolean
          default: true
          example: true
      - name: limit
        in: query
        required: false
        description: Max results per page.
        schema:
          type: integer
          minimum: 1
          default: 60
          example: 20
      - name: after_token
        in: query
        required: false
        description: 'Pass the `next_token` value from the previous response to fetch
          the next page of results. When the response returns `next_token: null`,
          there are no more pages.'
        schema:
          type: string
          example: eyJ2YWx1ZXMiOiB7ImlkIjogMjY3MjU5N30sICJvc19wYWdlIjogMH0=
      responses:
        '200':
          description: 'Invoice results. A missing or invalid `when` range also returns
            HTTP 200 with `success: false`.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  count:
                    type: integer
                    description: Number of invoices returned in this page.
                    example: 2
                  total:
                    type: integer
                    description: Total number of invoices matching the filters.
                    example: 42
                  next_token:
                    type:
                    - string
                    - 'null'
                    description: Token for the next page. `null` when no more pages.
                    example: eyJ2YWx1ZXMiOiB7ImlkIjogMjE4OTM4N30sICJvc19wYWdlIjogMH0=
                  results:
                    type: array
                    description: List of invoice entries.
                    items:
                      type: object
                      properties:
                        start:
                          type: number
                          description: Invoice creation time (unix seconds UTC).
                          example: 1761980044.0
                        end:
                          type:
                          - number
                          - 'null'
                          description: Payment time (unix seconds UTC). `null` if
                            unpaid.
                          example: 1761980301.0
                        type:
                          type: string
                          description: Invoice type. `credit`, `transfer`, `payout`,
                            `refund`, `reserved`.
                          example: credit
                        source:
                          type: string
                          description: Payment source, e.g. `stripe`, `coinbase`,
                            or sender email for transfers.
                          example: stripe
                        description:
                          type: string
                          example: Manual Billing from MASTERCARD ...7376
                        amount:
                          type: number
                          description: Amount in dollars. Negative for charges, positive
                            for transfers/payouts.
                          example: -25.0
                        metadata:
                          type: object
                          description: Additional details depending on service type.
                          properties:
                            invoice_id:
                              type: integer
                              example: 2185418
                            service:
                              type: string
                              example: stripe_payments
                        items:
                          type: array
                          description: Always empty for invoices.
                          example: []
              examples:
                success:
                  summary: Successful invoice listing
                  value:
                    success: true
                    count: 2
                    total: 42
                    next_token: eyJ2YWx1ZXMiOiB7ImlkIjogMjE4OTM4N30sICJvc19wYWdlIjogMH0=
                    results:
                    - start: 1761980044
                      end: 1761980301
                      type: credit
                      source: stripe
                      description: Manual Billing from MASTERCARD ...7376
                      amount: -25.0
                      metadata:
                        invoice_id: 2185418
                        service: stripe_payments
                      items: []
                invalid_date_range:
                  summary: Missing or invalid `when` range
                  value:
                    success: false
                    error: Invalid date range
                    count: 0
                    total: 0
                    results: []
                    next_token: null
        '400':
          description: Invalid request, e.g. malformed `after_token`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: invalid_token
                msg: Invalid pagination token
        '401':
          description: Unauthorized. May be returned in framework-level authentication
            failure cases.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden. Returned when no `Authorization` header is provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: auth_error
                msg: This action requires login.
        '404':
          description: Not Found. Returned when the supplied API key does not match
            any user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                error: auth_error
                msg: Invalid user key
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=3.0
      tags:
      - Billing
      operationId: showInvoices
  /api/v0/users/{user_id}/ipaddrs:
    get:
      summary: show ipaddrs
      description: 'This endpoint retrieves the history of IP address accesses for
        the authenticated user.


        CLI Usage: `vastai show ipaddrs`'
      security:
      - BearerAuth: []
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
        description: The ID of the user whose IP address history is being retrieved.
        example: me
      responses:
        '200':
          description: Success response with IP address history
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 123
                        user_id:
                          type: integer
                          example: 456
                        ip_address:
                          type: string
                          example: 192.168.1.1
                        timestamp:
                          type: string
                          format: date-time
                          example: '2023-10-01T12:00:00Z'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.9
      tags:
      - Accounts
      operationId: showIpaddrs
  /api/v0/machines:
    get:
      summary: show machines
      description: 'Fetches data for multiple machines associated with the authenticated
        user.


        CLI Usage: `vastai show machines [--user_id <user_id>]`'
      operationId: getMachines
      parameters:
      - name: user_id
        in: query
        required: true
        description: The ID of the user whose machines are being requested.
        schema:
          type: string
      responses:
        '200':
          description: A list of machines
          content:
            application/json:
              schema:
                type: object
                properties:
                  machines:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The unique identifier for the machine.
                        name:
                          type: string
                          description: The name of the machine.
        '401':
          description: Unauthorized - User authentication failed
        '429':
          description: Too Many Requests - Rate limit exceeded
      security:
      - BearerAuth: []
      tags:
      - Machines
  /api/v0/subaccounts:
    get:
      summary: show subaccounts
      description: 'Retrieve a list of subaccounts associated with the authenticated
        user''s account.


        CLI Usage: `vastai show subaccounts`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: A list of subaccounts.
          content:
            application/json:
              schema:
                type: object
                properties:
                  users:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          description: The unique identifier of the subaccount.
                        parent_id:
                          type: integer
                          description: The ID of the parent account.
                        key_id:
                          type: integer
                          description: The API key ID associated with the subaccount.
                        created_at:
                          type: string
                          format: date-time
                          description: The timestamp when the subaccount was created.
                        deleted_at:
                          type:
                          - string
                          - 'null'
                          format: date-time
                          description: The timestamp when the subaccount was deleted,
                            if applicable.
        '401':
          description: Unauthorized access due to invalid or missing authentication
            token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.1
      tags:
      - Accounts
      operationId: showSubaccounts
  /api/v0/team/members:
    get:
      summary: show team members
      description: 'Retrieve a list of team members associated with the authenticated
        user''s team.


        CLI Usage: `vastai show team-members`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: User ID
                      example: 123
                    username:
                      type: string
                      description: Username of the team member
                      example: johndoe
                    email:
                      type: string
                      description: Email of the team member
                      example: johndoe@example.com
                    fullname:
                      type: string
                      description: Full name of the team member
                      example: John Doe
                    roles:
                      type: array
                      description: Roles assigned to the team member
                      items:
                        type: string
                      example:
                      - admin
                      - member
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      tags:
      - Team
      operationId: showTeamMembers
  /api/v0/team/roles-full:
    get:
      summary: show team roles
      description: 'Retrieve a list of all roles for a team, excluding the owner''
        role.


        CLI Usage: `vastai show team-roles`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                      description: Name of the role
                      example: admin
                    permissions:
                      type: array
                      description: Permissions associated with the role
                      items:
                        type: string
                      example:
                      - read
                      - write
                    identifier:
                      type: string
                      description: Unique identifier for the role
                      example: admin_role
                    id:
                      type: integer
                      description: Role ID
                      example: 1234
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: auth_error
                  msg:
                    type: string
                    example: Invalid user key
      tags:
      - Team
      operationId: showTeamRoles
  /api/v0/users/current:
    get:
      summary: show user
      description: 'Retrieve information about the current authenticated user, excluding
        the API key.


        CLI Usage: `vastai show user`'
      security:
      - BearerAuth: []
      responses:
        '200':
          description: Success response with user information
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: The unique identifier of the user.
                  key_id:
                    type: integer
                    description: The API key ID associated with the user.
                  email:
                    type: string
                    description: The email address of the user.
                  balance:
                    type: number
                    format: float
                    description: The current balance of the user.
                  ssh_key:
                    type: string
                    description: The SSH key associated with the user.
                  sid:
                    type: string
                    description: Server ID.
        '401':
          description: Unauthorized access due to invalid or missing authentication
            token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      tags:
      - Accounts
      operationId: showUser
  /api/v0/deployment/{id}/start:
    post:
      summary: start deployment
      description: 'Starts (or restarts) the endpoint associated with a deployment.
        The autoscaler will begin recruiting workers according to the scaling policy.


        CLI Usage: `vastai start deployment <id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: Deployment ID
        example: 644
      responses:
        '200':
          description: Deployment started successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  endpoint_state:
                    type: string
                    example: active
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Deployment not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
      tags:
      - Serverless
      operationId: startDeployment
  /api/v0/deployment/{id}/stop:
    post:
      summary: stop deployment
      description: 'Stops the endpoint associated with a deployment. The deployment
        is not deleted and can be restarted with the start deployment endpoint.


        CLI Usage: `vastai stop deployment <id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: Deployment ID
        example: 644
      responses:
        '200':
          description: Deployment stopped successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  endpoint_state:
                    type: string
                    example: stopped
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Deployment not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.0
      tags:
      - Serverless
      operationId: stopDeployment
  /api/v0/commands/transfer_credit:
    put:
      summary: transfer credit
      description: 'Transfers specified amount of credits from the authenticated user''s
        account to another user''s account.


        The recipient can be specified by either email address or user ID.


        CLI Usage: `vastai transfer credit <recipient_email> <amount>`'
      security:
      - BearerAuth: []
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - recipient
              - amount
              properties:
                recipient:
                  type: string
                  description: Email address or user ID of the recipient
                  example: user@example.com
                amount:
                  type: number
                  format: float
                  description: Amount of credits to transfer (must be positive)
                  minimum: 0.01
                  example: 100.0
                client_id:
                  type: string
                  description: Client identifier (usually "me")
                  example: me
                apikey_id:
                  type: string
                  description: Optional API key identifier for audit logging
      responses:
        '200':
          description: Transfer completed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    enum:
                    - invalid_args
                    - invalid_params
                    - invalid_recipient
                    - insufficient_balance
                  msg:
                    type: string
                    example: Invalid amount
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=2.5
      tags:
      - Accounts
      operationId: transferCredit
  /api/v0/machines/{machine_id}/asks:
    delete:
      summary: unlist machine
      description: 'Removes all ''ask'' type offer contracts for a specified machine,
        effectively unlisting it from being available for rent.


        CLI Usage: `vastai unlist machine <id>`'
      security:
      - BearerAuth: []
      parameters:
      - name: machine_id
        in: path
        required: true
        description: The ID of the machine to unlist.
        schema:
          type: integer
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  machine_id:
                    type: integer
                    example: 123
                  user_id:
                    type: integer
                    example: 456
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=1.8
      tags:
      - Machines
      operationId: unlistMachine
  /api/v0/volumes/unlist:
    post:
      summary: unlist volume
      description: 'Remove a volume listing from the marketplace.


        CLI Usage: `vastai unlist volume <volume_id>`'
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: integer
                  description: ID of the volume listing to unlist
                  example: 2029
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  msg:
                    type: string
                    description: Success message
                    example: Unlisted Volume 2029.
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  msg:
                    type: string
                    enum:
                    - You must pass in `id` in the body of the request
                    - Volume listing does not exist
                    - Unable to delete active volume listing
                    - Unable to delete volume listing.
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: API requests too frequent endpoint threshold=5.0
      tags:
      - Volumes
      operationId: unlistVolume
components:
  schemas:
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
        msg:
          type: string
    SuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        msg:
          type: string
          example: Operation completed successfully
    SimpleBooleanSuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
    NotificationType:
      type: object
      properties:
        key:
          type: string
          description: Full notification type key.
          example: client:low_credit
        slug:
          type: string
          example: low_credit
        context:
          type: string
          enum:
          - client
          - host
        topic:
          type:
          - string
          - 'null'
          example: billing
        category:
          type: string
          example: billing
        display_name:
          type: string
          example: Low balance notifications
        default_preferences:
          type: object
          additionalProperties:
            type: boolean
          example:
            email: true
            webhooks: false
        mandatory_email:
          type: boolean
          example: false
    NotificationPreferences:
      type: object
      additionalProperties:
        type: object
        additionalProperties:
          type: object
          additionalProperties:
            type: boolean
      example:
        client:
          low_credit:
            email: true
            webhooks: false
    NotificationWebhook:
      type: object
      properties:
        id:
          type: integer
          example: 42
        user_id:
          type: integer
          example: 123
        name:
          type:
          - string
          - 'null'
          example: Ops notifications
        webhook_url:
          type: string
          format: uri
          example: https://example.com/vast/webhooks
        event_types:
          type: array
          items:
            type: string
          example:
          - client:low_credit
          - host:machine_offline
        created_at:
          type: number
          format: float
          example: 1772490000.0
        updated_at:
          type: number
          format: float
          example: 1772490000.0
    NotificationWebhookWithSecret:
      allOf:
      - $ref: '#/components/schemas/NotificationWebhook'
      - type: object
        properties:
          webhook_secret:
            type: string
            description: Secret used to verify `X-Vast-Signature-256`.
            example: <WEBHOOK_SECRET>
    NotificationWebhookCreateRequest:
      type: object
      required:
      - webhook_url
      - event_types
      properties:
        name:
          type:
          - string
          - 'null'
          maxLength: 120
        webhook_url:
          type: string
          format: uri
          maxLength: 2048
        event_types:
          type: array
          minItems: 1
          items:
            type: string
    NotificationWebhookUpdateRequest:
      type: object
      properties:
        name:
          type:
          - string
          - 'null'
          maxLength: 120
        webhook_url:
          type: string
          format: uri
          maxLength: 2048
        event_types:
          type: array
          minItems: 1
          items:
            type: string
    Template:
      type: object
      properties:
        id:
          type: integer
          description: Template ID
        name:
          type: string
          description: Template name
        image:
          type: string
          description: Docker image name
    VolumeOffer:
      type: object
      properties:
        ask_contract_id:
          type: integer
          description: Contract ID for the ask
        bundle_id:
          type: integer
          description: Bundle ID
        cpu_arch:
          type: string
          description: CPU architecture
          example: amd64
        cpu_ghz:
          type: number
          description: CPU clock speed in GHz
        cpu_name:
          type: string
          description: CPU model name
          example: AMD EPYC 7K62 48-Core Processor
        cuda_max_good:
          type: number
          description: Maximum CUDA version supported
          example: 12.8
        disk_bw:
          type: number
          description: Disk bandwidth
        disk_name:
          type: string
          description: Disk model name
          example: FIKWOT FN955 4TB
        disk_space:
          type: number
          description: Available disk space in GB
          example: 10.0
        driver_vers:
          type: string
          description: Driver version (deprecated)
        driver_version:
          type: string
          description: NVIDIA driver version
          example: 570.124.04
        duration:
          type: number
          description: Duration of the contract
        end_date:
          type: number
          description: End date as Unix timestamp
        external:
          type: boolean
          description: Whether the volume is external
        geolocation:
          type: string
          description: Geographic location
        geolocode:
          type: string
          description: Geographic location code
        gpu_arch:
          type: string
          description: GPU architecture
        host_id:
          type: integer
          description: Host ID
          example: 166946
        id:
          type: integer
          description: Unique identifier for the volume offer
        inet_down:
          type: number
          description: Download internet speed in Mbps
          example: 654.6
        inet_up:
          type: number
          description: Upload internet speed in Mbps
          example: 78.9
        machine_id:
          type: integer
          description: Machine ID
          example: 36683
        mobo_name:
          type: string
          description: Motherboard model name
          example: ROME2D32GM-2T
        reliability:
          type: number
          description: Reliability score
        reliability2:
          type: number
          description: Alternative reliability score
          example: 0.9649497
        reliability_mult:
          type: number
          description: Reliability multiplier
        start_date:
          type: number
          description: Start date as Unix timestamp
          example: 1747341046.4320989
        static_ip:
          type: boolean
          description: Whether the machine has a static IP
          example: true
        storage_cost:
          type: number
          description: Storage cost
        storage_total_cost:
          type: number
          description: Total storage cost
          example: 0.0005555555555555557
        vericode:
          type: string
          description: Verification code
        verification:
          type: string
          description: Verification status
          example: verified
        vms_enabled:
          type: boolean
          description: Whether VMs are enabled
    Instance:
      type: object
      description: Detailed information about an instance.
      properties:
        id:
          type: integer
          description: Unique identifier for the instance.
          example: 883
        actual_status:
          type:
          - string
          - 'null'
          description: Current status of the instance container.
          example: running
        intended_status:
          type: string
          description: Intended status of the instance container.
          example: running
        cur_state:
          type: string
          description: Current state of the machine contract.
          example: running
        next_state:
          type: string
          description: Next scheduled state for the machine contract.
          example: running
        label:
          type:
          - string
          - 'null'
          description: User-defined label for the instance.
          example: null
        template_id:
          type:
          - integer
          - 'null'
          description: Identifier for the instance template.
          example: null
        template_hash_id:
          type:
          - string
          - 'null'
          description: Hash identifier for the instance template.
          example: null
        template_name:
          type:
          - string
          - 'null'
          description: Name of the template (if available).
          example: null
        image_uuid:
          type: string
          description: Docker image used for the instance.
          example: tensorflow/tensorflow:latest-gpu
        image_args:
          type: array
          items:
            type: string
          description: Arguments passed to the container.
          example: []
        image_runtype:
          type: string
          description: How the container is launched (ssh, jupyter, etc.).
          example: ssh
        extra_env:
          type: array
          items:
            type: string
          description: Additional environment variables.
          example: []
        onstart:
          type:
          - string
          - 'null'
          description: Script or command run at container start.
          example: null
        jupyter_token:
          type: string
          description: Jupyter token for the instance.
          example: 53fc448d6644aa7535c6fa5498cdbedc782753e88d81b44090e54dcf1332ed30
        status_msg:
          type:
          - string
          - 'null'
          description: Status message for the instance.
          example: null
        local_ipaddrs:
          type: string
          description: Local IP addresses for the instance (space-separated).
          example: "10.2.202.31 172.17.0.1 \n"
        ssh_host:
          type: string
          description: Host (or IP) used for SSH connection.
          example: ssh2281.vast.ai
        ssh_idx:
          type: string
          description: Identifier for the SSH forwarder used.
          example: '2281'
        ssh_port:
          type: integer
          description: Port used for SSH connection.
          example: 10882
        machine_dir_ssh_port:
          type: integer
          description: Calculated SSH port for accessing the machine directory.
          example: 5300
        machine_id:
          type: integer
          description: ID of the physical machine.
          example: 178
        bundle_id:
          type: integer
          description: ID of the bundle this instance belongs to.
          example: 617
        start_date:
          type: number
          format: float
          description: Instance start time (epoch seconds).
          example: 1761008618.225083
        end_date:
          type: number
          format: float
          description: Instance end time (epoch seconds).
          example: 2034617753.0
        uptime_mins:
          type:
          - number
          - 'null'
          description: Uptime of the instance in minutes.
          example: null
        duration:
          type: number
          format: float
          description: Duration of the instance in seconds.
          example: 273608757.18784523
        cpu_arch:
          type: string
          description: CPU architecture.
          example: amd64
        cpu_cores:
          type: integer
          description: Number of CPU cores.
          example: 32
        cpu_cores_effective:
          type: number
          format: float
          description: Effective number of CPU cores allocated.
          example: 4.0
        cpu_name:
          type: string
          description: Name of the CPU.
          example: "Xeon\xAE Silver 4110"
        cpu_ram:
          type: integer
          description: Total system RAM in MB.
          example: 128576
        cpu_util:
          type: number
          format: float
          description: CPU utilization as a fraction.
          example: 0.0
        mem_limit:
          type:
          - number
          - 'null'
          description: Memory limit in megabytes.
          example: null
        mem_usage:
          type:
          - number
          - 'null'
          description: Memory usage in megabytes.
          example: null
        vmem_usage:
          type:
          - number
          - 'null'
          description: Virtual memory usage in megabytes.
          example: null
        gpu_name:
          type: string
          description: Name of the GPU.
          example: RTX A5000
        gpu_arch:
          type: string
          description: GPU architecture.
          example: nvidia
        gpu_totalram:
          type: integer
          description: Total GPU RAM in MB.
          example: 24564
        gpu_ram:
          type: integer
          description: Allocated GPU RAM in MB.
          example: 24564
        gpu_util:
          type:
          - number
          - 'null'
          description: GPU utilization as a fraction.
          example: null
        gpu_temp:
          type:
          - number
          - 'null'
          description: Current GPU temperature in Celsius.
          example: null
        gpu_frac:
          type: number
          format: float
          description: Fraction of GPU allocated.
          example: 0.125
        gpu_lanes:
          type: integer
          description: Number of PCIe lanes for the GPU.
          example: 16
        gpu_mem_bw:
          type: number
          format: float
          description: GPU memory bandwidth in GB/s.
          example: 628.8
        bw_nvlink:
          type: number
          format: float
          description: NVLink bandwidth in GB/s.
          example: 0.0
        disk_name:
          type: string
          description: Name of the disk.
          example: Samsung SSD 860
        disk_space:
          type: number
          format: float
          description: Disk space allocated in GB.
          example: 10.0
        disk_bw:
          type: number
          format: float
          description: Disk bandwidth in MB/s.
          example: 500.55
        disk_util:
          type: number
          format: float
          description: Disk utilization percentage.
          example: -1
        disk_usage:
          type: number
          format: float
          description: Disk usage percentage.
          example: -1
        direct_port_count:
          type: integer
          description: Number of direct ports available.
          example: 12
        direct_port_start:
          type: integer
          description: Start of direct port range.
          example: -1
        direct_port_end:
          type: integer
          description: End of direct port range.
          example: -1
        ports:
          type: array
          items:
            type: integer
          description: List of additional ports exposed by the instance.
          example:
          - 8080
          - 8081
        static_ip:
          type: boolean
          description: Whether the instance has a static public IP.
          example: true
        public_ipaddr:
          type: string
          description: Public IP address of the instance.
          example: 63.135.50.11
        geolocation:
          type: string
          description: Geographical location of the instance.
          example: Washington, US
        verification:
          type: string
          description: Verification status of the instance.
          example: verified
        rentable:
          type: boolean
          description: Whether the instance is currently rentable.
          example: true
        host_id:
          type: integer
          description: Host ID for the instance.
          example: 2
        hosting_type:
          type: integer
          description: Hosting type code.
          example: 1
        min_bid:
          type: number
          format: float
          description: Minimum bid price for the instance.
          example: 0.02
        is_bid:
          type: boolean
          description: Whether the instance was created via bidding.
          example: false
        dph_base:
          type: number
          format: float
          description: Base dollars per hour.
          example: 1.0
        dph_total:
          type: number
          format: float
          description: Total dollars per hour.
          example: 1.0020740740740741
        dlperf:
          type: number
          format: float
          description: Deep learning performance score.
          example: 22.229415
        dlperf_per_dphtotal:
          type: number
          format: float
          description: DLPerf per total DPH.
          example: 22.183404974866942
        flops_per_dphtotal:
          type: number
          format: float
          description: FLOPS per total DPH.
          example: 27.46814902424601
        total_flops:
          type: number
          format: float
          description: Total FLOPS.
          example: 27.52512
        score:
          type: number
          format: float
          description: Instance score.
          example: 22.043656178546772
        reliability2:
          type: number
          format: float
          description: Reliability score.
          example: 0.9993661
        os_version:
          type: string
          description: Operating system version.
          example: 18.04
        mobo_name:
          type: string
          description: Motherboard name.
          example: S7109GM2NR
        pci_gen:
          type: number
          format: float
          description: PCIe generation.
          example: 3.0
        pcie_bw:
          type: number
          format: float
          description: PCIe bandwidth in GB/s.
          example: 11.7
        num_gpus:
          type: integer
          description: Number of GPUs allocated.
          example: 1
        logo:
          type: string
          description: URL to the logo image.
          example: /static/logos/vastai_small2.png
        webpage:
          type:
          - string
          - 'null'
          description: URL to the instance's webpage, if available.
          example: null
        search:
          type: object
          description: Search pricing details.
          example:
            gpuCostPerHour: 1.0
            diskHour: 0.002074074074074074
            totalHour: 1.0020740740740741
            discountTotalHour: 0
            discountedTotalPerHour: 1.0020740740740741
        instance:
          type: object
          description: Instance pricing details.
          example:
            gpuCostPerHour: 0
            diskHour: 0.002074074074074074
            totalHour: 0.002074074074074074
            discountTotalHour: 0
            discountedTotalPerHour: 0.002074074074074074
        storage_cost:
          type: number
          format: float
          description: Storage cost per hour.
          example: 0.14933333333333335
        storage_total_cost:
          type: number
          format: float
          description: Total storage cost.
          example: 0.002074074074074074
        vram_costperhour:
          type: number
          format: float
          description: VRAM cost per hour.
          example: 4.079441760601181e-05
        credit_balance:
          type:
          - number
          - 'null'
          description: User's credit balance.
          example: null
        credit_discount:
          type:
          - number
          - 'null'
          description: User's credit discount.
          example: null
        credit_discount_max:
          type: number
          description: Maximum credit discount.
          example: 0.4
        client_run_time:
          type: number
          format: float
          description: Client run time in hours.
          example: 1.1
        host_run_time:
          type: number
          format: float
          description: Host run time in hours.
          example: 2592000.0
        external:
          type: boolean
          description: Whether the instance is external.
          example: false
        time_remaining:
          type: string
          description: Time remaining for the instance (if applicable).
          example: ''
        time_remaining_isbid:
          type: string
          description: Time remaining for the instance if it is a bid.
          example: ''
    Volume:
      type: object
      properties:
        instances:
          type: array
          description: List of instances using this volume
          items:
            type: object
        driver_version:
          type: string
          description: NVIDIA driver version
        cuda_max_good:
          type: number
          description: Maximum CUDA version supported
        machine_id:
          type: integer
          description: Unique identifier for the machine
        public_ipaddr:
          type: string
          description: Public IP address
        reliability2:
          type: number
          description: Reliability score of the host
        host_id:
          type: integer
          description: Unique identifier for the host
        cpu_name:
          type: string
          description: Name/model of the CPU
        mobo_name:
          type: string
          description: Name/model of the motherboard
        disk_space:
          type: number
          description: Disk space in GB
        disk_name:
          type: string
          description: Name/model of the disk
        inet_up:
          type: number
          description: Upload internet speed in Mbps
        inet_down:
          type: number
          description: Download internet speed in Mbps
        storage_total_cost:
          type: number
          description: Total cost for storage
        os_version:
          type: string
          description: Operating system version
        verification:
          type: string
          description: Verification status
        static_ip:
          type: boolean
          description: Whether the machine has a static IP
        cpu_arch:
          type: string
          description: CPU architecture
        start_date:
          type: number
          description: Start date as Unix timestamp
        id:
          type: integer
          description: Unique identifier for the volume
        status:
          type: string
          description: Current status of the volume
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key must be provided in the Authorization header
