Apps API

The Apps API lets you deploy containers, manage environments, scale replicas, view logs, and perform rollbacks.

List Apps

GET /api/v1/apps
Response:
[
  {
    "id": "app_a1b2c3d4",
    "project_id": "proj_default",
    "name": "my-api",
    "slug": "my-api",
    "source_type": "image",
    "image_url": "nginx:latest",
    "replicas": 2,
    "port": 80,
    "status": "running",
    "last_deploy_at": "2024-01-15T10:30:00Z",
    "created_at": "2024-01-15T10:00:00Z"
  }
]

Create an App

POST /api/v1/apps
name
string
required
Application name (used for subdomain)
source_type
string
required
Source type: image, git, or upload
image_url
string
Docker image URL (required for image source type)
repo_url
string
Git repository URL (required for git source type)
repo_branch
string
Git branch to deploy (default: main)
build_command
string
Build command for git/upload sources
port
integer
required
Port the application listens on
replicas
integer
Number of replicas (default: 1)
env
object
Environment variables as key-value pairs
template_id
string
Marketplace template ID for one-click deploys

Image-Based Deploy

{
  "name": "my-api",
  "source_type": "image",
  "image_url": "myregistry.com/api:v2.1",
  "port": 3000,
  "replicas": 3,
  "env": {
    "NODE_ENV": "production",
    "DATABASE_URL": "postgresql://..."
  }
}

Git-Based Deploy

{
  "name": "my-frontend",
  "source_type": "git",
  "repo_url": "https://github.com/user/frontend.git",
  "repo_branch": "main",
  "build_command": "npm run build",
  "port": 3000
}

Get an App

GET /api/v1/apps/{id}

Update an App

PATCH /api/v1/apps/{id}
Update configuration, scaling, or environment:
{
  "replicas": 5,
  "env": {
    "LOG_LEVEL": "debug"
  }
}

Delete an App

DELETE /api/v1/apps/{id}
Removes the app and all associated Kubernetes resources (Deployment, Service, Ingress, ConfigMap).

Deploy / Redeploy

Trigger a new deployment:
POST /api/v1/apps/{id}/deploy
For image-based apps, this pulls the latest version of the image. For git-based apps, this rebuilds from the latest commit.

Restart

Restart all pods without redeploying:
POST /api/v1/apps/{id}/restart

Build from Source

Upload source code as a tarball and trigger a build:
POST /api/v1/apps/{id}/build
Content-Type: multipart/form-data

App Status

Get runtime status including ready replicas and pod phases:
GET /api/v1/apps/{id}/status
{
  "desired_replicas": 3,
  "ready_replicas": 3,
  "pods": [
    { "name": "my-api-7d8f9-abc12", "phase": "Running", "ready": true },
    { "name": "my-api-7d8f9-def34", "phase": "Running", "ready": true },
    { "name": "my-api-7d8f9-ghi56", "phase": "Running", "ready": true }
  ]
}

Logs

Tail application logs from running pods:
GET /api/v1/apps/{id}/logs

Build Logs

View build output for git/upload deployments:
GET /api/v1/apps/{id}/build-log

Metrics

Get CPU, memory, disk, and network metrics:
GET /api/v1/apps/{id}/metrics

Deployment History

List all deployments:
GET /api/v1/apps/{id}/deployments
[
  {
    "id": "dep_001",
    "app_id": "app_a1b2c3d4",
    "status": "active",
    "image": "myregistry.com/api:v2.1",
    "created_at": "2024-01-15T10:30:00Z"
  },
  {
    "id": "dep_002",
    "app_id": "app_a1b2c3d4",
    "status": "superseded",
    "image": "myregistry.com/api:v2.0",
    "created_at": "2024-01-14T08:00:00Z"
  }
]

Rollback

Revert to a previous deployment:
POST /api/v1/apps/{id}/deployments/{deploymentId}/revert

Pods

List running pods for the app:
GET /api/v1/apps/{id}/pods

Events

List Kubernetes events:
GET /api/v1/apps/{id}/events

Audit Log

View all actions performed on the app:
GET /api/v1/apps/{id}/audit
[
  {
    "action": "deploy",
    "user": "admin",
    "details": "Deployed image myregistry.com/api:v2.1",
    "created_at": "2024-01-15T10:30:00Z"
  }
]