Developer reference

Compute, programmable.

Three API families. Standard JSON over HTTPS. From physical infrastructure to workload placement and capacity trading.

Authentication & base URL

Create a Bearer API key in /dashboard/keys. Keep it server-side and export it as XCITY_API_KEY. Every production request sends Authorization: Bearer <key>.

https://api.xcity.net/v1

Endpoint paths below include /v1; append them to https://api.xcity.net once. Python examples use the requests package (pip install requests). max_price is a per-GPU-hour ceiling; count is the number of GPUs.

The production API is described here as an integration contract. This repository implements only the three read-only static demos below. Job submission, reservations, and marketplace mutations in the examples are not live routes in this site.

Management API

Inspect regional infrastructure and operate facilities and clusters. Facility API and Cluster API are part of this family.

MethodEndpointPurpose / request
GET/v1/regionsList regions, commissioned MW, GPUs, PUE, and health metrics.
GET/v1/facilitiesList power, cooling, and facility capacity.
GET/v1/clustersInspect cluster inventory and node health.
POST/v1/clusters/{id}/actionsApply {action: "scale" | "drain" | "reboot"}; scale also takes count.

curl

curl https://api.xcity.net/v1/regions \
  -H "Authorization: Bearer $XCITY_API_KEY"

Python

import os
import requests

response = requests.get(
    "https://api.xcity.net/v1/regions",
    headers={"Authorization": f"Bearer {os.environ['XCITY_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
for region in response.json()["data"]:
    print(region["id"], region["gpu_count"])

Scheduling API

Submit container workloads, monitor job state, cancel execution, and reserve capacity.

MethodEndpointPurpose / request
POST/v1/jobsSubmit image, gpu_type, count, region hint, and max_price in USD/GPU-hr.
GET/v1/jobs/{id}Read state: queued, running, completed, failed, or cancelled.
DELETE/v1/jobs/{id}Cancel a queued or running workload.
POST/v1/reservationsReserve region, gpu_type, count, start_at, and duration_hours.

curl

curl -X POST https://api.xcity.net/v1/jobs \
  -H "Authorization: Bearer $XCITY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image":"ghcr.io/xcity/training:latest","gpu_type":"H200","count":8,"region":"latam-1","max_price":1.8}'

Python

import os
import requests

response = requests.post(
    "https://api.xcity.net/v1/jobs",
    headers={"Authorization": f"Bearer {os.environ['XCITY_API_KEY']}"},
    json={
        "image": "ghcr.io/xcity/training:latest",
        "gpu_type": "H200", "count": 8,
        "region": "latam-1", "max_price": 1.80,
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["id"])

Marketplace API

Publish available capacity, compare offers, place orders, and inspect regional GPU-hour prices.

MethodEndpointPurpose / request
GET/v1/market/offersDiscover available provider capacity and offer IDs.
POST/v1/market/offersSell capacity: region, gpu_type, count, price_per_gpu_hour, available_until.
POST/v1/market/ordersBuy an offer: offer_id, count, duration_hours.
GET/v1/market/pricesRead current on-demand, spot, and reserved rates by region and GPU class.

curl

curl -X POST https://api.xcity.net/v1/market/offers \
  -H "Authorization: Bearer $XCITY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"region":"latam-1","gpu_type":"H200","count":8,"price_per_gpu_hour":1.65,"available_until":"2027-01-01T00:00:00Z"}'

Python

import os
import requests

response = requests.post(
    "https://api.xcity.net/v1/market/orders",
    headers={"Authorization": f"Bearer {os.environ['XCITY_API_KEY']}"},
    json={"offer_id": "offer_xct_01", "count": 8, "duration_hours": 24},
    timeout=30,
)
response.raise_for_status()
print(response.json())

Try it · static JSON demos

These same-origin public examples need no API key. All use the same region and pricing data as the pages and return {"object":"list","data":[...]}. They are static snapshots, not live price feeds.