Cloud Server API Quickstart: Your First 0x.cloud Request
The 0x.cloud REST API lets you create, inspect and delete VPS instances with plain HTTP requests, authenticated by an API key in the Authorization: Bearer header. This cloud server API is described in an OpenAPI spec, so it works with curl, any programming language, n8n and AI agents. In 10 minutes you will get a key, check a price with dry_run, create a server and delete it.
What the Cloud Server API Covers
| Task | Method and path |
|---|---|
| Plans and prices, no key | GET /public/pricing |
| Plans (with a key) | GET /plans |
| Balance | GET /balance |
| List servers | GET /servers |
| Exact price, nothing created | POST /servers with "dry_run": true |
| Create a server | POST /servers with the pricing_fingerprint from dry_run |
| Wait until ready | GET /servers/{id}/wait |
| One server (status) | GET /servers/{id} |
| Delete a server | DELETE /servers/{id} |
| Restore a deleted server (24 hours) | POST /servers/{id}/restore |
All paths are relative to the base URL https://0x.cloud/v1.
Every method and field is in the OpenAPI spec at https://0x.cloud/v1/openapi.json, which Swagger UI, Postman and client generators all understand (OpenAPI format). AI agents also get an llms.txt; see llms.txt for agents.
Step 1. Get an API Key
- In the 0x.cloud dashboard, open the API and MCP section and create a key. It is shown only once.
- This guide needs
servers.read,servers.create,servers.deleteandbilling.read(a default key already has them). - Set a monthly spend cap, for example $5: a test server for a couple of hours stays far below it.
- Store the key in an environment variable:
# Linux and macOS, current terminal session only
export OX_API_KEY="0x_live_your_key"
Scopes and caps are explained in API key permissions.
Step 2. First Call: Balance and Plans
# account balance
curl -s https://0x.cloud/v1/balance \
-H "Authorization: Bearer $OX_API_KEY"
# plans with prices (this one works without a key)
curl -s https://0x.cloud/v1/public/pricing
Responses are JSON. Install jq for readable output and for the examples below: sudo apt install -y jq or brew install jq.
Step 3. Price It With dry_run
The dry_run flag turns a create request into a quote: the service returns the price and creates nothing.
# keep the response so we can reuse the quote
QUOTE=$(curl -s https://0x.cloud/v1/servers \
-H "Authorization: Bearer $OX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"plan": "s1-2", "billing_cycle": "hourly", "dry_run": true}')
echo "$QUOTE" | jq '{monthly_usd, hourly_usd, total_usd, resources}'
FP=$(echo "$QUOTE" | jq -r .pricing_fingerprint)
The response includes the monthly price, the exact hourly rate ($0.054725 for s1-2), the server resources and a pricing_fingerprint quote valid for 10 minutes. Field details: dry_run: price without creating.
Step 4. Create a VPS via the API
Send the same request without dry_run, plus the quote. plan and billing_cycle must match the dry run, or you get 409 price_changed. The Idempotency-Key header prevents a duplicate server if the connection drops: a retry with the same key returns the same response.
curl -s https://0x.cloud/v1/servers \
-H "Authorization: Bearer $OX_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d "{\"plan\": \"s1-2\", \"billing_cycle\": \"hourly\", \"hostname\": \"api-test\", \"pricing_fingerprint\": \"$FP\"}" \
| tee server.json | jq '{id: .data.id, status: .data.status, password}'
A 201 response contains the server, the root username and its password. The password is shown only once, which is why the response is saved to server.json. Ubuntu 24.04 is the default image; pick another with os_template_id from GET /images. Your first paid server needs one top-up of at least $5.
Wait until it is ready and check its status:
ID=$(jq -r .data.id server.json) # looks like srv_8f3k2m9x4qpz7w1c
# holds the connection up to 25 seconds; ready: false means "ask again"
curl -s "https://0x.cloud/v1/servers/$ID/wait?timeout=25" \
-H "Authorization: Bearer $OX_API_KEY"
curl -s https://0x.cloud/v1/servers/$ID \
-H "Authorization: Bearer $OX_API_KEY" | jq '.data | {status}'
Step 5. Delete the Test Server
curl -s -X DELETE https://0x.cloud/v1/servers/$ID \
-H "Authorization: Bearer $OX_API_KEY"
Charges stop immediately. A deleted server stays in the trash for 24 hours and can be restored with POST /servers/{id}/restore; when it is erased, the unused remainder returns to your balance. An hourly s1-2 costs $0.054725 per hour it runs.
Python Example
import os
import uuid
import requests
API = "https://0x.cloud/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['OX_API_KEY']}"}
body = {"plan": "s1-2", "billing_cycle": "hourly", "hostname": "py-test"}
# 1. exact price, nothing created
quote = requests.post(f"{API}/servers", headers=HEADERS,
json={**body, "dry_run": True}, timeout=30)
quote.raise_for_status()
q = quote.json()
print(f"Month ${q['monthly_usd']}, hour ${q['hourly_usd']}")
# 2. create only after confirmation, with the same quote
if input("Create? [y/N] ").lower() == "y":
r = requests.post(f"{API}/servers", timeout=60,
headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
json={**body, "pricing_fingerprint": q["pricing_fingerprint"]})
r.raise_for_status()
print(r.json()["data"]["id"])
API, MCP or n8n?
| Tool | Best for |
|---|---|
| REST API | your own scripts, CI, backends, infrastructure automation |
| MCP server | an AI assistant (Claude, Cursor, ChatGPT) managing servers from chat |
| n8n | no-code workflows on a schedule or webhook, with notifications; see 0x.cloud in n8n |
All three use the same Authorization: Bearer key format. The developer overview lives on VPS with API.
Rather not write the code yourself? Hand it to an agent in one message:
Read the 0x.cloud OpenAPI spec at https://0x.cloud/v1/openapi.json and write a Python script that gets the dry_run price for an hourly s1-2, prints it, asks for confirmation in the terminal, and only after "y" creates the server with the pricing_fingerprint from the quote and an Idempotency-Key header, then waits via /servers/{id}/wait. Read the key from the OX_API_KEY environment variable and save the root password to a file with 600 permissions.
Common Errors and Fixes
| Code or error | Cause | Fix |
|---|---|---|
401 unauthenticated |
missing key, extra space, no Bearer |
check the header and echo $OX_API_KEY |
403 insufficient_scope |
the key lacks the scope | grant it in the dashboard or use another key |
402 insufficient_balance |
not enough money on the balance | top up |
402 key_spend_limit_reached |
the key's monthly cap is used up | raise the cap in the dashboard |
409 price_changed |
quote older than 10 minutes or parameters differ from the dry run | rerun dry_run and review the new price in error.quote |
422 validation_failed |
invalid fields: plan code, hostname | error.message lists the fields; plan codes are s1-1, s1-2, s2-4, s4-8 |
429 rate_limited |
more than 120 requests per minute on the key | add pauses between calls |
Errors come back as {"error": {"code": "...", "message": "..."}}. Code against code: messages default to Russian, and Accept-Language: en switches them to English.
FAQ
How do I create a VPS via the API? First POST to /v1/servers with the plan, billing cycle and dry_run: true to get the exact price and a pricing_fingerprint. Then repeat the request without dry_run, passing that pricing_fingerprint within 10 minutes.
Where is the full API reference? In the OpenAPI spec at https://0x.cloud/v1/openapi.json. Load it into Swagger UI or Postman, or generate a client in your language.
How do I pass the API key? In the Authorization: Bearer your_key header. The same key works with the 0x.cloud MCP server.
Can I use the API without writing code? Yes. Connect the 0x.cloud MCP server to Claude, Cursor or ChatGPT and the assistant calls the API for you, or use the HTTP Request node in n8n.