LOCALHOST
All pages
API reference

Sites and apps

Containers that run on your account: create, deploy an image, start, stop, read logs.

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 Sites

sites:read

GET /sites/

Responses

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

Create Site

sites:write

POST /sites/

Request body SiteIn

NameTypeNotes
slug * string
image * string
name string default ""
port integer default 80
size string default S
env object of string default {}

Responses

  • 200 SiteOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X POST "$API/sites/" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "<slug>",
    "image": "<image>"
  }'
#

Get Site

sites:read

GET /sites/{slug}

Parameters

NameTypeNotes
slug * in path string

Responses

  • 200 SiteOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X GET "$API/sites/<slug>" \
  -H "Authorization: Bearer $LH_API_KEY"
#

Deploy

sites:write

POST /sites/{slug}/deploy

Parameters

NameTypeNotes
slug * in path string
image * query string

Responses

  • 200 SiteOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X POST "$API/sites/<slug>/deploy?image=<image>" \
  -H "Authorization: Bearer $LH_API_KEY"
#

Site Logs

sites:read

GET /sites/{slug}/logs

Parameters

NameTypeNotes
slug * in path string
tail query integer default 100

Responses

  • 200 LogsOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X GET "$API/sites/<slug>/logs" \
  -H "Authorization: Bearer $LH_API_KEY"
#

Action

sites:write

POST /sites/{slug}/{action}

Parameters

NameTypeNotes
slug * in path string
action * in path string

Responses

  • 200 SiteOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X POST "$API/sites/<slug>/<action>" \
  -H "Authorization: Bearer $LH_API_KEY"

Shapes

The objects these endpoints send and receive.

LogsOut

NameTypeNotes
slug * string
lines * list[string]

SiteIn

NameTypeNotes
slug * string
image * string
name string default ""
port integer default 80
size string default S
env object of string default {}

SiteOut

NameTypeNotes
id * string
slug * string
name * string
image * string
port * integer
size * string
desired_state * string
observed_state * string
url * string
hostnames * list[string]
last_error * string