Documentation

api

Deployments API

Create, manage, and monitor deployments via the REST API.

Deployments#

Deployments are the core resource in Runix. Each deployment represents a running service — a web app, API, worker, database, or static site.


GET/deployments

List all deployments in your workspace.

🔒 Auth: Bearer token required

Parameters
statusstringoptionalFilter by status: running, failed, stopped, building
project_iduuidoptionalFilter by project
Response
[
  {
    "id": "a1b2c3d4-...",
    "service_name": "my-api",
    "status": "running",
    "subdomain": "my-api-x7kf",
    "service_type": "web_service",
    "instance_type": "starter",
    "created_at": "2026-02-25T10:00:00Z"
  }
]

Example: list all deployments

bash
curl https://api.runix.dev/deployments \
  -H "Authorization: Bearer $TOKEN"

POST/deployments

Create a new deployment. Runix clones the repo, detects the runtime, generates a Dockerfile with AI, builds the image, and starts the container.

🔒 Auth: Bearer token required

Parameters
repo_urlstringrequiredGitHub repository URL (e.g., https://github.com/user/repo)
branchstringoptionalBranch to deploy. Defaults to main.
service_namestringrequiredUnique name for the service (lowercase, hyphens allowed)
service_typestringrequiredOne of: web_service, static_site, background_worker, cron_job, postgresql, redis, kafka
instance_typestringoptionalOne of: starter, standard, pro. Defaults to starter.
envobjectoptionalKey-value pairs of environment variables to set
project_iduuidoptionalProject to assign this deployment to
Response
{
  "id": "a1b2c3d4-...",
  "service_name": "my-api",
  "status": "building",
  "subdomain": "my-api-x7kf",
  "url": "https://my-api-x7kf.runixcloud.dev"
}

Example: create a deployment

bash
curl -X POST https://api.runix.dev/deployments \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "repo_url": "https://github.com/user/my-api",
    "service_name": "my-api",
    "service_type": "web_service",
    "env": {
      "NODE_ENV": "production"
    }
  }'

GET/deployments/{id}

Get full details for a single deployment, including status, URL, configuration, and resource usage.

🔒 Auth: Bearer token required

Parameters
iduuidrequiredDeployment ID
Response
{
  "id": "a1b2c3d4-...",
  "service_name": "my-api",
  "status": "running",
  "subdomain": "my-api-x7kf",
  "url": "https://my-api-x7kf.runixcloud.dev",
  "repo_url": "https://github.com/user/my-api",
  "branch": "main",
  "service_type": "web_service",
  "instance_type": "starter",
  "created_at": "2026-02-25T10:00:00Z",
  "updated_at": "2026-02-25T10:05:00Z"
}

DELETE/deployments/{id}

Stop and delete a deployment. This stops the container and removes all associated resources. This action cannot be undone.

🔒 Auth: Bearer token required

Parameters
iduuidrequiredDeployment ID

Deleting a deployment permanently removes the container and its data. Database deployments will lose all stored data. Make sure you have backups before deleting.

Example: delete a deployment

bash
curl -X DELETE https://api.runix.dev/deployments/a1b2c3d4-... \
  -H "Authorization: Bearer $TOKEN"

POST/deployments/{id}/redeploy

Trigger a fresh build and deploy from the latest commit on the configured branch. This pulls the latest code, regenerates the Dockerfile if needed, and replaces the running container.

🔒 Auth: Bearer token required

Parameters
iduuidrequiredDeployment ID
Response
{
  "id": "a1b2c3d4-...",
  "status": "building"
}

Example: redeploy

bash
curl -X POST https://api.runix.dev/deployments/a1b2c3d4-.../redeploy \
  -H "Authorization: Bearer $TOKEN"

POST/deployments/{id}/rollback

Roll back to a previous deployment version. Restores the container from a previous build without rebuilding.

🔒 Auth: Bearer token required

Parameters
iduuidrequiredDeployment ID
Response
{
  "id": "a1b2c3d4-...",
  "status": "running",
  "message": "Rolled back successfully"
}

GET/deployments/{id}/history

List the deployment history, including previous builds and rollbacks.

🔒 Auth: Bearer token required

Parameters
iduuidrequiredDeployment ID
Response
[
  {
    "version": 3,
    "status": "running",
    "commit_sha": "abc1234",
    "created_at": "2026-02-25T12:00:00Z"
  },
  {
    "version": 2,
    "status": "replaced",
    "commit_sha": "def5678",
    "created_at": "2026-02-24T15:00:00Z"
  }
]

GET/deployments/{id}/logs

Stream runtime logs from the running container in real time. Returns a Server-Sent Events (SSE) stream.

🔒 Auth: Bearer token required

Parameters
iduuidrequiredDeployment ID

This endpoint returns a Server-Sent Events (SSE) stream, not regular JSON. Use an SSE client or curl with --no-buffer to consume it.

Example: stream runtime logs

bash
curl -N https://api.runix.dev/deployments/a1b2c3d4-.../logs \
  -H "Authorization: Bearer $TOKEN"

GET/deployments/{id}/build-stream

Stream build logs during the Docker image build process. Returns a Server-Sent Events (SSE) stream. Useful for watching builds in progress.

🔒 Auth: Bearer token required

Parameters
iduuidrequiredDeployment ID

Example: stream build logs

bash
curl -N https://api.runix.dev/deployments/a1b2c3d4-.../build-stream \
  -H "Authorization: Bearer $TOKEN"

GET/deployments/{id}/connection

Get connection details for a database deployment (PostgreSQL, Redis, Kafka). Returns the host, port, username, password, and connection string.

🔒 Auth: Bearer token required

Parameters
iduuidrequiredDeployment ID (must be a database service)
Response
{
  "host": "pg-abc123.runixcloud.dev",
  "port": 5432,
  "username": "runix",
  "password": "...",
  "database": "app",
  "connection_string": "postgresql://runix:...@pg-abc123.runixcloud.dev:5432/app"
}

Connection info contains secrets. Do not log or expose these values. Use environment variables to inject them into your application.