# Python Applications

<a id="get-api-v1-accounts-username-python-apps"></a>
#### `GET /api/v1/accounts/{username}/python-apps`

*List Python apps*

List all Python applications for an account.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_list_PythonAppResponse__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": [
    {
      "app_dir": "...",
      "app_name": "...",
      "app_type": "...",
      "auto_restart": "...",
      "created_at": "...",
      "display_name": "...",
      "domain": "...",
      "entry_point": "...",
      "env_vars": "...",
      "media_dir": "...",
      "media_url": "...",
      "python_version": "...",
      "server_type": "...",
      "socket_path": "...",
      "static_dir": "...",
      "static_url": "...",
      "status": "...",
      "username": "...",
      "venv_dir": "...",
      "websocket": "...",
      "worker_class": "...",
      "workers": "..."
    }
  ],
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps
```

---

<a id="post-api-v1-accounts-username-python-apps"></a>
#### `POST /api/v1/accounts/{username}/python-apps`

*Create Python app*

Create a new Python application for an account.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `app_name` | string | yes | Application identifier (slug); pattern=`^[a-z][a-z0-9_-]{1,30}$` |
| `app_type` | string | no | Framework type: django \| flask \| fastapi \| custom; default `django`; pattern=`^(django\|flask\|fastapi\|custom)$` |
| `auto_restart` | boolean | no | Auto-restart on failure; default `True` |
| `display_name` | string | yes | Human-readable name; minLength=1; maxLength=100 |
| `domain` | string | yes | Associated domain; minLength=3; maxLength=253 |
| `entry_point` | string | yes | WSGI/ASGI entry point (e.g. myapp.wsgi:application); minLength=3; maxLength=200 |
| `env_vars` | object | no | Environment variables |
| `media_dir` | string | no | Media files directory (relative to app) |
| `media_url` | string | no | Media files URL prefix; default `/media/` |
| `python_version` | string | yes | Python version (e.g. 3.12); pattern=`^3\.\d{1,2}$` |
| `server_type` | string | no | Application server: gunicorn \| uvicorn; default `gunicorn`; pattern=`^(gunicorn\|uvicorn)$` |
| `static_dir` | string | no | Static files directory (relative to app) |
| `static_url` | string | no | Static files URL prefix; default `/static/` |
| `websocket` | boolean | no | Enable WebSocket support (ASGI); default `False` |
| `worker_class` | string | no | Worker class: sync \| gthread \| uvicorn.workers.UvicornWorker; default `sync`; pattern=`^(sync\|gthread\|uvicorn\.workers\.UvicornWorker)$` |
| `workers` | integer | no | Number of workers; default `2`; minimum=1.0; maximum=16.0 |

**Request body example:**

```json
{
  "app_name": "string",
  "app_type": "django",
  "auto_restart": true,
  "display_name": "string",
  "domain": "example.com",
  "entry_point": "string",
  "env_vars": {},
  "media_dir": "string",
  "media_url": "/media/",
  "python_version": "string",
  "server_type": "gunicorn",
  "static_dir": "string",
  "static_url": "/static/",
  "websocket": false,
  "worker_class": "sync",
  "workers": 2
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PythonAppResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "app_dir": "string",
    "app_name": "string",
    "app_type": "string",
    "auto_restart": true,
    "created_at": "...",
    "display_name": "string",
    "domain": "example.com",
    "entry_point": "string",
    "env_vars": {},
    "media_dir": "...",
    "media_url": "string",
    "python_version": "string",
    "server_type": "string",
    "socket_path": "string",
    "static_dir": "...",
    "static_url": "string",
    "status": "unknown",
    "username": "alice",
    "venv_dir": "string",
    "websocket": false,
    "worker_class": "string",
    "workers": 0
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/python-apps
```

---

<a id="post-api-v1-accounts-username-python-apps-analyze"></a>
#### `POST /api/v1/accounts/{username}/python-apps/analyze`

*Analyze Python project*

Analyze an uploaded archive or server-side path; returns framework + entry point + warnings.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `archive` | string | no | — |
| `server_path` | string | no | — |

**Request body example:**

```json
{
  "archive": "string",
  "server_path": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/analyze
```

---

<a id="post-api-v1-accounts-username-python-apps-deploy"></a>
#### `POST /api/v1/accounts/{username}/python-apps/deploy`

*Deploy Python project*

Kick off the deploy pipeline. Returns a task_id for SSE subscription.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `cleanup_source` | boolean | no | default `True` |
| `create` | PythonAppCreate | yes | — |
| `include_secrets` | boolean | no | default `False` |
| `media_archive_path` | string | no | — |
| `overwrite` | boolean | no | default `False` |
| `project_root_in_source` | string | no | default ``; maxLength=1024 |
| `run_collectstatic` | boolean | no | default `True` |
| `run_migrations` | boolean | no | default `True` |
| `source_path` | string | yes | minLength=1; maxLength=4096 |
| `sql_dump_path` | string | no | — |

**Request body example:**

```json
{
  "cleanup_source": true,
  "create": {
    "app_name": "string",
    "app_type": "django",
    "auto_restart": true,
    "display_name": "string",
    "domain": "example.com",
    "entry_point": "string",
    "env_vars": {},
    "media_dir": "string",
    "media_url": "/media/",
    "python_version": "string",
    "server_type": "gunicorn",
    "static_dir": "string",
    "static_url": "/static/",
    "websocket": false,
    "worker_class": "sync",
    "workers": 2
  },
  "include_secrets": false,
  "media_archive_path": "string",
  "overwrite": false,
  "project_root_in_source": "",
  "run_collectstatic": true,
  "run_migrations": true,
  "source_path": "string",
  "sql_dump_path": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/deploy
```

---

<a id="get-api-v1-accounts-username-python-apps-deploy-task-id"></a>
#### `GET /api/v1/accounts/{username}/python-apps/deploy/{task_id}`

*Deploy task status*

Snapshot of a deploy task (for polling fallback when SSE is unavailable).

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `task_id` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/deploy/{task_id}
```

---

<a id="get-api-v1-accounts-username-python-apps-deploy-task-id-events"></a>
#### `GET /api/v1/accounts/{username}/python-apps/deploy/{task_id}/events`

*Deploy Events*

Server-Sent Events stream for a running deploy task.

Rate limiting is intentionally skipped here — the client holds an
open connection for the task's lifetime.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `task_id` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | — | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/deploy/{task_id}/events
```

---

<a id="post-api-v1-accounts-username-python-apps-migration-upload"></a>
#### `POST /api/v1/accounts/{username}/python-apps/migration/upload`

*Upload migration assets*

Stage an existing-installation SQL dump and/or media archive for the next deploy.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `media_archive` | string | no | — |
| `sql_dump` | string | no | — |

**Request body example:**

```json
{
  "media_archive": "string",
  "sql_dump": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/migration/upload
```

---

<a id="delete-api-v1-accounts-username-python-apps-app-name"></a>
#### `DELETE /api/v1/accounts/{username}/python-apps/{app_name}`

*Delete Python app*

Delete a Python application.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `MessageResponse` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "message": "string",
  "status": "success"
}
```

**cURL example:**

```bash
curl -X DELETE \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}
```

---

<a id="get-api-v1-accounts-username-python-apps-app-name"></a>
#### `GET /api/v1/accounts/{username}/python-apps/{app_name}`

*Get Python app*

Get details of a Python application.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PythonAppResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "app_dir": "string",
    "app_name": "string",
    "app_type": "string",
    "auto_restart": true,
    "created_at": "...",
    "display_name": "string",
    "domain": "example.com",
    "entry_point": "string",
    "env_vars": {},
    "media_dir": "...",
    "media_url": "string",
    "python_version": "string",
    "server_type": "string",
    "socket_path": "string",
    "static_dir": "...",
    "static_url": "string",
    "status": "unknown",
    "username": "alice",
    "venv_dir": "string",
    "websocket": false,
    "worker_class": "string",
    "workers": 0
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}
```

---

<a id="put-api-v1-accounts-username-python-apps-app-name"></a>
#### `PUT /api/v1/accounts/{username}/python-apps/{app_name}`

*Update Python app*

Update a Python application's configuration.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `auto_restart` | boolean | no | — |
| `display_name` | string | no | — |
| `domain` | string | no | — |
| `entry_point` | string | no | — |
| `media_dir` | string | no | — |
| `media_url` | string | no | — |
| `python_version` | string | no | — |
| `static_dir` | string | no | — |
| `static_url` | string | no | — |
| `websocket` | boolean | no | — |
| `worker_class` | string | no | — |
| `workers` | integer | no | — |

**Request body example:**

```json
{
  "auto_restart": false,
  "display_name": "string",
  "domain": "string",
  "entry_point": "string",
  "media_dir": "string",
  "media_url": "string",
  "python_version": "string",
  "static_dir": "string",
  "static_url": "string",
  "websocket": false,
  "worker_class": "string",
  "workers": 1.0
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PythonAppResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "app_dir": "string",
    "app_name": "string",
    "app_type": "string",
    "auto_restart": true,
    "created_at": "...",
    "display_name": "string",
    "domain": "example.com",
    "entry_point": "string",
    "env_vars": {},
    "media_dir": "...",
    "media_url": "string",
    "python_version": "string",
    "server_type": "string",
    "socket_path": "string",
    "static_dir": "...",
    "static_url": "string",
    "status": "unknown",
    "username": "alice",
    "venv_dir": "string",
    "websocket": false,
    "worker_class": "string",
    "workers": 0
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}
```

---

<a id="get-api-v1-accounts-username-python-apps-app-name-env"></a>
#### `GET /api/v1/accounts/{username}/python-apps/{app_name}/env`

*Get env vars*

Get environment variables for a Python app.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/env
```

---

<a id="put-api-v1-accounts-username-python-apps-app-name-env"></a>
#### `PUT /api/v1/accounts/{username}/python-apps/{app_name}/env`

*Set env vars*

Set environment variables for a Python app.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `env_vars` | object | yes | — |

**Request body example:**

```json
{
  "env_vars": {}
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/env
```

---

<a id="get-api-v1-accounts-username-python-apps-app-name-logs"></a>
#### `GET /api/v1/accounts/{username}/python-apps/{app_name}/logs`

*Get app logs*

Tail the application's error/access logs.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Query parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `lines` | integer | no | minimum=1; maximum=5000 |
| `log_type` | string | no | pattern=`^(error\|access)$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/logs
```

---

<a id="post-api-v1-accounts-username-python-apps-app-name-manage"></a>
#### `POST /api/v1/accounts/{username}/python-apps/{app_name}/manage`

*Run manage.py*

Run a Django manage.py command on the app's virtualenv.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `args` | array<string> | no | — |
| `command` | string | yes | minLength=1; maxLength=50; pattern=`^[a-z_]+$` |

**Request body example:**

```json
{
  "args": [
    "string"
  ],
  "command": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_ManagePyResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "command": "string",
    "exit_code": 0,
    "stderr": "string",
    "stdout": "string"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/manage
```

---

<a id="get-api-v1-accounts-username-python-apps-app-name-pip"></a>
#### `GET /api/v1/accounts/{username}/python-apps/{app_name}/pip`

*List pip packages*

List installed pip packages.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_list_PipPackageEntry__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": [
    {
      "name": "...",
      "version": "..."
    }
  ],
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/pip
```

---

<a id="post-api-v1-accounts-username-python-apps-app-name-pip-install"></a>
#### `POST /api/v1/accounts/{username}/python-apps/{app_name}/pip/install`

*Install pip packages*

Install pip packages.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `packages` | array<string> | yes | — |

**Request body example:**

```json
{
  "packages": [
    "string"
  ]
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/pip/install
```

---

<a id="post-api-v1-accounts-username-python-apps-app-name-pip-requirements"></a>
#### `POST /api/v1/accounts/{username}/python-apps/{app_name}/pip/requirements`

*Install from requirements.txt*

Install packages declared in the project's requirements.txt.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/pip/requirements
```

---

<a id="post-api-v1-accounts-username-python-apps-app-name-pip-uninstall"></a>
#### `POST /api/v1/accounts/{username}/python-apps/{app_name}/pip/uninstall`

*Uninstall pip packages*

Uninstall pip packages.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `packages` | array<string> | yes | — |

**Request body example:**

```json
{
  "packages": [
    "string"
  ]
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/pip/uninstall
```

---

<a id="post-api-v1-accounts-username-python-apps-app-name-restart"></a>
#### `POST /api/v1/accounts/{username}/python-apps/{app_name}/restart`

*Restart Python app*

Restart a Python application.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/restart
```

---

<a id="post-api-v1-accounts-username-python-apps-app-name-start"></a>
#### `POST /api/v1/accounts/{username}/python-apps/{app_name}/start`

*Start Python app*

Start a Python application.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/start
```

---

<a id="get-api-v1-accounts-username-python-apps-app-name-status"></a>
#### `GET /api/v1/accounts/{username}/python-apps/{app_name}/status`

*Python app status*

Get runtime status of a Python application.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PythonAppStatusResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "app_name": "string",
    "memory_mb": "...",
    "pid": "...",
    "status": "string",
    "uptime": "..."
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/status
```

---

<a id="post-api-v1-accounts-username-python-apps-app-name-stop"></a>
#### `POST /api/v1/accounts/{username}/python-apps/{app_name}/stop`

*Stop Python app*

Stop a Python application.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | pattern=`^[a-z][a-z0-9]{2,15}$` |
| `app_name` | string | yes | pattern=`^[a-z][a-z0-9_-]{1,30}$` |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/python-apps/{app_name}/stop
```

---

<a id="get-api-v1-system-python-apps"></a>
#### `GET /api/v1/system/python/apps`

*List all Python apps*

Admin overview — list Python apps across all accounts.

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_list_PythonAppResponse__` | Successful Response |

**Response example (200):**

```json
{
  "data": [
    {
      "app_dir": "...",
      "app_name": "...",
      "app_type": "...",
      "auto_restart": "...",
      "created_at": "...",
      "display_name": "...",
      "domain": "...",
      "entry_point": "...",
      "env_vars": "...",
      "media_dir": "...",
      "media_url": "...",
      "python_version": "...",
      "server_type": "...",
      "socket_path": "...",
      "static_dir": "...",
      "static_url": "...",
      "status": "...",
      "username": "...",
      "venv_dir": "...",
      "websocket": "...",
      "worker_class": "...",
      "workers": "..."
    }
  ],
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/system/python/apps
```

---

<a id="get-api-v1-system-python-versions"></a>
#### `GET /api/v1/system/python/versions`

*List Python versions*

List installed Python versions on the server.

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/system/python/versions
```

---
