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

# Create Volume Listings

> Creates or updates disk volume ask listings for one or more of the host's machines.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/v0/volumes/
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/volumes/:
    post:
      tags:
        - Volumes
      summary: Create Volume Listings
      description: >-
        Creates or updates disk volume ask listings for one or more of the
        host's machines.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                hidden_listing:
                  type: boolean
                  description: >-
                    When true, the volume listing is not shown in public
                    marketplace search results.
                  example: false
                machine:
                  type: integer
                  description: >-
                    Single machine ID to list a volume for. Use machines (array)
                    for multiple. One of machine or machines is required.
                  example: 7890
                machines:
                  type: array
                  description: >-
                    List of machine IDs to list volumes for simultaneously.
                    Overrides machine if both are supplied.
                  example:
                    - 7890
                    - 7891
      responses:
        '200':
          description: >-
            Returns {"success": <bool>, "you_sent": <request_body>, "results":
            [{"machine_id", "user_id", "extended", "new_contracts",
            "upd_contracts"}, ...]}
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: True if all machine listings succeeded.
                  you_sent:
                    type: object
                    description: The request body that was submitted.
                  results:
                    type: array
                    description: Per-machine result objects.
                    items:
                      type: object
                      properties:
                        machine_id:
                          type: integer
                          description: Machine identifier.
                        user_id:
                          type: integer
                          description: Owner user identifier.
                        extended:
                          type: integer
                          description: Number of active contracts extended.
                        new_contracts:
                          type: array
                          description: Newly created ask contracts.
                          items:
                            type: object
                            properties:
                              id:
                                type: integer
                                description: New contract identifier.
                              size:
                                type: number
                                description: Disk size allocated.
                        upd_contracts:
                          type: array
                          description: IDs of updated ask contracts.
                          items:
                            type: integer
        '400':
          description: >-
            Invalid machine id or no matching machine for account; message:
            "Invalid machine id" or "No such machine(s) for your account"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: >-
            Machine is offline; returns {"success": false, "msg": "error: can
            only create asks for an online machine."}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Disk ask creation or update failed with invalid arguments
          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

````