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

# Create VM

> Creates a new Virtual Machine.




## OpenAPI

````yaml https://spec.speakeasy.com/latitude/latitude/latitude-sh-api-with-code-samples post /virtual_machines
openapi: 3.0.1
info:
  title: Latitude.sh API
  version: '2023-06-01'
  description: >-
    The Latitude.sh API is a RESTful API to manage your Latitude.sh account. It
    allows you to perform the same actions as the Latitude.sh dashboard.
servers:
  - url: https://api.latitude.sh
    variables:
      latitude_api_key:
        default: <insert your api key here>
  - url: http://api.latitude.sh
    variables:
      latitude_api_key:
        default: <insert your api key here>
security: []
tags:
  - name: API keys
  - name: Billing
  - name: Elastic Ips
  - name: Events
  - name: Firewalls
  - name: IP Addresses
  - name: Kubernetes Clusters
  - name: Operating Systems
  - name: Plans
  - name: Private Networks
  - name: Projects
  - name: Regions
  - name: Roles
  - name: SSH Keys
  - name: Servers
  - name: Storage
  - name: Tags
  - name: Teams
  - name: Team members
  - name: Traffic
  - name: User data
  - name: User profile
  - name: VPN Sessions
  - name: Virtual machines
paths:
  /virtual_machines:
    post:
      tags:
        - Virtual machines
      summary: Create VM
      description: |
        Creates a new Virtual Machine.
      operationId: create-virtual-machine
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/virtual_machine_payload'
            examples:
              Created:
                summary: Created
                value:
                  data:
                    type: virtual_machines
                    attributes:
                      project: lightweight-leather-lamp
                      name: my-new-vm
                      billing: monthly
              CreatedWithOS:
                summary: Created with operating system
                value:
                  data:
                    type: virtual_machines
                    attributes:
                      project: lightweight-leather-lamp
                      name: my-new-vm
                      billing: monthly
                      operating_system: ubuntu_24_04_x64_lts
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/virtual_machine_payload'
            examples:
              Created:
                summary: Created
                value:
                  data:
                    type: virtual_machines
                    attributes:
                      project: lightweight-leather-lamp
                      name: my-new-vm
                      billing: monthly
              CreatedWithOS:
                summary: Created with operating system
                value:
                  data:
                    type: virtual_machines
                    attributes:
                      project: lightweight-leather-lamp
                      name: my-new-vm
                      billing: monthly
                      operating_system: ubuntu_24_04_x64_lts
        required: true
      responses:
        '201':
          description: Created
          content:
            application/vnd.api+json:
              examples:
                Created:
                  value:
                    data:
                      id: vm_mw49QDB5qagKb
                      type: virtual_machines
                      attributes:
                        name: my-new-vm
                        status: Starting
                        created_at: '2026-01-14T15:57:13+00:00'
                        primary_ipv4: 192.168.1.50
                        operating_system:
                          name: Ubuntu 24.04 LTS
                          slug: ubuntu_24_04_x64_lts
                          version: 24.04 x64 LTS
                          features:
                            raid: true
                            ssh_keys: true
                            user_data: true
                          distro:
                            name: Ubuntu
                            slug: ubuntu
                            series: noble
                        site: FRA181
                        billing: monthly
                        plan:
                          id: plan_VE1Wd3VXOXnZJ
                          name: g3.h100.large-131
                        specs:
                          vcpu: 16
                          ram: 128 GB
                          storage: 100 GB
                          nic: 1 x 1 Gbps
                          gpu: 1 x NVIDIA H100 Tensor Core GPU
                        team:
                          id: team_zAbb72Zm3VS3N0o89Y48sGXv3mZ
                          name: 690 Team
                          slug: 690-team
                          description: 690 Team
                          address: >-
                            Apt. 922 405 Ondricka Lights, Lake Jennineview, SC
                            58925-4625
                          status: verified
                          currency:
                            id: cur_AW6Q2D9lqKLpr
                            code: BRL
                            name: Brazilian Real
                            currency_id: null
                        project:
                          id: proj_GMy1Dbk1ON50m
                          name: Lightweight Leather Lamp
                          slug: lightweight-leather-lamp
                          description: Sleek Wool Plate
                          billing_type: Normal
                          billing_method: Normal
                          bandwidth_alert: false
                          environment: null
                          billing:
                            subscription_id: null
                            type: Normal
                            method: Normal
                          stats:
                            databases: 0
                            ip_addresses: 0
                            prefixes: 0
                            servers: 0
                            storages: 0
                            virtual_machines: 1
                            vlans: 0
              schema:
                $ref: '#/components/schemas/virtual_machine'
      security:
        - Bearer: []
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            import latitudesh_python_sdk
            from latitudesh_python_sdk import Latitudesh
            import os


            with Latitudesh(
                bearer=os.getenv("LATITUDESH_BEARER", ""),
            ) as latitudesh:

                res = latitudesh.virtual_machines.create(data={
                    "type": latitudesh_python_sdk.VirtualMachinePayloadType.VIRTUAL_MACHINES,
                    "attributes": {
                        "name": "my-new-vm",
                        "project": "lightweight-leather-lamp",
                    },
                })

                # Handle response
                print(res)
        - lang: go
          label: Go (SDK)
          source: "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tlatitudeshgosdk \"github.com/latitudesh/latitudesh-go-sdk\"\n\t\"github.com/latitudesh/latitudesh-go-sdk/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := latitudeshgosdk.New(\n        latitudeshgosdk.WithSecurity(os.Getenv(\"LATITUDESH_BEARER\")),\n    )\n\n    res, err := s.VirtualMachines.Create(ctx, components.VirtualMachinePayload{\n        Data: &components.VirtualMachinePayloadData{\n            Type: components.VirtualMachinePayloadTypeVirtualMachines.ToPointer(),\n            Attributes: &components.VirtualMachinePayloadAttributes{\n                Name: latitudeshgosdk.Pointer(\"my-new-vm\"),\n                Project: latitudeshgosdk.Pointer(\"lightweight-leather-lamp\"),\n            },\n        },\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.VirtualMachine != nil {\n        // handle response\n    }\n}"
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Latitudesh } from "latitudesh-typescript-sdk";

            const latitudesh = new Latitudesh({
              bearer: process.env["LATITUDESH_BEARER"] ?? "",
            });

            async function run() {
              const result = await latitudesh.virtualMachines.create({
                data: {
                  type: "virtual_machines",
                  attributes: {
                    name: "my-new-vm",
                    project: "lightweight-leather-lamp",
                  },
                },
              });

              console.log(result);
            }

            run();
components:
  schemas:
    virtual_machine_payload:
      type: object
      properties:
        data:
          type: object
          properties:
            type:
              type: string
              enum:
                - virtual_machines
            attributes:
              type: object
              properties:
                name:
                  type: string
                  default: my-vm
                plan:
                  type: string
                  description: The plan ID or Slug for the Virtual Machine
                  nullable: true
                ssh_keys:
                  type: array
                  nullable: true
                  items:
                    type: string
                project:
                  type: string
                  default: my-project
                operating_system:
                  type: string
                  description: >-
                    The operating system slug for the Virtual Machine. If not
                    specified, defaults to ubuntu-24-04 for CPU plans or
                    ubuntu24_ml_in_a_box for GPU plans.
                  nullable: true
    virtual_machine:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/virtual_machine_attributes'
        meta:
          type: object
    virtual_machine_attributes:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - virtual_machines
        attributes:
          type: object
          properties:
            name:
              type: string
            created_at:
              type: string
            status:
              type: string
              enum:
                - Running
                - Configuring network
                - Starting
                - Scheduling
                - Scheduled
                - Destroying
            primary_ipv4:
              type: string
              nullable: true
            operating_system:
              type: object
              nullable: true
              description: The operating system installed on the virtual machine
              properties:
                name:
                  type: string
                  description: The full name of the operating system
                slug:
                  type: string
                  description: The unique slug identifier for the operating system
                version:
                  type: string
                  description: The version of the operating system
                features:
                  type: object
                  description: Features supported by this operating system
                  properties:
                    raid:
                      type: boolean
                      description: Whether RAID is supported
                    ssh_keys:
                      type: boolean
                      description: Whether SSH keys are supported
                    user_data:
                      type: boolean
                      description: Whether user data is supported
                distro:
                  type: object
                  description: Distribution information
                  properties:
                    name:
                      type: string
                      description: The name of the Linux distribution
                    slug:
                      type: string
                      description: The slug of the Linux distribution
                    series:
                      type: string
                      description: The distribution series code name
            credentials:
              type: object
              nullable: true
              properties:
                username:
                  type: string
                host:
                  type: string
                password:
                  type: string
                ssh_keys:
                  type: array
                  items:
                    type: string
            plan:
              type: object
              properties:
                id:
                  type: string
                name:
                  type: string
            specs:
              type: object
              properties:
                vcpu:
                  type: integer
                  nullable: true
                ram:
                  type: string
                  nullable: true
                storage:
                  type: string
                  nullable: true
                nic:
                  type: string
                  nullable: true
                gpu:
                  type: string
                  nullable: true
            team:
              $ref: '#/components/schemas/team_include'
            project:
              $ref: '#/components/schemas/project_include'
    team_include:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        slug:
          type: string
        description:
          type: string
          nullable: true
        address:
          type: string
        currency:
          type: object
        status:
          type: string
        feature_flags:
          type: array
          items:
            type: string
    project_include:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        slug:
          type: string
        description:
          type: string
          nullable: true
        billing_type:
          type: string
          nullable: true
        provisioning_type:
          type: string
          nullable: true
        billing_method:
          type: string
          nullable: true
        bandwidth_alert:
          type: boolean
        environment:
          type: string
          nullable: true
        billing:
          type: object
          properties:
            subscription_id:
              type: string
              nullable: true
            type:
              type: string
            method:
              type: string
        stats:
          type: object
          properties:
            ip_addresses:
              type: integer
            prefixes:
              type: integer
            servers:
              type: integer
            vlans:
              type: integer
  securitySchemes:
    Bearer:
      type: apiKey
      name: Authorization
      in: header

````