API ReferenceREST /api/v1Sign in

Hosting panel modes

Kiwi Host bills clients and tracks server work. Server work (creating a hosting account, suspending, unsuspending, deleting) is done on the hosting server.

Modes

Set HOSTING_PANEL_MODE in .env.

| Mode | What happens | |---|---| | manual (default) | Billing only. Each server change becomes a **server task**. Staff do it by hand in the control panel, then click **Mark done** in admin. Portal server pages (Website, Server, Domains, Email, Databases, FTP, SSL, Backups) are hidden. | | api | Server pages are shown. Tasks run automatically through a registered executor. If the executor fails, the task stays open with a "do it by hand" note. |

Optional: HOSTING_PANEL_URL adds a control-panel link on the portal dashboard. OPS_EMAIL receives an email for each new task.

Server task kinds

| Kind | Raised when | Staff action | |---|---|---| | provision | First invoice paid and email verified | Create the account, add the domain, turn on SSL. Enter the server code and Hestia username in admin. | | suspend | Invoice still unpaid 14 days after due | Suspend the user in the panel. | | unsuspend | Overdue invoice paid while suspended | Unsuspend the user. | | terminate | Still unpaid 51 days after due | Take a final backup, then delete the user. |

A pending suspend and an unsuspend cancel each other, so only the needed one stays open.

Executor contract (for the Hestia API work)

Billing does not know about Hestia. To automate, register one function at worker start-up:

``ts registerServerTaskExecutor(async (kind, task) => { // kind: "provision" | "suspend" | "unsuspend" | "terminate" // task.subscriptionId, task.details (customerCode, domain, package, username, server, …) if (kind === "provision") { return { serverCode: "SRV-…", panelUsername: "cus000123" }; // required for provision } // suspend / unsuspend / terminate: return nothing }); ``

- Return the server code and panel username for provision; billing records the hosting account from them. - Throwing leaves the task open for a person. - Billing marks the task done with the system actor and a note saying it was automatic.

Switching to `api`

Only when the executor is registered and tested against a non-production server. Until then, keep manual.

Markdown source
# Hosting panel modes

Kiwi Host bills clients and tracks server work. Server work (creating a hosting
account, suspending, unsuspending, deleting) is done on the hosting server.

## Modes

Set `HOSTING_PANEL_MODE` in `.env`.

| Mode | What happens |
|---|---|
| `manual` (default) | Billing only. Each server change becomes a **server task**. Staff do it by hand in the control panel, then click **Mark done** in admin. Portal server pages (Website, Server, Domains, Email, Databases, FTP, SSL, Backups) are hidden. |
| `api` | Server pages are shown. Tasks run automatically through a registered executor. If the executor fails, the task stays open with a "do it by hand" note. |

Optional: `HOSTING_PANEL_URL` adds a control-panel link on the portal dashboard.
`OPS_EMAIL` receives an email for each new task.

## Server task kinds

| Kind | Raised when | Staff action |
|---|---|---|
| `provision` | First invoice paid and email verified | Create the account, add the domain, turn on SSL. Enter the server code and Hestia username in admin. |
| `suspend` | Invoice still unpaid 14 days after due | Suspend the user in the panel. |
| `unsuspend` | Overdue invoice paid while suspended | Unsuspend the user. |
| `terminate` | Still unpaid 51 days after due | Take a final backup, then delete the user. |

A pending suspend and an unsuspend cancel each other, so only the needed one stays open.

## Executor contract (for the Hestia API work)

Billing does not know about Hestia. To automate, register one function at worker start-up:

```ts
registerServerTaskExecutor(async (kind, task) => {
  // kind: "provision" | "suspend" | "unsuspend" | "terminate"
  // task.subscriptionId, task.details (customerCode, domain, package, username, server, …)
  if (kind === "provision") {
    return { serverCode: "SRV-…", panelUsername: "cus000123" }; // required for provision
  }
  // suspend / unsuspend / terminate: return nothing
});
```

- Return the server code and panel username for `provision`; billing records the hosting account from them.
- Throwing leaves the task open for a person.
- Billing marks the task done with the system actor and a note saying it was automatic.

## Switching to `api`

Only when the executor is registered and tested against a non-production server.
Until then, keep `manual`.