Hanzo

Containers API

Deploy, manage, and monitor container workloads

The Containers API manages container deployments across your clusters. It supports Docker images from any registry and handles the full deployment lifecycle.

Endpoints

ProcedureMethodDescription
container.allGETList all containers in a project
container.oneGETGet container details
container.createPOSTCreate a new container deployment
container.updatePATCHUpdate container configuration
container.removeDELETERemove a container
container.deployPOSTTrigger a new deployment
container.restartPOSTRestart running instances
container.stopPOSTStop a container
container.startPOSTStart a stopped container
container.logsGETStream container logs

List Containers

GET /api/container.all?projectId=proj_abc123

curl "https://app.platform.hanzo.ai/api/container.all?projectId=proj_abc123" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response:

{
  "result": {
    "data": [
      {
        "id": "ctr_abc123",
        "name": "web",
        "image": "ghcr.io/myorg/web:v1.2.3",
        "status": "running",
        "replicas": 3,
        "port": 3000,
        "clusterId": "cluster_abc123",
        "createdAt": "2025-09-01T10:00:00Z"
      },
      {
        "id": "ctr_def456",
        "name": "worker",
        "image": "ghcr.io/myorg/worker:v1.2.3",
        "status": "running",
        "replicas": 1,
        "port": null,
        "clusterId": "cluster_abc123",
        "createdAt": "2025-09-01T10:05:00Z"
      }
    ]
  }
}

Get Container

GET /api/container.one?containerId=ctr_abc123

curl "https://app.platform.hanzo.ai/api/container.one?containerId=ctr_abc123" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response:

{
  "result": {
    "data": {
      "id": "ctr_abc123",
      "name": "web",
      "image": "ghcr.io/myorg/web:v1.2.3",
      "status": "running",
      "replicas": 3,
      "port": 3000,
      "clusterId": "cluster_abc123",
      "env": [
        { "key": "NODE_ENV", "value": "production" },
        { "key": "DATABASE_URL", "value": "***" }
      ],
      "resources": {
        "cpuLimit": "500m",
        "memoryLimit": "512Mi"
      },
      "domains": ["app.example.com"],
      "healthCheck": {
        "path": "/health",
        "port": 3000,
        "interval": 30
      },
      "createdAt": "2025-09-01T10:00:00Z",
      "lastDeployedAt": "2026-02-20T15:30:00Z"
    }
  }
}

Create Container

POST /api/container.create

curl -X POST https://app.platform.hanzo.ai/api/container.create \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "proj_abc123",
    "clusterId": "cluster_abc123",
    "name": "web",
    "image": "ghcr.io/myorg/web:v1.2.3",
    "port": 3000,
    "replicas": 3,
    "env": [
      { "key": "NODE_ENV", "value": "production" }
    ],
    "resources": {
      "cpuLimit": "500m",
      "memoryLimit": "512Mi"
    },
    "healthCheck": {
      "path": "/health",
      "port": 3000,
      "interval": 30
    }
  }'

Parameters:

FieldTypeRequiredDescription
projectIdstringYesProject ID
clusterIdstringYesTarget cluster
namestringYesContainer name
imagestringYesDocker image reference
portnumberNoExposed port
replicasnumberNoNumber of instances (default: 1)
envarrayNoEnvironment variables
resourcesobjectNoCPU and memory limits
healthCheckobjectNoHealth check configuration

Response: 201 Created

Update Container

PATCH /api/container.update

Update configuration without triggering a new deployment. Use container.deploy to roll out changes.

curl -X PATCH https://app.platform.hanzo.ai/api/container.update \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "containerId": "ctr_abc123",
    "replicas": 5,
    "env": [
      { "key": "NODE_ENV", "value": "production" },
      { "key": "LOG_LEVEL", "value": "info" }
    ]
  }'

Deploy

POST /api/container.deploy

Trigger a new deployment with an updated image tag or configuration.

curl -X POST https://app.platform.hanzo.ai/api/container.deploy \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "containerId": "ctr_abc123",
    "image": "ghcr.io/myorg/web:v1.3.0"
  }'

Response:

{
  "result": {
    "data": {
      "deploymentId": "dep_xyz789",
      "status": "in_progress",
      "previousImage": "ghcr.io/myorg/web:v1.2.3",
      "newImage": "ghcr.io/myorg/web:v1.3.0",
      "triggeredAt": "2026-02-26T10:00:00Z"
    }
  }
}

Deployments use a rolling update strategy by default. If the health check fails, the deployment is automatically rolled back.

Lifecycle Operations

Restart

curl -X POST https://app.platform.hanzo.ai/api/container.restart \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "containerId": "ctr_abc123" }'

Stop

curl -X POST https://app.platform.hanzo.ai/api/container.stop \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "containerId": "ctr_abc123" }'

Start

curl -X POST https://app.platform.hanzo.ai/api/container.start \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "containerId": "ctr_abc123" }'

Logs

GET /api/container.logs?containerId=ctr_abc123

Stream logs from all replicas of a container.

curl "https://app.platform.hanzo.ai/api/container.logs?containerId=ctr_abc123&tail=100" \
  -H "Authorization: Bearer YOUR_TOKEN"

Query parameters:

ParameterTypeDefaultDescription
containerIdstring--Container ID
tailnumber100Number of recent lines
sincestring--ISO 8601 timestamp
followbooleanfalseStream logs in real time

Delete Container

DELETE /api/container.remove

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

Response: 204 No Content

Deleting a container stops all running instances and removes associated domains and volumes. This cannot be undone.

Container Status Values

StatusDescription
creatingContainer is being provisioned
runningAll replicas are healthy
deployingA new deployment is rolling out
stoppedContainer is stopped
errorOne or more replicas have failed
deletingContainer is being removed

How is this guide?

Last updated on

On this page