Skip to content

REST API Reference ​

Vapor is built with an API-first philosophy. Every action available in the web interface is powered by a comprehensive, fully documented REST API.

Authentication ​

The Vapor API uses Bearer Token authentication via JSON Web Tokens (JWT).

  1. First, generate an API Token via the UI (API Token menu) or authenticate via the /api/v1/auth/login endpoint using your username and password.
  2. Include the token in the Authorization header of all subsequent requests:
http
Authorization: Bearer <your_jwt_token>

OpenAPI Specification ​

Vapor publishes its complete OpenAPI 3.1.0 specification. You can access the raw openapi.yaml file from the source code or query the /api/v1 endpoint (if Swagger UI is enabled on your deployment).

The API covers all platform features including:

  • Host System Management (/api/v1/system/*)
  • Networking (/api/v1/network/*)
  • Storage (/api/v1/storage/*)
  • Virtualization (/api/v1/virtualization/*)
  • Kubernetes (/api/v1/kubernetes/*)

Large File Uploads (TUS Protocol) ​

For endpoints that require uploading massive files—such as Virtual Machine ISOs or Docker/Container images—Vapor implements the TUS Protocol v1.0.0.

TUS is an open protocol for resumable file uploads over HTTP. It ensures that multi-gigabyte uploads (like a 4GB Ubuntu ISO) can survive network interruptions without needing to restart from scratch.

Supported TUS Endpoints ​

  • /api/v1/virtualmachines/isos/upload/*
  • /api/v1/containers/images/upload/*
  • /api/v1/docker/images/upload/*

Integration Example (JavaScript) ​

If you are building a custom frontend integration, we highly recommend using the official tus-js-client library:

javascript
import * as tus from 'tus-js-client';

const upload = new tus.Upload(file, {
  endpoint: 'https://<vapor-ip>:7770/api/v1/virtualmachines/isos/upload',
  headers: {
    'Authorization': 'Bearer ' + token
  },
  chunkSize: 10 * 1024 * 1024, // 10MB chunks
  metadata: {
    filename: file.name,
    filetype: file.type
  },
  onError: (error) => console.error('Upload failed:', error),
  onProgress: (bytesUploaded, bytesTotal) => {
    const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2);
    console.log(`${percentage}% uploaded`);
  },
  onSuccess: () => {
    console.log('Upload complete');
    // Call the finalization endpoint
    fetch(`/api/v1/virtualmachines/isos/upload/${upload.url.split('/').pop()}/complete`, {
      method: 'POST',
      headers: { 'Authorization': 'Bearer ' + token }
    });
  }
});

upload.start();

For more details on the TUS protocol, visit tus.io.

View Full API Reference ​

The complete, interactive API documentation is generated dynamically and can be viewed here:

View Vapor REST API Reference