> ## Documentation Index
> Fetch the complete documentation index at: https://vastai-80aa3a82-auto-openapi-update-8483c1e9.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create User Account

> Register a new user account with username, email, password, and optional captcha, SSH key, and promo code.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/v0/users/
openapi: 3.1.0
info:
  title: Vast.ai API
  description: >-
    Vast.ai REST API for managing GPU cloud instances, machine operations, and
    AI/ML workflows.


    ## AI Agent Quick-Start


    Install the CLI skill for your agent (Claude Code, Cursor, Windsurf, etc.):
      npx skills add vast-ai/vast-cli

    CLI reference:
    https://raw.githubusercontent.com/vast-ai/vast-cli/master/vastai/SKILL.md

    SDK reference:
    https://raw.githubusercontent.com/vast-ai/vast-cli/master/vastai_sdk/SKILL.md


    ## Auth

    All endpoints require `Authorization: Bearer $VAST_API_KEY`.

    Get your key at: https://cloud.vast.ai/manage-keys/


    ## Key Quirks

    - `gpu_ram` in CLI = GB; in REST API = MB (CLI auto-converts)

    - SSH keys must be registered BEFORE creating an instance (VM: no recovery;
    Docker: can add post-create)

    - `onstart` field is limited to 4048 characters -- gzip+base64 for longer
    scripts

    - `POST /api/v0/asks/{id}/` (create instance) returns `new_contract` as the
    instance ID, not `id`

    - Poll trap: if `actual_status` becomes `exited`, `unknown`, or `offline` it
    will never reach `running` -- destroy and retry
  version: 1.0.0
  contact:
    name: Vast.ai Support
    url: https://discord.gg/vast
servers:
  - url: https://console.vast.ai
    description: Production server
security:
  - BearerAuth: []
paths:
  /api/v0/users/:
    post:
      tags:
        - Accounts
      summary: Create User Account
      description: >-
        Register a new user account with username, email, password, and optional
        captcha, SSH key, and promo code.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  description: User's email address
                  maxLength: 64
                  example: user@example.com
                  pattern: ^(?!.*@vast)[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
                username:
                  type: string
                  description: Desired username
                  maxLength: 64
                  example: testuser123
                password:
                  type: string
                  description: Account password
                  maxLength: 256
                  example: securepass123
                host_only:
                  type: boolean
                  description: If true, account is restricted to host functionality only
                  example: true
                parent_id:
                  type: string
                  description: >-
                    Parent account ID for subaccounts. Use "me" for current
                    user.
                  example: me
                ssh_key:
                  type: string
                  description: Optional SSH public key
                  maxLength: 4096
                captcha:
                  type: string
                  description: Captcha token (required for non-subaccounts)
                  maxLength: 8192
              required:
                - email
                - username
                - password
      responses:
        '200':
          description: >-
            Account created successfully; returns formatted user object with API
            key
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: User ID
                  username:
                    type: string
                    description: Username
                  email:
                    type: string
                    description: Email address
                  api_key:
                    type: string
                    description: API key (populated for subaccounts)
                  key_id:
                    type: integer
                    description: Active API key ID
                  balance:
                    type: number
                    description: Account credit balance (USD)
                  credit:
                    type: number
                    description: Promotional credit balance (USD)
                  email_verified:
                    type: boolean
                    description: Whether the email has been verified
                  huggingface_cloud_sync_enabled:
                    type: boolean
                    description: >-
                      Whether Hugging Face cloud sync is currently enabled for
                      this authenticated user
                  host_only:
                    type: boolean
                    description: Whether this is a host-only account
                  ssh_key:
                    type: string
                    description: Default SSH public key
                  can_pay:
                    type: boolean
                    description: Whether a payment method is on file
                  has_billing:
                    type: boolean
                    description: Whether a Stripe payment method exists
        '400':
          description: 'Invalid email: "Failed to create account."'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden email domain containing 'support.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: 'Username or email already exists: "Failed to create account."'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
        msg:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key must be provided in the Authorization header

````