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

# Power virtual machine

> Requests a power operation: `POWER_OPERATION_ON`, `POWER_OPERATION_OFF`, `POWER_OPERATION_REBOOT`, `POWER_OPERATION_RESUME` or `POWER_OPERATION_KILL` (an immediate stop). The operation runs asynchronously; the machine's `status.state` reflects the result.

Service-account credentials are refused.



## OpenAPI

````yaml /api-reference/openapi/compute.json post /compute/v1/virtualmachines/{name}/power
openapi: 3.0.3
info:
  title: Mount Thor Compute API
  version: ccf2f1830ec2
  description: >-
    Create, list, inspect and delete virtual machines and bare-metal Macs, power
    virtual machines, and read the image and machine-class catalogs.
    Service-account credentials can list, create and delete machines; the other
    compute operations are for people using the `mthr` CLI or the portal. To
    change a machine's class or image, delete it and create a new one.
servers:
  - url: https://customer-api.mountthor.com
security:
  - bearerAuth: []
paths:
  /compute/v1/virtualmachines/{name}/power:
    post:
      summary: Power virtual machine
      description: >-
        Requests a power operation: `POWER_OPERATION_ON`, `POWER_OPERATION_OFF`,
        `POWER_OPERATION_REBOOT`, `POWER_OPERATION_RESUME` or
        `POWER_OPERATION_KILL` (an immediate stop). The operation runs
        asynchronously; the machine's `status.state` reflects the result.


        Service-account credentials are refused.
      operationId: ComputeService_PowerVirtualMachine
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PowerVirtualMachineRequest'
        required: true
      responses:
        '201':
          description: The power operation was accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PowerVirtualMachineResponse'
        '400':
          description: The request is malformed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            The credential is missing, invalid or expired. The body is a
            Kubernetes-style `Status` object.
        '403':
          description: >-
            The credential does not allow this operation. The body is a
            Kubernetes-style `Status` object.
        '404':
          description: No virtual machine with this name exists in your account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            A field failed validation, for example an unknown image or machine
            class.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Compute is temporarily unable to complete the request; retry later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    PowerVirtualMachineRequest:
      type: object
      properties:
        operation:
          enum:
            - POWER_OPERATION_ON
            - POWER_OPERATION_OFF
            - POWER_OPERATION_REBOOT
            - POWER_OPERATION_RESUME
            - POWER_OPERATION_KILL
          type: string
          format: enum
      required:
        - operation
    PowerVirtualMachineResponse:
      type: object
      properties:
        powerOperationId:
          type: string
          description: Identifies the requested power operation.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: The HTTP status code.
            status:
              type: string
              description: A short status name, for example `NotFound` or `Invalid`.
            reason:
              type: string
              description: >-
                A machine-readable reason when one applies, for example
                `insufficient_funds` when a launch is refused for billing.
            message:
              type: string
              description: A human-readable explanation.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <credential>` to
        https://customer-api.mountthor.com. People use the session that `mthr
        login` stores (a token starting `mt_session_`, valid for up to 12
        hours). Automation uses a service-account credential (starting
        `mt_sa_v1_`, valid for 90 days) from Create credential. Each operation
        names the permission it needs. Service accounts hold permissions through
        custom roles, and some operations refuse them; those operations say so.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.