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

# List Instances (v1)

> Returns paginated GPU instances for the authenticated user with keyset pagination and label count aggregations.



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/v1/instances/
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/v1/instances/:
    get:
      tags:
        - Instances
      summary: List Instances (v1)
      description: >-
        Returns paginated GPU instances for the authenticated user with keyset
        pagination and label count aggregations.
      parameters:
        - name: limit
          in: query
          required: false
          description: Instances per page. Default 25, max 25. Values ≤ 0 are treated as 5.
          schema:
            type: integer
            default: 25
            maximum: 25
          example: 25
        - name: after_token
          in: query
          required: false
          description: >-
            Keyset pagination cursor from the previous response's `next_token`.
            An invalid token returns a 400 error.
          schema:
            type: string
          example: eyJ2YWx1ZXMiOiB7ImlkIjogMTIzfX0=
        - name: order_by
          in: query
          required: false
          description: >-
            JSON array of sort directives, e.g. `[{"col":"id","dir":"asc"}]`.
            Valid `dir` values: `asc`, `desc` (anything else treated as `asc`).
            `id` is always appended as a tiebreaker. Invalid column returns 400.
          schema:
            type: string
          example: '[{"col":"id","dir":"asc"}]'
        - name: select_cols
          in: query
          required: false
          description: >-
            JSON array of column names to return, e.g.
            `["id","label","actual_status"]`. Use `["*"]` for all columns
            (default). Unknown column names are returned as `null`.
          schema:
            type: string
            default: '["*"]'
          example: '["id","label","actual_status","dph_total"]'
        - name: select_filters
          in: query
          required: false
          description: >
            JSON object of column filters. Supported operators: `eq`, `neq`,
            `gt`, `gte`, `lt`, `lte`, `in`, `notin`.

            Filterable columns: `actual_status`, `gpu_name`, `verification`,
            `id`, `label`, and other columns stored directly on the contract
            record. Computed fields (e.g. `dph_total`, `num_gpus`) are not
            filterable and return 400.
          schema:
            type: string
            default: '{}'
          example: '{"actual_status":{"eq":"running"}}'
      responses:
        '200':
          description: >-
            Returns {success: true, total_instances, label_counts,
            instances_found, instances, next_token} with paginated instance
            data.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: True on success
                  total_instances:
                    type: integer
                    description: Total number of matching instances
                  label_counts:
                    type: object
                    description: Map of label string to instance count
                  instances_found:
                    type: integer
                    description: Number of instances in this page
                  instances:
                    type: array
                    items:
                      type: object
                    description: Array of instance objects
                  next_token:
                    type: string
                    description: Pagination token for the next page, or null
        '401':
          description: Unauthenticated or blacklisted user.
          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

````