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

# route

> Calls on the serverless engine to retrieve a GPU instance address within your endpoint for processing a request.
The engine will return either a ready worker URL or status information if no workers are available.

CLI Usage: `vastai route <endpoint> <cost>`



## OpenAPI

````yaml /api-reference/openapi.json post /route/
openapi: 3.1.0
info:
  title: Vast.ai API
  description: >-
    Welcome to Vast.ai 's API documentation. Our API allows you to
    programmatically manage GPU instances, handle machine operations, and
    automate your AI/ML workflow. Whether you're running individual GPU
    instances or managing a fleet of machines, our API provides comprehensive
    control over all Vast.ai  platform features.
  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:
  /route/:
    post:
      tags:
        - Serverless
      summary: route
      description: >-
        Calls on the serverless engine to retrieve a GPU instance address within
        your endpoint for processing a request.

        The engine will return either a ready worker URL or status information
        if no workers are available.


        CLI Usage: `vastai route <endpoint> <cost>`
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - endpoint
                - cost
              properties:
                endpoint:
                  type: string
                  description: Name of the endpoint
                  example: vLLM-Qwen3-8B
                cost:
                  type: number
                  format: float
                  description: The estimated compute resources for the request
                  default: 100
                  example: 242
                  minimum: 0
      responses:
        '200':
          description: Success response - either worker assignment or status
          content:
            application/json:
              schema:
                oneOf:
                  - title: Worker Available
                    type: object
                    properties:
                      endpoint:
                        type: string
                        description: Same as the input parameter
                        example: vLLM-Qwen3-8B
                      url:
                        type: string
                        description: >-
                          The address of the worker instance to send the request
                          to
                        example: http://192.168.1.10:8000
                      cost:
                        type: number
                        description: Same as the input parameter
                        example: 242
                      reqnum:
                        type: integer
                        description: Request number corresponding to this worker instance
                        example: 12345
                      signature:
                        type: string
                        description: Cryptographic signature authenticating the response
                        example: >-
                          a1b2c3d4e5f60708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20
                      __request_id:
                        type: string
                        description: >-
                          Unique identifier generated by the server for this
                          request
                        example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
                  - title: No Worker Available
                    type: object
                    properties:
                      endpoint:
                        type: string
                        description: Same as the input parameter
                        example: vLLM-Qwen3-8B
                      status:
                        type: string
                        description: Breakdown of workers in your endpoint group by status
                        example: Stopped
                      __request_id:
                        type: string
                        description: >-
                          Unique identifier generated by the server for this
                          request
                        example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
        '400':
          description: Bad Request - invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Invalid endpoint or missing required parameters
        '401':
          description: Unauthorized - authentication failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Authentication failed
      security:
        - BearerAuth: []
      servers:
        - url: https://run.vast.ai
          description: Production server
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key must be provided in the Authorization header

````