Hanzo

Clusters API

Manage Kubernetes and Docker Swarm clusters via the API

The Clusters API handles the full lifecycle of compute clusters: creation, configuration, scaling, and deletion.

Endpoints

ProcedureMethodDescription
cluster.allGETList all clusters in the organization
cluster.oneGETGet cluster details
cluster.createPOSTProvision a new cluster
cluster.updatePATCHUpdate cluster settings
cluster.removeDELETEDestroy a cluster
cluster.nodesGETList nodes in a cluster
cluster.addNodePOSTAdd a node to a cluster
cluster.removeNodeDELETERemove a node from a cluster
cluster.grantAccessPOSTGrant user access to a cluster
cluster.listAccessGETList cluster access permissions
cluster.revokeAccessDELETERevoke user access

List Clusters

GET /api/cluster.all?organizationId=org_abc123

curl "https://app.platform.hanzo.ai/api/cluster.all?organizationId=org_abc123" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response:

{
  "result": {
    "data": [
      {
        "id": "cluster_abc123",
        "name": "production",
        "provider": "digitalocean",
        "region": "sfo3",
        "orchestrator": "kubernetes",
        "status": "running",
        "nodeCount": 3,
        "createdAt": "2025-06-01T10:00:00Z"
      },
      {
        "id": "cluster_def456",
        "name": "staging",
        "provider": "hetzner",
        "region": "nbg1",
        "orchestrator": "swarm",
        "status": "running",
        "nodeCount": 1,
        "createdAt": "2025-08-15T14:00:00Z"
      }
    ]
  }
}

Get Cluster

GET /api/cluster.one?clusterId=cluster_abc123

curl "https://app.platform.hanzo.ai/api/cluster.one?clusterId=cluster_abc123" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response:

{
  "result": {
    "data": {
      "id": "cluster_abc123",
      "name": "production",
      "provider": "digitalocean",
      "region": "sfo3",
      "orchestrator": "kubernetes",
      "status": "running",
      "nodeCount": 3,
      "nodes": [
        {
          "id": "node_001",
          "role": "manager",
          "plan": "medium",
          "ip": "203.0.113.10",
          "status": "running"
        },
        {
          "id": "node_002",
          "role": "worker",
          "plan": "small",
          "ip": "203.0.113.11",
          "status": "running"
        }
      ],
      "createdAt": "2025-06-01T10:00:00Z"
    }
  }
}

Create Cluster

POST /api/cluster.create

curl -X POST https://app.platform.hanzo.ai/api/cluster.create \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "organizationId": "org_abc123",
    "name": "production",
    "provider": "digitalocean",
    "region": "sfo3",
    "orchestrator": "kubernetes",
    "nodes": [
      { "role": "manager", "plan": "medium", "count": 1 },
      { "role": "worker", "plan": "small", "count": 2 }
    ]
  }'

Parameters:

FieldTypeRequiredDescription
organizationIdstringYesOrganization ID
namestringYesCluster name
providerstringYesdigitalocean, hetzner, or aws
regionstringYesProvider region code
orchestratorstringYeskubernetes or swarm
nodesarrayYesNode configuration

Node object:

FieldTypeRequiredDescription
rolestringYesmanager or worker
planstringYesVM plan (nano, micro, small, medium, power)
countnumberYesNumber of nodes

Response: 201 Created

Cluster provisioning is asynchronous. The cluster enters provisioning status and transitions to running once all nodes are ready (typically 2-5 minutes).

Update Cluster

PATCH /api/cluster.update

curl -X PATCH https://app.platform.hanzo.ai/api/cluster.update \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "clusterId": "cluster_abc123",
    "name": "production-us-east"
  }'

Add Node

POST /api/cluster.addNode

curl -X POST https://app.platform.hanzo.ai/api/cluster.addNode \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "clusterId": "cluster_abc123",
    "role": "worker",
    "plan": "small"
  }'

The node joins the cluster automatically. For Kubernetes clusters, it is registered as a worker node. For Swarm clusters, it joins as a Swarm worker.

Remove Node

DELETE /api/cluster.removeNode

curl -X DELETE https://app.platform.hanzo.ai/api/cluster.removeNode \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "clusterId": "cluster_abc123",
    "nodeId": "node_002"
  }'

Workloads on the removed node are automatically rescheduled to remaining nodes. Ensure sufficient capacity before removing nodes.

Delete Cluster

DELETE /api/cluster.remove

curl -X DELETE https://app.platform.hanzo.ai/api/cluster.remove \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "clusterId": "cluster_abc123"
  }'

Response: 204 No Content

Destroys all nodes and associated resources. Requires Manage cluster permission.

Cluster Status Values

StatusDescription
provisioningNodes are being created
runningCluster is healthy and accepting workloads
degradedOne or more nodes are unhealthy
updatingCluster is being reconfigured
deletingCluster is being destroyed
errorProvisioning or operation failed

How is this guide?

Last updated on

On this page