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

# Create a VM

> Either template or (distro + ram) must be provided — a template supplies its own ram and distro.



## OpenAPI

````yaml /api-reference/openapi.json post /vms
openapi: 3.0.0
info:
  title: Shard Cloud API
  description: >-
    API reference for Shard Cloud's authenticated management endpoints — Apps,
    Databases, VMs, Custom Docker Images, and project-level Alerts & Backups.
    Every endpoint on this page requires a JWT bearer token (see Authentication
    below). CDN endpoints have their own reference under the CDN tab.
  version: 2.0.0
servers:
  - url: https://shardcloud.app/api
    description: API base path
security: []
tags:
  - name: Databases
    description: PostgreSQL, MySQL, MongoDB, and Redis database services.
  - name: Apps
    description: Web application deployment, files, domains, and configuration.
  - name: VMs
    description: Full Linux virtual machines with SSH access.
  - name: Custom Images
    description: User-built Docker images, deployable straight to an App.
  - name: Project
    description: >-
      Resource alerts and backups — shared across App, Database, and VM
      projects.
paths:
  /vms:
    post:
      tags:
        - VMs
      summary: Create a VM
      description: >-
        Either template or (distro + ram) must be provided — a template supplies
        its own ram and distro.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetupVMRequest'
      responses:
        '201':
          description: VM created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateVMResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No valid subscription
      security:
        - JWTAuth: []
components:
  schemas:
    SetupVMRequest:
      type: object
      required:
        - name
        - password
      properties:
        name:
          type: string
        description:
          type: string
        password:
          type: string
        template:
          type: string
          description: >-
            A VPS template's `id`, from the dashboard's template list. When set,
            ram and distro come from the template and don't need to be provided.
        distro:
          type: string
          description: >-
            A distro `value` from GET /vms/distros. Required when template is
            not set.
        ram:
          type: integer
          description: RAM in MB. Required (min 4096) when template is not set.
    CreateVMResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        addon:
          type: object
          description: >-
            The subscription addon created to bill for this VM's extra RAM/vCPU,
            if any.
        invoice:
          type: object
        invoice_payment_info:
          type: object
    Error:
      type: object
      properties:
        error:
          type: string
  securitySchemes:
    JWTAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Send your API token (Dashboard → Settings → API Token) as
        `Authorization: Bearer <token>`.

````