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

# Create a custom domain for a VM.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v2/domains
openapi: 3.1.0
info:
  title: Vers API
  description: >-
    REST API for creating, checkpointing, branching, and managing Vers computers
    and projects.
  version: 2.0.0
servers:
  - url: https://api.vers.sh
    description: Vers API
security:
  - bearerAuth: []
tags:
  - name: Computers
    description: Create, inspect, execute commands in, sleep, wake, and delete computers.
  - name: Branches
    description: Branch one or more computers from a live computer, checkpoint, or tag.
  - name: Checkpoints
    description: Capture, inspect, tag, and delete whole-computer checkpoints.
  - name: Projects
    description: >-
      Organize computers into projects with private service networks and grouped
      restores.
  - name: Operations
    description: Inspect and stream status events for asynchronous durable operations.
  - name: Images
    description: >-
      Import and manage custom OCI images, system images, and registry
      artifacts.
  - name: Repositories
    description: Manage checkpoint repositories, tags, and public catalog entries.
  - name: Domains
    description: Register and manage custom domains.
  - name: Environment Variables
    description: Manage account-level environment variables applied to new computers.
  - name: Account & System
    description: Inspect API key identity, usage, and control-plane health.
paths:
  /api/v2/domains:
    post:
      tags:
        - Domains
      summary: Create a custom domain for a VM.
      operationId: create_domain
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDomainRequest'
        required: true
      responses:
        '201':
          description: Domain created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainResponse'
        '400':
          description: Invalid domain name
        '401':
          description: Missing or invalid API key
        '403':
          description: VM belongs to a different org
        '404':
          description: VM not found
        '409':
          description: Domain already exists
        '422':
          description: DNS for the domain is not routed to Chelsea yet
components:
  schemas:
    CreateDomainRequest:
      type: object
      description: Request body for attaching a custom domain.
      required:
        - vm_id
        - domain
      properties:
        domain:
          type: string
        vm_id:
          type: string
          format: uuid
    DomainResponse:
      type: object
      description: |-
        A custom domain attached to a VM. Returned on creation, fetch, and in
        list responses.
      required:
        - domain_id
        - vm_id
        - domain
        - created_at
      properties:
        created_at:
          type: string
          format: date-time
        domain:
          type: string
        domain_id:
          type: string
          format: uuid
        vm_id:
          type: string
          format: uuid
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: 'Vers API key (`VERS_API_KEY`) sent as `Authorization: Bearer <key>`.'

````

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