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.
GET /builds/
Parameters
Name Type Notes
site * query
string
limit query
integer
default 20
Responses
200 list[BuildOut ]
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/builds/?site=<site>" \
-H "Authorization: Bearer $LH_API_KEY"
#
Create Build
sites:write
POST /builds/
Request body BuildIn
Name Type Notes
site *
string
ref
string
default ""
tag
string
default ""
Responses
200 BuildOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/builds/" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"site": "<site>"
}'
#
List Previews
sites:read
GET /builds/previews
Parameters
Name Type Notes
site * query
string
Responses
200 list[PreviewOut ]
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/builds/previews?site=<site>" \
-H "Authorization: Bearer $LH_API_KEY"
POST /builds/scan
What `lh init` sends: a folder's file names and its build files. Runs the same read-only scan a build does (nothing in it is executed) and answers with the plan and an lh.toml that writes it down.
Request body ScanIn
Name Type Notes
files *
object of string
Responses
200 ScanOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/builds/scan" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"files": {}
}'
#
Create Git Site
sites:write
POST /builds/sites
Create a site that deploys from a repository; returns its first build.
Request body GitSiteIn
Name Type Notes
slug *
string
repo *
string
name
string
default ""
size
string
default S
branch
string
default main
root_dir
string
default ""
dockerfile_path
string
default ""
access_token
string
default ""
Responses
200 BuildOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/builds/sites" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "<slug>",
"repo": "<repo>"
}'
GET /builds/{build_id}
The build with its log from character `since`; pass log_next back to follow it.
Parameters
Name Type Notes
build_id * in path
uuid
since query
integer
default 0
Responses
200 BuildLogOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/builds/<build_id>" \
-H "Authorization: Bearer $LH_API_KEY"
GET /builds/sources/{slug}
Parameters
Name Type Notes
slug * in path
string
Responses
200 SourceOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/builds/sources/<slug>" \
-H "Authorization: Bearer $LH_API_KEY"
PUT /builds/sources/{slug}
Connect (or change) the site's repository. Connecting for the first time starts a build.
Parameters
Name Type Notes
slug * in path
string
Request body SourceIn
Name Type Notes
repo *
string
branch
string
default main
root_dir
string
default ""
dockerfile_path
string
default ""
access_token
string
default ""
auto_deploy
boolean
default true
trigger
string
default branch
tag_pattern
string
default v*
previews
boolean | null
Responses
200 SourceOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X PUT "$API/builds/sources/<slug>" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"repo": "<repo>"
}'
#
Delete Source
sites:write
DELETE /builds/sources/{slug}
Parameters
Name Type Notes
slug * in path
string
Responses
200 OK
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X DELETE "$API/builds/sources/<slug>" \
-H "Authorization: Bearer $LH_API_KEY"
#
Cancel Build
sites:write
POST /builds/{build_id}/cancel
Parameters
Name Type Notes
build_id * in path
uuid
Responses
200 BuildOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/builds/<build_id>/cancel" \
-H "Authorization: Bearer $LH_API_KEY"
POST /builds/{build_id}/rollback
Put this build's version back live; returns the new rollback build.
Parameters
Name Type Notes
build_id * in path
uuid
Responses
200 BuildOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/builds/<build_id>/rollback" \
-H "Authorization: Bearer $LH_API_KEY"
Shapes
The objects these endpoints send and receive.
BuildIn
Name Type Notes
site *
string
ref
string
default ""
tag
string
default ""
BuildLogOut
Name Type Notes
id *
string
site *
string
number *
integer
status *
string
ref *
string
branch *
string
sha *
string
commit_message *
string
triggered_by *
string
image *
string
error *
string
created_at *
string
finished_at *
string | null
rollback_of
integer | null
tag
string
default ""
pr_number
integer | null
findings
list[object]
default []
log *
string
log_next *
integer
plan
object | null
BuildOut
Name Type Notes
id *
string
site *
string
number *
integer
status *
string
ref *
string
branch *
string
sha *
string
commit_message *
string
triggered_by *
string
image *
string
error *
string
created_at *
string
finished_at *
string | null
rollback_of
integer | null
tag
string
default ""
pr_number
integer | null
findings
list[object]
default []
GitSiteIn
Name Type Notes
slug *
string
repo *
string
name
string
default ""
size
string
default S
branch
string
default main
root_dir
string
default ""
dockerfile_path
string
default ""
access_token
string
default ""
PreviewOut
Name Type Notes
site *
string
pr_number *
integer
branch *
string
title *
string
url *
string
status
string | null
ScanIn
Name Type Notes
files *
object of string
ScanOut
Name Type Notes
plan *
object
toml *
string
problems
list[object]
default []
SourceIn
Name Type Notes
repo *
string
branch
string
default main
root_dir
string
default ""
dockerfile_path
string
default ""
access_token
string
default ""
auto_deploy
boolean
default true
trigger
string
default branch
tag_pattern
string
default v*
previews
boolean | null
SourceOut
Name Type Notes
site *
string
provider *
string
repo_url *
string
branch *
string
root_dir *
string
dockerfile_path *
string
auto_deploy *
boolean
trigger *
string
tag_pattern *
string
previews *
boolean
webhook_url *
string