> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hyzecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Apps

> Deploy and manage applications.

## List Apps

```http GET /api/apps/ theme={"system"}
```

Returns all apps in your workspace. Pass `?workspaceId=` to target a specific workspace when using an API key.

| Field            | Type     | Description                 |
| ---------------- | -------- | --------------------------- |
| `workspaceId`    | `string` | Target workspace (optional) |
| `organizationId` | `string` | Target org (optional)       |

```json Response theme={"system"}
{
  "success": true,
  "apps": [
    {
      "id": "app_001",
      "name": "my-api",
      "runtime": "node",
      "status": "running",
      "memoryMB": 512,
      "exposePort": 3000,
      "subdomain": "my-api"
    }
  ],
  "meta": { "total": 1 }
}
```

***

## Get App

```http GET /api/apps/:appId theme={"system"}
```

***

## Deploy from ZIP

```http POST /api/apps/deploy theme={"system"}
```

Upload a ZIP file and deploy a new application.

<Accordion title="Request body (multipart/form-data)">
  | Field            | Type            | Required | Description                                                                             |
  | ---------------- | --------------- | -------- | --------------------------------------------------------------------------------------- |
  | `file`           | `File`          | Yes      | ZIP containing your app                                                                 |
  | `name`           | `string`        | Yes      | App name                                                                                |
  | `runtime`        | `string`        | Yes      | `node` \| `bun` \| `python`                                                             |
  | `memoryMB`       | `number`        | Yes      | Memory allocation (MB)                                                                  |
  | `startupCommand` | `string`        | No       | Start command. Omit or `"auto"` to let Hyze detect (Vite, Next, Node, static, Python…). |
  | `envVars`        | `string (JSON)` | No       | Environment variables                                                                   |
  | `exposePort`     | `number`        | No       | Port to expose                                                                          |
  | `subdomain`      | `string`        | No       | Custom subdomain                                                                        |
  | `autoRestart`    | `boolean`       | No       | Auto-restart on crash                                                                   |
  | `machineId`      | `string`        | No       | Target specific machine                                                                 |
</Accordion>

```bash Language=bash theme={"system"}
curl -X POST https://api.hyzecloud.com/api/apps/deploy \
  -H "Authorization: Bearer hyze_your_key" \
  -F "file=@app.zip" \
  -F "name=my-api" \
  -F "runtime=node" \
  -F "memoryMB=512" \
  -F "exposePort=3000"
# optional: -F "startupCommand=node server.js"  (omit or use auto for detection)
```

***

## Deploy from GitHub Repo

```http POST /api/apps/deploy-from-repo theme={"system"}
```

Deploy from a connected GitHub repository.

<Accordion title="Request body">
  | Field            | Type            | Required | Description                                                                             |
  | ---------------- | --------------- | -------- | --------------------------------------------------------------------------------------- |
  | `name`           | `string`        | Yes      | App name                                                                                |
  | `runtime`        | `string`        | Yes      | `node` \| `bun` \| `python`                                                             |
  | `memoryMB`       | `number`        | Yes      | Memory (MB)                                                                             |
  | `startupCommand` | `string`        | No       | Start command. Omit or `"auto"` to let Hyze detect (Vite, Next, Node, static, Python…). |
  | `envVars`        | `string (JSON)` | No       | Environment variables                                                                   |
  | `exposePort`     | `number`        | No       | Port to expose                                                                          |
  | `subdomain`      | `string`        | No       | Custom subdomain                                                                        |
  | `autoDeploy`     | `boolean`       | No       | Auto-deploy on push                                                                     |
  | `machineId`      | `string`        | No       | Target machine                                                                          |
  | `repository`     | `object`        | Yes      | `{ id, owner, name, branch, path?, githubInstallationId? }`                             |
</Accordion>

***

## Inspect Env

```http POST /api/apps/inspect-env theme={"system"}
```

Upload a ZIP and detect required environment variables without deploying.

| Field  | Type   | Required | Description |
| ------ | ------ | -------- | ----------- |
| `file` | `File` | Yes      | ZIP file    |

***

## Start App

```http POST /api/apps/:appId/start theme={"system"}
```

***

## Stop App

```http POST /api/apps/:appId/stop theme={"system"}
```

***

## Restart App

```http POST /api/apps/:appId/restart theme={"system"}
```

***

## Delete App

```http DELETE /api/apps/:appId theme={"system"}
```

***

## Get Logs

```http GET /api/apps/:appId/logs theme={"system"}
```

| Field        | Type      | Default | Description        |
| ------------ | --------- | ------- | ------------------ |
| `tail`       | `number`  | `100`   | Number of lines    |
| `timestamps` | `boolean` | `false` | Include timestamps |

***

## Get Environment Variables

```http GET /api/apps/:appId/env theme={"system"}
```

Returns decrypted environment variables.

```json Response theme={"system"}
{
  "success": true,
  "envVars": { "DATABASE_URL": "...", "PORT": "3000" }
}
```

***

## Set Environment Variables

```http PUT /api/apps/:appId/env theme={"system"}
```

Merges new variables into existing ones.

| Field     | Type                     | Required | Description     |
| --------- | ------------------------ | -------- | --------------- |
| `envVars` | `Record<string, string>` | Yes      | Key-value pairs |

```bash Language=bash theme={"system"}
curl -X PUT https://api.hyzecloud.com/api/apps/app_001/env \
  -H "Authorization: Bearer hyze_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "envVars": { "NODE_ENV": "production" } }'
```

***

## Update Settings

```http PUT /api/apps/:appId/settings theme={"system"}
```

Updates app settings. When runtime-affecting fields change, the container is restarted.

| Field            | Type             | Description                                             |
| ---------------- | ---------------- | ------------------------------------------------------- |
| `name`           | `string`         | New name                                                |
| `runtime`        | `string`         | `node` \| `bun` \| `python`                             |
| `memoryMB`       | `number`         | Memory (MB)                                             |
| `startupCommand` | `string`         | Start command (`"auto"` or custom). Optional on create. |
| `exposePort`     | `number \| null` | Port to expose                                          |
| `subdomain`      | `string \| null` | Custom subdomain                                        |
| `autoRestart`    | `boolean`        | Auto-restart on crash                                   |

***

## Get Build History

```http GET /api/apps/:appId/builds theme={"system"}
```

Returns recent deploy build entries.
