Skip to content
# Hosting

Hosting & databases

Web hosting apps, environment variables and managed databases.

GET+POST/hosting

List your web hosting apps. Apps are created from the console (GitHub repository or container image); POST /hosting answers 501 not_implemented until API creation is added. GET /hosting/{id} returns full details, DELETE /hosting/{id} terminates (bills the final partial hour). POST /hosting/{id}/action starts/stops/restarts, POST /hosting/{id}/deploy rolls out the newest image, POST /hosting/{id}/star toggles starred, GET /hosting/{id}/logs?lines=200 tails logs.

GET response 200
json
[
  {
    "id": "3f0c...-...-...-...",
    "name": "my-app",
    "status": "running:healthy",
    "domains": ["https://my-app.example.com"],
    "dockerImage": "ghcr.io/me/my-app",
    "dockerTag": "latest",
    "costMonthly": 5.0,
    "resourceTier": "small",
    "starred": false,
    "createdAt": "2026-07-01T10:00:00Z",
    "backend": "k8s"
  }
]
POST → 501
json
{
  "error": "not_implemented",
  "status": 501,
  "statusText": "Not Implemented",
  "message": "Creating hosting apps through the API is not available yet. Create apps from the console."
}

A second deploy within a few seconds → 409 deploy_in_progress.

GET+POST/hosting/{id}/env

List (values redacted) or set an app's environment variables; changes apply on the next deploy. POST /hosting/{id}/env/{key}/reveal returns the value; DELETE /hosting/{id}/env/{key} removes it. Keys must be a valid env var name (letters, digits, underscore).

POST body → 201
json
{
  "key": "DATABASE_URL",
  "value": "postgres://..."
}
POST .../reveal → 200
json
{ "value": "postgres://..." }
GET+POST/databases

List your managed databases or order one (PostgreSQL). Ordering is open only for the engines Bashrack has enabled; otherwise POST answers 501 not_implemented with a message. Storage starts at 5 GB and cannot change after creation. The first hour is charged on creation, then hourly from your wallet. Daily backups kept 7 days are included.

POST body → 201 { id }
json
{
  "dbType": "postgresql",
  "name": "orders",
  "storageGb": 10,
  "resourceTier": "small"
}
GET /databases/{id} → 200
json
{
  "id": "9a1e...-...-...-...",
  "name": "orders",
  "dbType": "postgresql",
  "engineVersion": "18",
  "status": "running:healthy",
  "providerAvailable": true,
  "costMonthly": 6.5,
  "resourceTier": "small",
  "storageGb": 10,
  "publicAccess": false,
  "backupRetentionDays": 7,
  "endpoint": {
    "privateHost": "pg-9a1e2b3c4d5e-rw.customer-dbs",
    "publicHost": null,
    "port": 5432,
    "database": "app",
    "username": "app",
    "sslMode": "require"
  }
}
POST+PATCH/databases/{id}/…

Managers only (organization read-only and billing members get 404). POST /action {action: start|stop|restart} — starting a database suspended for non-payment needs a wallet that can pay (402 otherwise). PATCH /databases/{id} {resourceTier} changes CPU/RAM and the price from now on; storageGb changes answer 409 feature_unavailable. POST /public-access {enabled} adds or removes the TLS-only public endpoint (clients need PostgreSQL 17+ libpq with sslnegotiation=direct). POST /credentials returns the connection URLs with the password (audited, not cached). GET /logs?lines= returns recent database log lines (managers only: they can contain query text and data). DELETE /databases/{id} terminates and deletes the database.

POST /databases/{id}/credentials → 200
json
{
  "privateUrl": "postgresql://app:•••@pg-9a1e2b3c4d5e-rw.customer-dbs:5432/app?sslmode=require",
  "publicUrl": "postgresql://app:•••@pg-9a1e2b3c4d5e.db.bashrack.net:5432/app?sslmode=require&sslnegotiation=direct",
  "port": 5432,
  "database": "app",
  "username": "app"
}
GET+POST/databases/{id}/backups

GET lists the last backups (scheduled daily and on-demand). POST starts a backup now (202, managers only, 3 per hour per user and 5 per database per day). POST /databases/{id}/restore {name, targetTime?} restores into a NEW database at a point in time between the end of the oldest completed backup in the retention window and now (201 {id}; 400 outside that range); it is a separate order billed like any other, and the source keeps running.

GET → 200
json
{
  "retentionDays": 7,
  "archiving": "healthy",
  "restoreWindow": { "from": "2026-10-22T03:01:12.000Z", "to": "2026-10-23T09:30:00.000Z" },
  "backups": [
    {
      "id": "pg-9a1e2b3c4d5e-daily-20261022030000",
      "status": "completed",
      "kind": "scheduled",
      "startedAt": "2026-10-22T03:00:00.000Z",
      "finishedAt": "2026-10-22T03:01:12.000Z"
    }
  ]
}