LOCALHOST
All pages
API reference

DNS

The zones we hold for your names, and their records.

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 Zones

dns:read

GET /dns/zones

Responses

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

List Records

dns:read

GET /dns/zones/{name}/records

Parameters

NameTypeNotes
name * in path string

Responses

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

Create Record

dns:write

POST /dns/zones/{name}/records

Parameters

NameTypeNotes
name * in path string

Request body RecordIn

NameTypeNotes
name string default @
type * string
content * string
ttl integer default 300
priority integer | null

Responses

  • 201 RecordOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X POST "$API/dns/zones/<name>/records" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "<type>",
    "content": "<content>"
  }'
#

Delete Record By Query

dns:write

DELETE /dns/zones/{name}/records

DELETE /dns/zones/{name}/records?id=123

Parameters

NameTypeNotes
name * in path string
id * query integer

Responses

  • 200 OK
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X DELETE "$API/dns/zones/<name>/records?id=<id>" \
  -H "Authorization: Bearer $LH_API_KEY"
#

Update Record

dns:write

PUT /dns/zones/{name}/records/{record_id}

Change one record in place (its name, type, content, TTL or priority). Records we keep for email or a website
(managed_by set) can't be changed here.

Parameters

NameTypeNotes
name * in path string
record_id * in path integer

Request body RecordIn

NameTypeNotes
name string default @
type * string
content * string
ttl integer default 300
priority integer | null

Responses

  • 200 RecordOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X PUT "$API/dns/zones/<name>/records/<record_id>" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "<type>",
    "content": "<content>"
  }'
#

Delete Record

dns:write

DELETE /dns/zones/{name}/records/{record_id}

Parameters

NameTypeNotes
name * in path string
record_id * in path integer

Responses

  • 200 OK
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X DELETE "$API/dns/zones/<name>/records/<record_id>" \
  -H "Authorization: Bearer $LH_API_KEY"

Shapes

The objects these endpoints send and receive.

RecordIn

NameTypeNotes
name string default @
type * string
content * string
ttl integer default 300
priority integer | null

RecordOut

NameTypeNotes
id * integer
name * string
type * string
content * string
ttl * integer
priority * integer | null
managed_by * string
editable * boolean

ZoneOut

NameTypeNotes
name * string
serial * integer
records * integer
synced * boolean