LOCALHOST
All pages
API reference

Connect

Tunnels and connectors that give machines of yours a public address.

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 Connectors

Full-access key

GET /connect/connectors

Responses

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

Create Connector

Full-access key

POST /connect/connectors

Request body ConnectorIn

NameTypeNotes
name * string

Responses

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

List Peers

Full-access key

GET /connect/peers

Responses

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

Create Peer

Full-access key

POST /connect/peers

Request body PeerIn

NameTypeNotes
name * string
kind string default dev

Responses

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

List Routes

Full-access key

GET /connect/routes

Responses

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

Add Connector Route

Full-access key

POST /connect/connectors/{name}/routes

Parameters

NameTypeNotes
name * in path string

Request body ConnectorRouteIn

NameTypeNotes
host * string
service * string

Responses

  • 200 ConnectorOut
  • 401 no key, or a key that was revoked
  • 403 the key lacks the permission
Example request
curl -X POST "$API/connect/connectors/<name>/routes" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "host": "<host>",
    "service": "<service>"
  }'

Shapes

The objects these endpoints send and receive.

ConnectorCreated

NameTypeNotes
id * integer
name * string
enabled * boolean
connected * boolean
routes * list[object]
token * string

ConnectorIn

NameTypeNotes
name * string

ConnectorOut

NameTypeNotes
id * integer
name * string
enabled * boolean
connected * boolean
routes * list[object]

ConnectorRouteIn

NameTypeNotes
host * string
service * string

PeerCreated

NameTypeNotes
id * integer
name * string
kind * string
address * string
public_key * string
enabled * boolean
state * string
connected * boolean
config * string

PeerIn

NameTypeNotes
name * string
kind string default dev

PeerOut

NameTypeNotes
id * integer
name * string
kind * string
address * string
public_key * string
enabled * boolean
state * string
connected * boolean

RouteOut

NameTypeNotes
id * integer
peer * string
host * string
port * integer
protocol * string
identity_gate * boolean
allowed_emails * list[string]
state * string