LOCALHOST
All pages
API reference

Databases

The managed databases on the account. Read-only here; credentials stay in the panel.

Every call needs Authorization: Bearer lh_… unless marked No key needed; the example uses $API for https://api.localhost.co.zw and $LH_API_KEY for your key. A * marks a required field.

#

List Databases

databases:read

GET /databases/

Responses

  • 200 list[DatabaseOut]
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X GET "$API/databases/" \
  -H "Authorization: Bearer $LH_API_KEY"
#

Create Database

databases:write

POST /databases/

A new database, as many as the plan includes; past that, one more at the extra database price a month with
`add_extra` (its first month from the wallet now). The connection details are in the panel, or become the named
site's DATABASE_URL.

Request body DatabaseIn

NameTypeNotes
name string default ""
engine string default postgres
site string default ""
add_extra boolean default false

Responses

  • 201 DatabaseOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X POST "$API/databases/" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "<name>",
    "engine": "postgres",
    "site": "<site>",
    "add_extra": false
  }'

Shapes

The objects these endpoints send and receive.

DatabaseIn

NameTypeNotes
name string default ""
engine string default postgres
site string default ""
add_extra boolean default false

DatabaseOut

NameTypeNotes
id * string
name * string
role * string
engine * string
host * string
port * integer
size_mb * number
status * string
site string | null