🤖 HTTP API Documentation
Laniakea provides a RESTful HTTP API that allows you to interact with the service programmatically. This documentation describes the available endpoints, request formats, and example responses.
Base URL​
Throughout this documentation, we'll use demo.laniakea.dev
as the example domain. Replace this with your actual Looking Glass domain when making requests.
API Endpoints​
1. Get Available Devices and Commands​
Retrieves information about available devices and supported commands.
Request
GET /laniakea?q=hello
Example
curl https://demo.laniakea.dev/laniakea?q=hello
Response
The server responds with a JSON object containing the Looking Glass configuration, available devices, and supported commands.
2. Execute a Command​
Initiates a command execution on a specified device.
Request
GET /laniakea?q=makeRequest&device_id={device_id}&command_id={command_id}&input={input}
Parameters:
device_id
: ID of the target devicecommand_id
: ID of the command to executeinput
: Command input (e.g., IP address, domain name)
Example
curl https://demo.laniakea.dev/laniakea?q=makeRequest&device_id=1&command_id=1&input=1.1.1.1
Response
{
"status": "success",
"data": {
"id": "30",
"cache": false
}
}
3. Retrieve Command Results​
Fetches the results of a previously executed command.
Request
GET /laniakea?q=getRequest&request_id={request_id}
Parameters:
request_id
: ID of the request to retrieve
Example
curl https://demo.laniakea.dev/laniakea?q=getRequest&request_id=30
Response
{
"status": "success",
"data": {
"id": 30,
"device_id": 1,
"command_id": 1,
"input": "1.1.1.1",
"status": "success",
"result": "PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.\n64 bytes from 1.1.1.1: icmp_seq=1 ttl=57 time=37.0 ms\n64 bytes from 1.1.1.1: icmp_seq=2 ttl=57 time=35.0 ms\n64 bytes from 1.1.1.1: icmp_seq=3 ttl=57 time=32.4 ms\n64 bytes from 1.1.1.1: icmp_seq=4 ttl=57 time=39.4 ms\n64 bytes from 1.1.1.1: icmp_seq=5 ttl=57 time=32.5 ms\n\n--- 1.1.1.1 ping statistics ---\n5 packets transmitted, 5 received, 0% packet loss, time 4006ms\nrtt min/avg/max/mdev = 32.352/35.269/39.426/2.691 ms\n",
"log": "Initializing connection to swe-2\nConnecting to swe-2\nConnection established successfully\nExecuting request...\nCommand finished successfully.\n",
"constructed_command": "ping 1.1.1.1 -c 5",
"time": 1737390004
}
}
Error Handling​
The API uses standard HTTP status codes and includes detailed error messages in the response body when appropriate. All responses follow the format:
{
"status": "success|error",
"data": { ... }
}
In case of an error, additional error details will be provided in the response body.