LOCALHOST
All pages
API reference

Settings

Environment variables for one site, or shared by every site. Secret values are never returned.

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 Vars

sites:read

GET /variables/

Responses

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

Put Var

sites:write

PUT /variables/{key}

Parameters

NameTypeNotes
key * in path string

Request body VarIn

NameTypeNotes
value string | null
secret boolean | null
build_time boolean | null
production_only boolean | null
only_sites list[string] | null
note string | null

Responses

  • 200 VarOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X PUT "$API/variables/<key>" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "<value>",
    "secret": true,
    "build_time": true,
    "production_only": true,
    "only_sites": [
      "<only_sites>"
    ],
    "note": "<note>"
  }'
#

Delete Var

sites:write

DELETE /variables/{key}

Parameters

NameTypeNotes
key * in path string

Responses

  • 204 No Content
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X DELETE "$API/variables/<key>" \
  -H "Authorization: Bearer $LH_API_KEY"
#

List Env

sites:read

GET /sites/{slug}/env

Everything the site's app gets, with where each value comes from. Secrets are masked.

Parameters

NameTypeNotes
slug * in path string

Responses

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

Put Env

sites:write

PUT /sites/{slug}/env/{key}

Add or change one of the site's own settings. The site restarts with it without going offline.

Parameters

NameTypeNotes
slug * in path string
key * in path string

Request body VarIn

NameTypeNotes
value string | null
secret boolean | null
build_time boolean | null
production_only boolean | null
only_sites list[string] | null
note string | null

Responses

  • 200 VarOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X PUT "$API/sites/<slug>/env/<key>" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "<value>",
    "secret": true,
    "build_time": true,
    "production_only": true,
    "only_sites": [
      "<only_sites>"
    ],
    "note": "<note>"
  }'
#

Delete Env

sites:write

DELETE /sites/{slug}/env/{key}

Parameters

NameTypeNotes
slug * in path string
key * in path string

Responses

  • 204 No Content
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X DELETE "$API/sites/<slug>/env/<key>" \
  -H "Authorization: Bearer $LH_API_KEY"

Shapes

The objects these endpoints send and receive.

VarIn

NameTypeNotes
value string | null
secret boolean | null
build_time boolean | null
production_only boolean | null
only_sites list[string] | null
note string | null

VarOut

NameTypeNotes
key * string
value * string
secret * boolean
source * string
build_time boolean default false
production_only boolean default false
only_sites list[string] default []
overrides string default ""