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

# Create Virtual Machine

> Creates one Virtual Machine in the tenant namespace.



## OpenAPI

````yaml /api-reference/customer-api.v1.openapi.json post /v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines
openapi: 3.1.0
info:
  title: Mount Thor Customer API
  version: v1
servers:
  - description: Mount Thor customer API edge
    url: https://api.mountthor.com
security: []
paths:
  /v1/compute/apis/compute.mountthor.com/v1alpha1/namespaces/{namespace}/virtualmachines:
    post:
      tags:
        - compute
      summary: Create Virtual Machine
      description: Creates one Virtual Machine in the tenant namespace.
      operationId: createVirtualMachine
      parameters:
        - description: Tenant namespace returned by Get Account.
          in: path
          name: namespace
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VirtualMachineV1ALPHA1'
          application/yaml:
            schema:
              $ref: '#/components/schemas/VirtualMachineV1ALPHA1'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualMachineV1ALPHA1'
          description: Resource created
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KubernetesStatus'
          description: Invalid request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KubernetesStatus'
          description: Authentication required
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KubernetesStatus'
          description: Permission denied
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KubernetesStatus'
          description: Resource not found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KubernetesStatus'
          description: Conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KubernetesStatus'
          description: Validation failed
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KubernetesStatus'
          description: Rate limit exceeded
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KubernetesStatus'
          description: Request failed
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KubernetesStatus'
          description: Service unavailable
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KubernetesStatus'
          description: Request timed out
      security:
        - MountThorSession:
            - compute:write
components:
  schemas:
    VirtualMachineV1ALPHA1:
      additionalProperties: false
      description: Customer-visible VirtualMachine resource in the Mount Thor Compute API.
      properties:
        apiVersion:
          description: Kubernetes API version. Must be `compute.mountthor.com/v1alpha1`.
          enum:
            - compute.mountthor.com/v1alpha1
          type: string
        kind:
          description: Kubernetes resource kind. Must be `VirtualMachine`.
          enum:
            - VirtualMachine
          type: string
        metadata:
          additionalProperties: false
          description: Customer-safe metadata for the VirtualMachine.
          properties:
            annotations:
              additionalProperties:
                type: string
              type: object
            creationTimestamp:
              format: date-time
              type: string
            deletionTimestamp:
              format: date-time
              nullable: true
              type: string
            generation:
              format: int64
              minimum: 0
              type: integer
            labels:
              additionalProperties:
                type: string
              type: object
            name:
              description: Resource name.
              maxLength: 253
              minLength: 1
              pattern: ^[a-z0-9]([-a-z0-9.]*[a-z0-9])?$
              type: string
            namespace:
              description: Namespace bound to the compute session.
              type: string
            resourceVersion:
              description: Kubernetes resource version.
              type: string
            uid:
              description: Immutable resource identifier.
              type: string
          required:
            - name
          type: object
        spec:
          additionalProperties: false
          description: >-
            VirtualMachine spec is immutable. Delete and recreate the resource
            to change it.
          properties:
            bootstrap:
              additionalProperties: false
              properties:
                sshAuthorizedKeys:
                  items:
                    additionalProperties: false
                    properties:
                      publicKey:
                        type: string
                      username:
                        type: string
                    required:
                      - publicKey
                    type: object
                  type: array
              type: object
            imageRef:
              type: string
            ports:
              items:
                additionalProperties: false
                description: VMPort specifies a port to expose on a virtual machine.
                properties:
                  exposure:
                    enum:
                      - private-tunnel
                    type: string
                  guestPort:
                    format: int32
                    maximum: 65535
                    minimum: 1
                    type: integer
                  name:
                    pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
                    type: string
                  protocol:
                    type: string
                  readinessProbe:
                    description: >-
                      ReadinessProbe controls whether this published port must
                      be listening before the VM becomes Ready.
                    type: boolean
                required:
                  - guestPort
                  - name
                type: object
              type: array
            resources:
              additionalProperties: false
              description: >-
                VMResources specifies the resource requirements for a virtual
                machine.
              properties:
                cpu:
                  format: int32
                  type: integer
                diskGiB:
                  format: int32
                  type: integer
                memoryGiB:
                  format: int32
                  type: integer
              required:
                - cpu
                - diskGiB
                - memoryGiB
              type: object
          required:
            - imageRef
          type: object
        status:
          additionalProperties: false
          description: VirtualMachineStatus defines the observed state of a VirtualMachine.
          properties:
            capacitySource:
              type: string
            failureCode:
              description: Stable customer-safe failure code.
              enum:
                - InvalidSpec
                - ImageUnavailable
                - ClassUnavailable
                - ReservedCapacityUnavailable
                - CapacityTemporarilyUnavailable
                - AccessNotReady
                - CleanupBlocked
                - InternalError
                - NoCapacityAvailable
                - AllocationBrokerUnavailable
                - PlacementUnavailable
                - HostIneligible
                - ProviderError
                - VMNotFound
              type: string
            failureMessage:
              description: Failure detail.
              type: string
            observedGeneration:
              format: int64
              type: integer
            phase:
              description: >-
                Running is successful. Failed is terminal. Other phases are in
                progress.
              enum:
                - Pending
                - Creating
                - Starting
                - Running
                - Stopping
                - Deleting
                - Failed
              type: string
            publishedPorts:
              items:
                additionalProperties: false
                description: >-
                  VMPublishedPort describes a customer-safe private access
                  command for a VM port.
                properties:
                  accessCommand:
                    type: string
                  exposure:
                    type: string
                  guestPort:
                    format: int32
                    type: integer
                  name:
                    type: string
                  protocol:
                    type: string
                  uriTemplate:
                    type: string
                type: object
              type: array
            readyForAccess:
              description: Customer access gate. Do not connect until true.
              type: boolean
            resolvedImageRef:
              type: string
            sshHostKeys:
              items:
                additionalProperties: false
                description: >-
                  VMSSHHostKey describes a guest SSH host public key that
                  clients use for strict host-key verification over Mount Thor
                  tunnels.
                properties:
                  algorithm:
                    type: string
                  publicKey:
                    type: string
                type: object
              type: array
          type: object
      required:
        - spec
        - apiVersion
        - kind
        - metadata
      type: object
    KubernetesStatus:
      additionalProperties: false
      description: Kubernetes API operation result.
      properties:
        apiVersion:
          enum:
            - v1
          type: string
        code:
          format: int32
          maximum: 599
          minimum: 100
          type: integer
        kind:
          enum:
            - Status
          type: string
        message:
          type: string
        reason:
          type: string
        status:
          enum:
            - Success
            - Failure
          type: string
      required:
        - apiVersion
        - kind
        - status
      type: object
  securitySchemes:
    MountThorSession:
      bearerFormat: mt_session
      scheme: bearer
      type: http

````