{
  "openapi": "3.1.0",
  "info": {
    "title": "Vast.ai API",
    "description": "Welcome to Vast.ai 's API documentation. Our API allows you to programmatically manage GPU instances, handle machine operations, and automate your AI/ML workflow. Whether you're running individual GPU instances or managing a fleet of machines, our API provides comprehensive control over all Vast.ai  platform features.",
    "version": "1.0.0",
    "contact": {
      "name": "Vast.ai Support",
      "url": "https://discord.gg/vast"
    }
  },
  "servers": [
    {
      "url": "https://console.vast.ai",
      "description": "Production server"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/api/v0/network_disk/": {
      "post": {
        "summary": "add network-disk",
        "description": "Adds a network disk to be used to create network volume offers, or adds machines to an existing network disk.\n\nCLI Usage: `vastai add network_disk <machine_id>... <mount_point> [options]`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "mount_point"
                ],
                "properties": {
                  "machine_id": {
                    "type": "integer",
                    "description": "ID of the machine to add network disk to"
                  },
                  "machine_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "IDs of machines to add network disk to"
                  },
                  "mount_point": {
                    "type": "string",
                    "description": "Path to mount point of networked storage on machine or machines"
                  },
                  "disk_id": {
                    "type": "integer",
                    "description": "ID of network disk, if adding machines to existing disk"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "disk_id": {
                      "type": "integer",
                      "description": "ID of disk created or added to machines"
                    }
                  },
                  "example": {
                    "success": true,
                    "disk_id": 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"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "not_authorized"
                    },
                    "msg": {
                      "type": "string",
                      "example": "Only machine owner can add network disk"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Network Volumes"
        ]
      }
    },
    "/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.\n\nCLI 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"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "tags": [
          "Instances"
        ]
      }
    },
    "/api/v0/commands/copy_direct/": {
      "delete": {
        "summary": "cancel copy",
        "description": "Cancel a remote copy operation specified by the destination ID (dst_id).\n\nCLI 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.\n\nCLI 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.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/commands/rclone/": {
      "delete": {
        "summary": "cancel sync",
        "description": "Cancels an in-progress remote sync operation identified by the destination instance ID.\nThis operation cannot be resumed once canceled and must be restarted if needed.\n\nCLI 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"
        ]
      },
      "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.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/instances/bid_price/{id}/": {
      "put": {
        "summary": "change bid",
        "description": "Change the current bid price of an instance to a specified price.\n\nCLI 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,
                    "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"
        ]
      }
    },
    "/api/v0/machines/{machine_id}/cleanup/": {
      "put": {
        "summary": "cleanup machine",
        "description": "This endpoint removes expired contracts on a specified machine, freeing up space.\n\nCLI 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
                    },
                    "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"
        ]
      }
    },
    "/api/v0/auth/apikeys/": {
      "post": {
        "summary": "create api-key",
        "description": "Creates a new API key with specified permissions for the authenticated user.\n\nCLI 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"
        ]
      },
      "get": {
        "summary": "show api keys",
        "description": "Retrieves all API keys associated with the authenticated user.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/workergroups/": {
      "post": {
        "summary": "create workergroup",
        "description": "Creates a new workergroup configuration that manages worker instances for a serverless endpoint.\n\nCLI Usage: `vastai create workergroup --template_hash <hash> --endpoint_name <name> [options]`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "endpoint_name": {
                    "type": "string",
                    "description": "Name of the endpoint group",
                    "example": "vLLM-Qwen3-8B"
                  },
                  "endpoint_id": {
                    "type": "integer",
                    "description": "ID of existing endpoint group (alternative to endpoint_name)",
                    "example": 123
                  },
                  "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 query for finding worker instances (alternative to template)",
                    "default": "verified=true rentable=true rented=false",
                    "example": "gpu_name=RTX_3090 rentable=true"
                  },
                  "launch_args": {
                    "type": "string",
                    "description": "Additional launch arguments for worker instances",
                    "example": "--env VAR=value"
                  },
                  "min_load": {
                    "type": "number",
                    "description": "Minimum load threshold for scaling",
                    "default": 1,
                    "example": 1
                  },
                  "target_util": {
                    "type": "number",
                    "description": "Target GPU utilization",
                    "default": 0.9,
                    "example": 0.9
                  },
                  "cold_mult": {
                    "type": "number",
                    "description": "Cold start multiplier",
                    "default": 3,
                    "example": 3
                  },
                  "cold_workers": {
                    "type": "integer",
                    "description": "Number of cold workers to maintain",
                    "default": 3,
                    "example": 3
                  },
                  "max_workers": {
                    "type": "integer",
                    "description": "Maximum number of worker instances",
                    "default": 20,
                    "example": 20
                  },
                  "test_workers": {
                    "type": "integer",
                    "description": "Number of test workers",
                    "default": 3,
                    "example": 3
                  },
                  "gpu_ram": {
                    "type": "integer",
                    "description": "Minimum GPU RAM in GB",
                    "default": 24,
                    "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"
        ]
      },
      "get": {
        "summary": "show workergroup",
        "description": "Retrieves the list of workergroups associated with the authenticated user.\n\nCLI 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
                          },
                          "target_util": {
                            "type": "number",
                            "example": 0.9
                          },
                          "cold_mult": {
                            "type": "number",
                            "example": 3
                          },
                          "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"
        ]
      }
    },
    "/api/v0/endptjobs/": {
      "post": {
        "summary": "create endpoint",
        "description": "This endpoint creates a new job processing endpoint with specified parameters.\n\nCLI Usage: `vastai create endpoint [options]`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "min_load": {
                    "type": "number",
                    "description": "Minimum load for the endpoint.",
                    "default": 10,
                    "example": 50
                  },
                  "target_util": {
                    "type": "number",
                    "description": "Target utilization for the endpoint.",
                    "default": 0.9,
                    "example": 0.75
                  },
                  "cold_mult": {
                    "type": "number",
                    "description": "Multiplier for cold start.",
                    "default": 2.5,
                    "example": 2
                  },
                  "cold_workers": {
                    "type": "integer",
                    "description": "Number of cold workers.",
                    "default": 5,
                    "example": 5
                  },
                  "max_workers": {
                    "type": "integer",
                    "description": "Maximum number of workers.",
                    "default": 20,
                    "example": 20
                  },
                  "endpoint_name": {
                    "type": "string",
                    "description": "Name of the endpoint.",
                    "default": "default-endpoint",
                    "example": "my_endpoint"
                  }
                }
              }
            }
          }
        },
        "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"
        ]
      },
      "get": {
        "summary": "show endpoints",
        "description": "Retrieve a list of endpoint jobs for the authenticated user.\n\nCLI 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
                          },
                          "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"
        ]
      }
    },
    "/api/v0/secrets/": {
      "post": {
        "summary": "create env-var",
        "description": "Creates a new encrypted environment variable for the authenticated user.\nKeys are automatically converted to uppercase. Values are encrypted before storage.\nThere is a limit on the total number of environment variables per user.\n\nCLI 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"
        ]
      },
      "delete": {
        "summary": "delete env var",
        "description": "Deletes an environment variable associated with the authenticated user.\nThe variable must exist and belong to the requesting user.\n\nCLI 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.\n\nCLI 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"
        ]
      },
      "put": {
        "summary": "update env var",
        "description": "Updates the value of an existing environment variable for the authenticated user.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/asks/{id}/": {
      "put": {
        "summary": "create instance",
        "description": "Creates a new instance by accepting an \"ask\" contract from a provider.\n\n- Use the search offers endpoint to discover available machines.\n- If `template_id` is provided, those template defaults are either merged or overridden by parameters specified in the request body.\n\n**Template Precedence Rules:**\n- **Scalar fields** (image, disk, runtype, etc.): Request value overrides template value\n- **`env`**: Merged by key. Request values win on key conflicts\n- **`extra_filters`**: Merged by key. Request values win on key conflicts\n\nFor detailed template usage, see [Creating and Using Templates with API](/api-reference/creating-and-using-templates-with-api).\n\nCLI 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.\n"
                  },
                  "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.\n\nExample: `4e17788f74f075dd9aab7d0d4427968f`\n"
                  },
                  "label": {
                    "type": "string",
                    "description": "Custom name for the instance"
                  },
                  "disk": {
                    "type": "number",
                    "format": "float",
                    "description": "Size of local disk partition (in GB)\n"
                  },
                  "runtype": {
                    "type": "string",
                    "description": "Launch mode for the instance. If omitted, defaults to 'ssh' unless `args/args_str` is provided.\n",
                    "enum": [
                      "ssh",
                      "jupyter",
                      "args",
                      "ssh_proxy",
                      "ssh_direct",
                      "jupyter_proxy",
                      "jupyter_direct"
                    ]
                  },
                  "target_state": {
                    "type": "string",
                    "description": "Desired initial state of the instance\n",
                    "enum": [
                      "running",
                      "stopped"
                    ]
                  },
                  "price": {
                    "type": "number",
                    "description": "Bid price per machine (in $/hour). Only for interruptible instances",
                    "minimum": 0.001,
                    "maximum": 128
                  },
                  "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.\n\nExample: `\"-e HF_TOKEN=hf_xxx123456789 -e MODEL_ID=TheBloke/Llama-2-7B-Chat-GPTQ -p 8000:8000\"`\n"
                  },
                  "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\n\nExample : `[\"bash\", \"-c\", \"env | grep _ >> /etc/environment; echo 'starting up'\"]`\n"
                  },
                  "args_str": {
                    "type": "string",
                    "description": "Arguments string to pass to the entrypoint (alternative to args)\n\nExample : `args_str: bash -c \"env | grep _ >> /etc/environment; echo 'starting up'\"`\n"
                  },
                  "use_jupyter_lab": {
                    "type": "boolean",
                    "description": "Launch instance with jupyter lab instead of notebook"
                  },
                  "jupyter_dir": {
                    "type": "string",
                    "description": "Directory to launch Jupyter from\n\nExample : `/home/notebooks`\n"
                  },
                  "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`)\n"
                      },
                      "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"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v0/network_volume/": {
      "put": {
        "summary": "create network-volume",
        "description": "Creates a network volume from an offer.\n\nCLI Usage: `vastai create network-volume <offer_id> <size> [--name <name>]`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "size"
                ],
                "properties": {
                  "id": {
                    "type": "integer",
                    "description": "ID of network volume ask being accepted"
                  },
                  "size": {
                    "type": "integer",
                    "description": "size of network volume in GB being created"
                  },
                  "name": {
                    "type": "string",
                    "description": "optional name for network volume being created"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "volume_name": {
                      "type": "string",
                      "description": "name of network volume created"
                    },
                    "volume_size": {
                      "type": "integer",
                      "description": "size of network volume created"
                    }
                  },
                  "example": {
                    "success": true,
                    "id": 6,
                    "msg": "Deleted network volume listing"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "invalid_args"
                    },
                    "msg": {
                      "type": "string",
                      "example": "You must pass in `id` in the body of the request"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "not_authorized"
                    },
                    "msg": {
                      "type": "string",
                      "example": "Authorization Error. Check that you have proper privileges to perform this action."
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Network Volumes"
        ]
      },
      "post": {
        "summary": "list network-volume",
        "description": "Lists a network disk for rent as network volumes, or updates an existing listing with a new price/size/end date/discount.\n\nCLI Usage: `vastai list network-volume <disk_id> [options]`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "disk_id"
                ],
                "properties": {
                  "price_disk": {
                    "type": "number",
                    "format": "float",
                    "description": "Price per GB of network volume storage"
                  },
                  "disk_id": {
                    "type": "integer",
                    "description": "ID of network disk for which offer is being created"
                  },
                  "size": {
                    "type": "integer",
                    "description": "Size in GB of the amount of space available to be rented"
                  },
                  "credit_discount_max": {
                    "type": "number",
                    "format": "float",
                    "description": "Maximum discount rate allowed for prepaid credits"
                  },
                  "end_date": {
                    "type": "number",
                    "format": "float",
                    "description": "Unix timestamp for when the listing expires"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "msg": {
                      "type": "string",
                      "description": "status message"
                    }
                  },
                  "example": {
                    "success": true,
                    "disk_id": "created network volume ask with id 6 and size 24"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "invalid_args"
                    },
                    "msg": {
                      "type": "string",
                      "example": "Invalid disk_id"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "not_authorized"
                    },
                    "msg": {
                      "type": "string",
                      "example": "Could not find network disk with id 6 associated with user"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Network Volumes"
        ]
      }
    },
    "/api/v0/ssh/": {
      "post": {
        "summary": "create ssh-key",
        "description": "Creates a new SSH key and associates it with your account.\nThe key will be automatically added to all your current instances.\n\nCLI 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",
                          "format": "date-time",
                          "nullable": true,
                          "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"
        ]
      },
      "get": {
        "summary": "show ssh keys",
        "description": "Retrieve a list of SSH keys associated with the authenticated user's account.\n\nCLI 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",
                        "format": "date-time",
                        "nullable": true,
                        "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.\n\nCLI 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"
        ]
      },
      "put": {
        "summary": "set user",
        "description": "Updates the user data for the authenticated user.\n\nCLI 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"
        ]
      }
    },
    "/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:\n- **Owner**: Full access to all team resources, settings, and member management. The team owner is the user who creates the team.\n- **Manager**: All permissions of owner except team deletion.\n- **Member**: Can view, create, and interact with instances, but cannot access billing, team management, autoscaler, or machines.\n\n- 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).\n- You can optionally transfer credits from your personal account to the new team account using the `transfer_credit` field.\n\nCLI 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",
                  "permissions"
                ],
                "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"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "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.\n\nCLI 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"
        ]
      }
    },
    "/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.\n\nCLI 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"
                }
              }
            }
          }
        }
      }
    },
    "/api/v0/template/": {
      "post": {
        "summary": "create template",
        "description": "Creates a new template for launching instances.\n\nTemplates 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.\n\nFor detailed usage, see [Creating and Using Templates with API](/api-reference/creating-and-using-templates-with-api).\n\nCLI 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.\n"
                  },
                  "env": {
                    "type": "string",
                    "description": "Environment variables and port mappings in Docker flag format.\n\nExample: `\"-e HF_TOKEN=hf_xxx123456789 -e MODEL_ID=TheBloke/Llama-2-7B-Chat-GPTQ -p 8000:8000\"`\n"
                  },
                  "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.\n"
                  },
                  "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\n\nExample : `/home/notebooks`\n"
                  },
                  "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}}`\n"
                  },
                  "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",
                    "nullable": true,
                    "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.\n"
                  },
                  "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"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing API key"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      },
      "delete": {
        "summary": "delete template",
        "description": "Deletes an existing template.\n\nPass the template's numeric `id` (not `hash_id`) in the request body.\n\nFor detailed usage, see [Creating and Using Templates with API](/api-reference/creating-and-using-templates-with-api).\n\nCLI 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"
          }
        }
      },
      "put": {
        "summary": "edit template",
        "description": "Edits an existing template in place.\n\nTemplates are mutable. Use PUT with the template's `hash_id` to update it. You only need to include the fields you want to change - unchanged fields retain their existing values.\n\nNote: The template's `hash_id` will change after editing (since it's content-based), but the numeric `id` stays the same.\n\nFor detailed usage, see [Creating and Using Templates with API](/api-reference/creating-and-using-templates-with-api).\n\nCLI Usage: `vastai update template <hash_id> [options]`",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "hash_id"
                ],
                "properties": {
                  "hash_id": {
                    "type": "string",
                    "description": "Hash ID of the template to edit. Required for identifying which template to update."
                  },
                  "name": {
                    "type": "string",
                    "description": "Name of the template"
                  },
                  "image": {
                    "type": "string",
                    "description": "Docker image path"
                  },
                  "desc": {
                    "type": "string",
                    "description": "Short description of the template"
                  },
                  "recommended_disk_space": {
                    "type": "number",
                    "description": "Recommended disk space in GB"
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "hash_id": "5915f1dc1ce881defb572015eb9d8178",
                "desc": "Updated description",
                "recommended_disk_space": 16
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Template updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "template": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "description": "Template numeric ID (unchanged after edit)"
                        },
                        "hash_id": {
                          "type": "string",
                          "description": "Updated template hash ID (changes based on content)"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing API key"
          },
          "404": {
            "description": "Template not found"
          }
        }
      },
      "get": {
        "summary": "search templates",
        "description": "Searches for templates using filter-based queries.\n\nUse `select_filters` to search by specific field conditions. Results include both your own templates and publicly shared templates.\n\n**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`\n\n**Operators:** `eq`, `neq`, `lt`, `lte`, `gt`, `gte`, `in`, `notin`\n\nFor detailed usage, see [Creating and Using Templates with API](/api-reference/creating-and-using-templates-with-api).\n\nCLI 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}}`\n"
          },
          {
            "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.\n"
          },
          {
            "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"
        ]
      }
    },
    "/api/v0/auth/apikeys/{id}/": {
      "delete": {
        "summary": "delete api key",
        "description": "Deletes an existing API key belonging to the authenticated user.\nThe API key is soft-deleted by setting a deleted_at timestamp.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/workergroups/{id}/": {
      "delete": {
        "summary": "delete workergroup",
        "description": "Deletes an existing workergroup.\n\nCLI 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"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    },
                    "msg": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "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
                    }
                  }
                }
              }
            }
          },
          "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"
        ]
      },
      "put": {
        "summary": "update workergroup",
        "description": "Updates the properties of an existing workergroup based on the provided parameters.\n\nCLI 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",
                "properties": {
                  "min_load": {
                    "type": "number",
                    "description": "Minimum load for the workergroup.",
                    "example": 1
                  },
                  "target_util": {
                    "type": "number",
                    "description": "Target utilization for the workergroup.",
                    "example": 0.9
                  },
                  "cold_mult": {
                    "type": "number",
                    "description": "Cold multiplier for the workergroup.",
                    "example": 3
                  },
                  "test_workers": {
                    "type": "integer",
                    "description": "Number of test workers for performance estimation.",
                    "default": 3,
                    "example": 3
                  },
                  "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 parameters for offers (JSON object or query string).",
                    "default": "verified=true rentable=true rented=false",
                    "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 RAM requirement.",
                    "example": 24
                  },
                  "endpoint_name": {
                    "type": "string",
                    "description": "Deployment endpoint name.",
                    "example": "vLLM-Qwen3-8B"
                  },
                  "endpoint_id": {
                    "type": "integer",
                    "description": "Deployment endpoint ID.",
                    "example": 123
                  }
                }
              }
            }
          }
        },
        "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"
        ]
      }
    },
    "/api/v0/endptjobs/{id}/": {
      "delete": {
        "summary": "delete endpoint",
        "description": "Deletes an endpoint group by ID. Associated workergroups will also be deleted.\n\nCLI 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"
        ]
      },
      "put": {
        "summary": "update endpoint",
        "description": "Updates the specified endpoint group with the provided parameters.\n\nCLI 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
                  },
                  "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
                  },
                  "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"
        ]
      }
    },
    "/api/v0/ssh/{id}/": {
      "delete": {
        "summary": "delete ssh key",
        "description": "Removes an SSH key from the authenticated user's account\n\nCLI 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.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/volumes/": {
      "delete": {
        "summary": "delete volume",
        "description": "Delete a volume by its ID.\n\nCLI 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"
        ]
      },
      "put": {
        "summary": "rent volume",
        "description": "Rent/create a new volume with specified parameters.\n\nCLI 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"
        ]
      },
      "get": {
        "summary": "list volumes",
        "description": "Retrieve information about all volumes rented by you.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/instances/{id}/": {
      "delete": {
        "summary": "destroy instance",
        "description": "Destroys/deletes an instance permanently. This is irreversible and will delete all data.\n\nCLI 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"
        ]
      },
      "put": {
        "summary": "manage instance",
        "description": "Manage instance state and labels. The operation is determined by the request body parameters.\n\nCLI Usage:\n- To stop: `vastai stop instance <id>`\n- To start: `vastai start instance <id>`\n- 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"
        ]
      },
      "get": {
        "summary": "show instance",
        "description": "Retrieves the details of a specific instance for the authenticated user.\n\nCLI 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 – Invalid instance ID or invalid arguments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized – 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 – 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"
        ]
      }
    },
    "/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.\n\nCLI 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\n",
            "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"
        ]
      }
    },
    "/api/v0/instances/command/{id}/": {
      "put": {
        "summary": "execute",
        "description": "Executes a constrained remote command on a specified instance.\nThe command output can be retrieved from the returned result URL.\n\nCLI 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"
        ]
      }
    },
    "/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.\n\nCLI Usage: `vastai get workergroup logs <id> [--tail <num_lines>]`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id"
                ],
                "properties": {
                  "id": {
                    "type": "integer",
                    "description": "ID of the worker group",
                    "default": 12345,
                    "example": 12345,
                    "minimum": 1
                  },
                  "tail": {
                    "type": "integer",
                    "description": "Number of log lines to retrieve from the end",
                    "default": 10000,
                    "example": 1000,
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Logs successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "title": "Success - Logs Retrieved",
                      "type": "object",
                      "properties": {
                        "logs": {
                          "type": "string",
                          "description": "The workergroup logs",
                          "example": "2023-10-01 12:00:00 - Workergroup started\n2023-10-01 12:01:00 - Instance scaled up"
                        }
                      }
                    },
                    {
                      "title": "Error Response",
                      "type": "string",
                      "description": "Error message when workergroup not found or authentication fails",
                      "example": "authenticate_workergroup_apikey: invalid api_key or workergroup 12345 not found"
                    }
                  ]
                }
              }
            }
          }
        },
        "tags": [
          "Serverless"
        ]
      }
    },
    "/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.\nUseful for monitoring, debugging connectivity issues, and understanding resource usage within a workergroup.\n\nCLI Usage: `vastai get workergroup workers <id>`",
        "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": "Workergroup instance ID",
                                "example": 67890
                              },
                              "status": {
                                "type": "string",
                                "description": "Current worker status",
                                "example": "running"
                              },
                              "url": {
                                "type": "string",
                                "description": "Worker instance URL",
                                "example": "http://192.168.1.10:8000"
                              },
                              "created_at": {
                                "type": "string",
                                "description": "When the worker was created",
                                "example": "2023-10-01T12:00:00Z"
                              }
                            }
                          }
                        }
                      }
                    },
                    {
                      "title": "Error Response",
                      "type": "string",
                      "description": "Error message when workergroup not found or authentication fails",
                      "example": "authenticate_workergroup_apikey: invalid api_key or workergroup 12345 not found"
                    }
                  ]
                }
              }
            }
          }
        },
        "tags": [
          "Serverless"
        ]
      }
    },
    "/get_endpoint_logs/": {
      "post": {
        "servers": [
          {
            "url": "https://run.vast.ai",
            "description": "Production server"
          }
        ],
        "summary": "get endpoint logs",
        "description": "Retrieves logs for a specific endpoint by name.\n\nCLI Usage: `vastai get endpoint logs <endpoint_name> [--tail <num_lines>]`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "endpoint"
                ],
                "properties": {
                  "endpoint": {
                    "type": "string",
                    "description": "Name of the endpoint",
                    "example": "vLLM-Qwen3-8B"
                  },
                  "tail": {
                    "type": "integer",
                    "description": "Number of log lines to retrieve from the end",
                    "default": 10000,
                    "example": 1000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully retrieved endpoint logs.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "title": "Success - Logs Retrieved",
                      "type": "object",
                      "properties": {
                        "logs": {
                          "type": "string",
                          "description": "The endpoint logs",
                          "example": "2023-10-01 12:00:00 - Worker started\n2023-10-01 12:01:00 - Request processed"
                        }
                      }
                    },
                    {
                      "title": "Error Response",
                      "type": "string",
                      "description": "Error message when endpoint not found or authentication fails",
                      "example": "authenticate_endpoint_apikey: invalid api_key or endpoint vLLM-Qwen3-8B not found"
                    }
                  ]
                }
              }
            }
          }
        },
        "tags": [
          "Serverless"
        ]
      }
    },
    "/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.\nUseful for monitoring, debugging connectivity issues, and understanding resource usage.\n\nCLI Usage: `vastai get endpoint 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 endpoints workers.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "title": "Success - Workers Retrieved",
                      "type": "object",
                      "properties": {
                        "workers": {
                          "type": "array",
                          "description": "List of workers for this endpoint",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer",
                                "description": "Worker instance ID",
                                "example": 67890
                              },
                              "status": {
                                "type": "string",
                                "description": "Current worker status",
                                "example": "running"
                              },
                              "url": {
                                "type": "string",
                                "description": "Worker instance URL",
                                "example": "http://192.168.1.10:8000"
                              },
                              "created_at": {
                                "type": "string",
                                "description": "When the worker was created",
                                "example": "2023-10-01T12:00:00Z"
                              }
                            }
                          }
                        }
                      }
                    },
                    {
                      "title": "Error Response",
                      "type": "string",
                      "description": "Error message when endpoint not found or authentication fails",
                      "example": "authenticate_endpoint_apikey: invalid api_key or endpoint vLLM-Qwen3-8B not found"
                    }
                  ]
                }
              }
            }
          }
        },
        "tags": [
          "Serverless"
        ]
      }
    },
    "/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.\n\nCLI 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"
        ]
      }
    },
    "/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.\nAllows setting pricing, minimum GPU requirements, end date and discount rates.\n\nCLI 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"
        ]
      }
    },
    "/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.\n\nCLI 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"
                    }
                  }
                }
              }
            }
          },
          "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"
                    }
                  }
                }
              }
            }
          },
          "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."
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Instances"
        ]
      }
    },
    "/api/v0/instances/prepay/{id}/": {
      "put": {
        "summary": "prepay instance",
        "description": "Deposit credits into a reserved instance to receive usage discounts.\nThe discount rate is calculated based on how many months of usage the prepaid amount covers. Maximum discount is typically 40%.\n\nCLI 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
                  }
                }
              }
            }
          }
        },
        "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"
        ]
      }
    },
    "/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.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/instances/recycle/{id}/": {
      "put": {
        "summary": "recycle instance",
        "description": "Destroys and recreates container in place (from newly pulled image) without losing GPU priority.\nUpdates container status to 'recycling' and executes docker stop/remove commands on the host machine.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/machines/{machine_id}/defjob/": {
      "delete": {
        "summary": "remove defjob",
        "description": "Deletes the default job (background instances) for a specified machine.\n\nCLI 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"
        ]
      }
    },
    "/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.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/team/roles/{name}": {
      "delete": {
        "summary": "remove team role",
        "description": "Removes a role from the team. Cannot remove the team owner role.\n\nCLI 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"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/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.\n\nCLI 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"
        ]
      }
    },
    "/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.\nThe engine will return either a ready worker URL or status information if no workers are available.\n\nCLI 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,
                    "example": 242,
                    "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
                        },
                        "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"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Invalid endpoint or missing required parameters"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - authentication failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Authentication failed"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Serverless"
        ]
      }
    },
    "/api/v0/machines/{machine_id}/dnotify": {
      "put": {
        "summary": "schedule maint",
        "description": "Schedules a maintenance window for a specified machine and notifies clients.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/benchmarks/": {
      "get": {
        "summary": "search benchmarks",
        "description": "Retrieve benchmark data based on search parameters.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/network_volumes/search/": {
      "post": {
        "summary": "search network volumes",
        "description": "Search for available network volume offers with advanced filtering and sorting.\n\nCLI Usage: `vastai search network-volumes <query> [--order <field>]`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "q": {
                    "type": "object",
                    "properties": {
                      "verified": {
                        "type": "object",
                        "description": "Display offers where all machines in cluster are verified",
                        "example": {
                          "eq": true
                        }
                      },
                      "order": {
                        "type": "array",
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "description": "Sort fields and directions",
                        "example": [
                          [
                            "storage_cost",
                            "asc"
                          ]
                        ]
                      },
                      "limit": {
                        "type": "integer",
                        "description": "Max results to return"
                      },
                      "reliability2": {
                        "type": "object",
                        "description": "Cluster reliability score (0-1)",
                        "example": {
                          "gt": 0.98
                        }
                      },
                      "inet_down": {
                        "type": "object",
                        "description": "Download bandwidth (MB/s)",
                        "example": {
                          "gt": 100
                        }
                      },
                      "inet_up": {
                        "type": "object",
                        "description": "Upload bandwidth (MB/s)",
                        "example": {
                          "gt": 100
                        }
                      },
                      "geolocation": {
                        "type": "object",
                        "description": "Cluster location (two letter country code)",
                        "example": {
                          "in": [
                            "TW",
                            "SE"
                          ]
                        }
                      },
                      "disk_bw": {
                        "type": "object",
                        "description": "Disk read bandwidth in MB/s",
                        "example": {
                          "gt": 500
                        }
                      },
                      "duration": {
                        "type": "object",
                        "description": "Maximum rental duration in days",
                        "example": {
                          "gte": 30
                        }
                      },
                      "storage_cost": {
                        "type": "object",
                        "description": "Storage cost in $/GB/month",
                        "example": {
                          "lte": 0.1
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful search response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "offers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ask_contract_id": {
                            "type": "integer",
                            "description": "Unique offer ID"
                          },
                          "disk_space": {
                            "type": "number",
                            "description": "Storage space in GB"
                          },
                          "inet_up": {
                            "type": "number",
                            "description": "Upload bandwidth (MB/s)"
                          },
                          "inet_down": {
                            "type": "number",
                            "description": "Download bandwidth (MB/s)"
                          },
                          "reliability2": {
                            "type": "number",
                            "description": "Cluster reliability score (0-1)"
                          },
                          "verified": {
                            "type": "boolean",
                            "description": "Cluster verification status"
                          },
                          "geolocation": {
                            "type": "string",
                            "description": "Geographic location"
                          },
                          "nw_disk_avg_bw": {
                            "type": "integer",
                            "description": "Average read bw of network disk from machines in cluster"
                          },
                          "nw_disk_max_bw": {
                            "type": "integer",
                            "description": "Max read bw of network disk from machines in cluster"
                          },
                          "nw_disk_min_bw": {
                            "type": "integer",
                            "description": "Min read bw of network disk from machines in cluster"
                          },
                          "start_date": {
                            "type": "number",
                            "description": "start date of offer, in epoch time"
                          },
                          "end_date": {
                            "type": "number",
                            "description": "end date of offer, in epoch time"
                          },
                          "storage_cost": {
                            "type": "number",
                            "description": "storage cost in $/GB/month"
                          },
                          "storage_cost_total": {
                            "type": "number",
                            "description": "total storage cost per hour for rented space"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid query parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "tags": [
          "Network Volumes"
        ]
      }
    },
    "/api/v0/bundles/": {
      "post": {
        "summary": "search offers",
        "description": "Search for available GPU machine offers with advanced filtering and sorting.\n\nEach filter parameter (such as `verified`, `gpu_name`, `num_gpus`, etc.) should be an object specifying the operator and value you want to match.\n\n**Filter operators:**\n\n| Operator | Meaning                | Example                        |\n|:---------|:-----------------------|:-------------------------------|\n| `eq`     | Equal to               | `{ \"eq\": true }`               |\n| `neq`    | Not equal to           | `{ \"neq\": false }`             |\n| `gt`     | Greater than           | `{ \"gt\": 0.99 }`               |\n| `lt`     | Less than              | `{ \"lt\": 10000 }`              |\n| `gte`    | Greater than or equal  | `{ \"gte\": 4 }`                 |\n| `lte`    | Less than or equal     | `{ \"lte\": 8 }`                 |\n| `in`     | Value is in a list     | `{ \"in\": [\"RTX_3090\", \"RTX_4090\"] }` |\n| `notin`  | Value is not in a list | `{ \"notin\": [\"TW\", \"SE\"] }`    |\n\nCLI 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.\n\n- **ondemand**: Fixed pricing based on listed rates. Default.\n- **bid** (interruptible): Uses minimum bid price. Lower cost but may be interrupted if outbid.\n- **reserved**: Reserved instance pricing.\n"
                  },
                  "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.\nThis is useful for finding offers on machines you're already renting.\n",
                    "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": "Sort fields and directions",
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "minItems": 2,
                    "maxItems": 2
                  },
                  "allocated_storage": {
                    "type": "number",
                    "description": "Storage allocation size in GB for the instance.\nThis sets the disk size when creating the instance and cannot be changed later.\nDefault is 8GB.\n"
                  }
                }
              },
              "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": "Invalid user key"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Search"
        ]
      }
    },
    "/api/v0/volumes/search/": {
      "post": {
        "summary": "search volumes",
        "description": "Search for available volumes based on specified criteria.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/machines/create_bids/": {
      "put": {
        "summary": "set defjob",
        "description": "Creates default jobs (background instances) for a specified machine with the given parameters.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/machines/{machine_id}/minbid/": {
      "put": {
        "summary": "set min-bid",
        "description": "Sets the minimum bid price for a specified machine.\n\nCLI 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"
        ]
      }
    },
    "/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.\n\nCLI: `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`.\n\n**`type`** (optional). Filter by contract type: `instance`, `volume`, `serverless`. Operator: `in`.\n\n**Examples**:\n```json\n// All charges in January 2026\n{\"day\":{\"gte\":1767225600,\"lte\":1769903999}}\n\n// Only instance charges\n{\"day\":{\"gte\":1767225600,\"lte\":1769903999},\"type\":{\"in\":[\"instance\"]}}\n\n// Volumes and serverless only\n{\"day\":{\"gte\":1767225600,\"lte\":1769903999},\"type\":{\"in\":[\"volume\",\"serverless\"]}}\n```\n",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "- `table` (default) flat list of per-contract rows with `type: \"instance\"` or `\"volume\"`.\n- `tree` serverless contracts are collapsed under endpoint/workergroup wrappers with `type: \"serverless\"` and `source: \"endpoint-<id>\"` / `\"workergroup-<id>\"`. Regular instances and volumes are unchanged.\n",
            "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",
                      "nullable": true,
                      "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",
                                  "nullable": true,
                                  "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.\n",
            "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"
        ]
      }
    },
    "/api/v0/users/cloud_integrations/": {
      "get": {
        "summary": "show connections",
        "description": "Retrieves the list of cloud connections associated with the authenticated user.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/instances/balance/{id}/": {
      "get": {
        "summary": "show deposit",
        "description": "Retrieves the deposit details for a specified instance.\n\nCLI 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
                    },
                    "total_discount": {
                      "type": "number",
                      "description": "The total discount applied.",
                      "example": 10
                    },
                    "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"
        ]
      }
    },
    "/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.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/instances/{instance_id}/ssh/": {
      "get": {
        "summary": "show ssh-keys",
        "description": "Retrieves the SSH keys associated with a specific instance.\n\nCLI Usage: `vastai show ssh-keys <instance_id>`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "instance_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"
        ]
      }
    },
    "/api/v1/instances/": {
      "get": {
        "summary": "show instances",
        "description": "Retrieve a paginated list of instances for the authenticated user.\nSupports keyset pagination (max 25 per page), filtering, column selection, and sorting.\n\nCLI 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 ≤ 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`.\nFilterable 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.\n",
            "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",
                      "nullable": true,
                      "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",
                            "nullable": true,
                            "example": "running"
                          },
                          "cur_state": {
                            "type": "string",
                            "example": "running"
                          },
                          "next_state": {
                            "type": "string",
                            "example": "running"
                          },
                          "intended_status": {
                            "type": "string",
                            "example": "running"
                          },
                          "label": {
                            "type": "string",
                            "nullable": true,
                            "example": "ML Training Job 2025"
                          },
                          "template_id": {
                            "type": "integer",
                            "nullable": true,
                            "example": 2048
                          },
                          "template_hash_id": {
                            "type": "string",
                            "nullable": true,
                            "example": "abcde12345"
                          },
                          "template_name": {
                            "type": "string",
                            "nullable": true,
                            "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",
                            "nullable": true,
                            "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
                          },
                          "uptime_mins": {
                            "type": "number",
                            "nullable": true,
                            "example": null
                          },
                          "duration": {
                            "type": "number",
                            "format": "float",
                            "example": 86400
                          },
                          "cpu_arch": {
                            "type": "string",
                            "example": "amd64"
                          },
                          "cpu_cores": {
                            "type": "integer",
                            "example": 4
                          },
                          "cpu_cores_effective": {
                            "type": "number",
                            "format": "float",
                            "example": 4
                          },
                          "cpu_name": {
                            "type": "string",
                            "example": "Core™ i5-6500"
                          },
                          "cpu_ram": {
                            "type": "integer",
                            "example": 15989
                          },
                          "cpu_util": {
                            "type": "number",
                            "format": "float",
                            "example": 0
                          },
                          "mem_limit": {
                            "type": "number",
                            "nullable": true,
                            "example": 15.71815424
                          },
                          "mem_usage": {
                            "type": "number",
                            "nullable": true,
                            "example": 0.00996352
                          },
                          "vmem_usage": {
                            "type": "number",
                            "nullable": true,
                            "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",
                            "nullable": true,
                            "example": 0
                          },
                          "gpu_temp": {
                            "type": "number",
                            "nullable": true,
                            "example": 38.999981
                          },
                          "gpu_frac": {
                            "type": "number",
                            "format": "float",
                            "example": 1
                          },
                          "gpu_lanes": {
                            "type": "integer",
                            "example": 16
                          },
                          "gpu_mem_bw": {
                            "type": "number",
                            "format": "float",
                            "example": 1008
                          },
                          "bw_nvlink": {
                            "type": "number",
                            "format": "float",
                            "example": 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
                          },
                          "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",
                            "nullable": true,
                            "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",
                            "nullable": true,
                            "example": null
                          },
                          "dlperf_per_dphtotal": {
                            "type": "number",
                            "nullable": true,
                            "example": null
                          },
                          "flops_per_dphtotal": {
                            "type": "number",
                            "format": "float",
                            "example": 15.41
                          },
                          "total_flops": {
                            "type": "number",
                            "format": "float",
                            "example": 12.36
                          },
                          "score": {
                            "type": "number",
                            "nullable": true,
                            "example": null
                          },
                          "reliability2": {
                            "type": "number",
                            "format": "float",
                            "example": 0.9686655
                          },
                          "os_version": {
                            "type": "string",
                            "nullable": true,
                            "example": null
                          },
                          "mobo_name": {
                            "type": "string",
                            "example": "Z790 Gaming"
                          },
                          "pci_gen": {
                            "type": "number",
                            "format": "float",
                            "example": 4
                          },
                          "pcie_bw": {
                            "type": "number",
                            "format": "float",
                            "example": 28
                          },
                          "num_gpus": {
                            "type": "integer",
                            "example": 1
                          },
                          "webpage": {
                            "type": "string",
                            "nullable": true,
                            "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": 0.0000494
                          },
                          "credit_balance": {
                            "type": "number",
                            "nullable": true,
                            "example": 4792.99
                          },
                          "credit_discount": {
                            "type": "number",
                            "nullable": true,
                            "example": 0.37
                          },
                          "credit_discount_max": {
                            "type": "number",
                            "nullable": true,
                            "example": 0.4
                          },
                          "client_run_time": {
                            "type": "number",
                            "format": "float",
                            "example": 100000000
                          },
                          "host_run_time": {
                            "type": "number",
                            "format": "float",
                            "example": 1
                          },
                          "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",
                            "nullable": true,
                            "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"
        ]
      }
    },
    "/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.\n\nCLI: `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`.\n\n**`service`** (optional). Filter by payment service: `transfer`, `stripe_payments`, `bitpay`, `coinbase`, `crypto.com`, `instance_prepay`, `paypal_manual`, `wise_manual`. Operators: `eq`, `neq`, `in`, `notin`.\n\n**Examples**:\n```json\n// January 2026, all services\n{\"when\":{\"gte\":1767225600,\"lte\":1769903999}}\n\n// Only PayPal and Wise payouts\n{\"when\":{\"gte\":1767225600,\"lte\":1769903999},\"service\":{\"in\":[\"paypal_manual\",\"wise_manual\"]}}\n\n// Everything except crypto\n{\"when\":{\"gte\":1767225600,\"lte\":1769903999},\"service\":{\"notin\":[\"bitpay\",\"coinbase\",\"crypto.com\"]}}\n```\n",
            "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`).\n\nExample: `[{\"col\":\"paid_on\",\"dir\":\"desc\"}]`\n",
            "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",
                      "nullable": true,
                      "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
                          },
                          "end": {
                            "type": "number",
                            "nullable": true,
                            "description": "Payment time (unix seconds UTC). `null` if unpaid.",
                            "example": 1761980301
                          },
                          "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
                          },
                          "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,
                          "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"
        ]
      }
    },
    "/api/v0/users/{user_id}/ipaddrs/": {
      "get": {
        "summary": "show ipaddrs",
        "description": "This endpoint retrieves the history of IP address accesses for the authenticated user.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/machines/": {
      "get": {
        "summary": "show machines",
        "description": "Fetches data for multiple machines associated with the authenticated user.\n\nCLI 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.\n\nCLI 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",
                            "format": "date-time",
                            "nullable": true,
                            "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"
        ]
      }
    },
    "/api/v0/team/members/": {
      "get": {
        "summary": "show team members",
        "description": "Retrieve a list of team members associated with the authenticated user's team.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/team/roles/{id}/": {
      "get": {
        "summary": "show team role",
        "description": "Retrieve details of a specific team role by its name.\n\nCLI Usage: `vastai show team-role <name>`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "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": [
          "Accounts"
        ]
      },
      "put": {
        "summary": "update team role",
        "description": "Update an existing team role with new name and permissions.\n\nCLI Usage: `vastai update team-role <id> --name <new_name> --permissions <new_permissions_json>`",
        "parameters": [
          {
            "name": "id",
            "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"
        ]
      }
    },
    "/api/v0/team/roles-full/": {
      "get": {
        "summary": "show team roles",
        "description": "Retrieve a list of all roles for a team, excluding the owner' role.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/users/current/": {
      "get": {
        "summary": "show user",
        "description": "Retrieve information about the current authenticated user, excluding the API key.\n\nCLI 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"
        ]
      }
    },
    "/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.\n\nThe recipient can be specified by either email address or user ID.\n\nCLI 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
                  },
                  "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"
        ]
      }
    },
    "/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.\n\nCLI 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"
        ]
      }
    },
    "/api/v0/network_volumes/unlist/": {
      "post": {
        "summary": "unlist network-volume",
        "description": "Unlists a network volume for rent.\n\nCLI Usage: `vastai unlist volume <offer_id>`",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id"
                ],
                "properties": {
                  "id": {
                    "type": "integer",
                    "description": "ID of network volume ask being unlisted"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "integer",
                      "description": "id of unlisted network volume ask"
                    },
                    "msg": {
                      "type": "string",
                      "description": "status message"
                    }
                  },
                  "example": {
                    "success": true,
                    "id": 6,
                    "msg": "Deleted network volume listing"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "invalid_args"
                    },
                    "msg": {
                      "type": "string",
                      "example": "You must pass in `id` in the body of the request"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "not_authorized"
                    },
                    "msg": {
                      "type": "string",
                      "example": "Authorization Error. Check that you have proper privileges to perform this action."
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Network Volumes"
        ]
      }
    },
    "/api/v0/volumes/unlist/": {
      "post": {
        "summary": "unlist volume",
        "description": "Remove a volume listing from the marketplace.\n\nCLI 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"
        ]
      }
    }
  },
  "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
          }
        }
      },
      "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
          },
          "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",
            "nullable": true,
            "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",
            "nullable": true,
            "description": "User-defined label for the instance.",
            "example": null
          },
          "template_id": {
            "type": "integer",
            "nullable": true,
            "description": "Identifier for the instance template.",
            "example": null
          },
          "template_hash_id": {
            "type": "string",
            "nullable": true,
            "description": "Hash identifier for the instance template.",
            "example": null
          },
          "template_name": {
            "type": "string",
            "nullable": true,
            "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",
            "nullable": true,
            "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",
            "nullable": true,
            "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
          },
          "uptime_mins": {
            "type": "number",
            "nullable": true,
            "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
          },
          "cpu_name": {
            "type": "string",
            "description": "Name of the CPU.",
            "example": "Xeon® 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
          },
          "mem_limit": {
            "type": "number",
            "nullable": true,
            "description": "Memory limit in megabytes.",
            "example": null
          },
          "mem_usage": {
            "type": "number",
            "nullable": true,
            "description": "Memory usage in megabytes.",
            "example": null
          },
          "vmem_usage": {
            "type": "number",
            "nullable": true,
            "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",
            "nullable": true,
            "description": "GPU utilization as a fraction.",
            "example": null
          },
          "gpu_temp": {
            "type": "number",
            "nullable": true,
            "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
          },
          "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
          },
          "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
          },
          "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
          },
          "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",
            "nullable": true,
            "description": "URL to the instance's webpage, if available.",
            "example": null
          },
          "search": {
            "type": "object",
            "description": "Search pricing details.",
            "example": {
              "gpuCostPerHour": 1,
              "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": 0.00004079441760601181
          },
          "credit_balance": {
            "type": "number",
            "nullable": true,
            "description": "User's credit balance.",
            "example": null
          },
          "credit_discount": {
            "type": "number",
            "nullable": true,
            "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
          },
          "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"
      }
    }
  }
}