Skip to main content

Overview

The Xloud Compute API provides programmatic control over virtual machine instances, flavors, keypairs, availability zones, server groups, and hypervisor resources. The API follows RESTful conventions with JSON request and response bodies.
Prerequisites
  • A valid project-scoped token from the Identity API
  • Base URL: https://api.<your-domain>/compute/v2.1
  • Minimum API microversion: 2.1

API Versioning (Microversions)

The Compute API uses microversions to add new capabilities without breaking existing clients. Specify the desired microversion in the X-OpenStack-Nova-Microversion header:
Request with specific microversion
curl -X GET https://api.<your-domain>/compute/v2.1/servers \
  -H "X-Auth-Token: $OS_TOKEN" \
  -H "X-OpenStack-Nova-Microversion: 2.79"
Query supported microversions
curl -X GET https://api.<your-domain>/compute \
  -H "X-Auth-Token: $OS_TOKEN"

Key Endpoints

ResourceMethodEndpointDescription
List instancesGET/serversList all instances in the project
Instance detailGET/servers/detailList instances with full details
Get instanceGET/servers/{id}Get a specific instance
Create instancePOST/serversLaunch a new instance
Delete instanceDELETE/servers/{id}Delete an instance
Instance actionPOST/servers/{id}/actionPerform an action (reboot, resize, etc.)
List flavorsGET/flavors/detailList all available instance sizes
List imagesGET/imagesList available images
List keypairsGET/os-keypairsList SSH keypairs
Create keypairPOST/os-keypairsRegister or generate an SSH keypair
List AZsGET/os-availability-zoneList availability zones
Server groupsGET/os-server-groupsList server groups (affinity/anti-affinity)
HypervisorsGET/os-hypervisors/detailList hypervisors (admin)
QuotasGET/os-quota-sets/{project_id}Show project compute quotas

Create an Instance

name
string
required
Display name for the instance.
flavorRef
string
required
Flavor ID or URL. Determines vCPU, RAM, and disk allocation.
imageRef
string
required
Image ID or URL to boot from. Omit when booting from volume.
networks
array
required
List of network objects. Each must include uuid (network ID) or port (port ID).
key_name
string
SSH keypair name to inject into the instance for key-based authentication.
security_groups
array
List of security group name objects. Defaults to the default group.
user_data
string
Base64-encoded cloud-init user data script executed at first boot.
availability_zone
string
Target availability zone. Omit to let the scheduler choose.
curl -X POST https://api.<your-domain>/compute/v2.1/servers \
  -H "X-Auth-Token: $OS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "server": {
      "name": "web-server-01",
      "flavorRef": "m1.medium",
      "imageRef": "ubuntu-22.04-amd64",
      "networks": [{ "uuid": "a1b2c3d4-e5f6-..." }],
      "key_name": "my-keypair",
      "security_groups": [{ "name": "web-servers" }]
    }
  }'
{
  "server": {
    "id": "b1c2d3e4-f5a6-7890-b1c2-d3e4f5a67890",
    "name": "web-server-01",
    "status": "BUILD",
    "links": [
      { "href": "https://api.<your-domain>/compute/v2.1/servers/b1c2d3e4...", "rel": "self" }
    ],
    "adminPass": "auto-generated-password",
    "OS-DCF:diskConfig": "MANUAL"
  }
}

Instance Actions

Perform operations on a running instance via the /action endpoint:
Soft reboot (graceful OS restart)
curl -X POST https://api.<your-domain>/compute/v2.1/servers/{id}/action \
  -H "X-Auth-Token: $OS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "reboot": { "type": "SOFT" } }'
Hard reboot (power cycle)
curl -X POST https://api.<your-domain>/compute/v2.1/servers/{id}/action \
  -H "X-Auth-Token: $OS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "reboot": { "type": "HARD" } }'

List Instances with Filtering

List all running instances
curl -X GET "https://api.<your-domain>/compute/v2.1/servers?status=ACTIVE" \
  -H "X-Auth-Token: $OS_TOKEN"
List instances with full details
curl -X GET https://api.<your-domain>/compute/v2.1/servers/detail \
  -H "X-Auth-Token: $OS_TOKEN"
List instances across all projects (admin)
curl -X GET "https://api.<your-domain>/compute/v2.1/servers/detail?all_tenants=1" \
  -H "X-Auth-Token: $OS_TOKEN"
Common filter parameters:
ParameterDescription
statusFilter by instance status: ACTIVE, SHUTOFF, BUILD, ERROR
nameFilter by instance name (supports regex)
flavorFilter by flavor ID
imageFilter by image ID
all_tenants1 to list across all projects (admin only)
limitMaximum number of results per page
markerPagination cursor — last instance ID from previous page

Error Reference

HTTP StatusError CodeDescription
400badRequestInvalid request body or parameter
401unauthorizedToken missing, invalid, or expired
403forbiddenInsufficient permissions for this operation
404itemNotFoundInstance or resource not found
409conflictingRequestOperation not valid in current instance state
413entityTooLargeRequest exceeds quota limits
429overLimitRate limit exceeded

Next Steps

Storage API

Attach volumes and manage snapshots via the Storage API

Networking API

Create networks and assign floating IPs for your instances

Authentication

Manage tokens and application credentials

Automation

Automate instance lifecycle with scripts and SDKs