Machine-readable API
PiFinder exposes a set of optional JSON and image endpoints under /api/ for
automation and external tools. They are registered on the same web server that
serves the PiFinder web interface, and by default they require no
authentication, so any client on the same network can call them.
Everything is served relative to the PiFinder’s address, for example
http://pifinder.local/api/status. JSON endpoints return
application/json; image endpoints return image/png. When the data a call
needs isn’t ready yet — no GPS lock, no plate solve, no IMU or SQM reading — that
endpoint returns HTTP 503 with a short JSON note explaining why, rather
than failing outright.
Status and data
These endpoints return JSON. /api/status is the convenient one-shot call; the
rest let you fetch a single value on demand.
- GET /api/status
Aggregated snapshot, fetching everything in one call:
power_state,solve_state,camera_type,location,solution,datetime(bothutcandlocal),imu,sqmandsoftware_version.- GET /api/time
The current
utcandlocaltime plus the activetimezone.- GET /api/location
The current GPS location (latitude, longitude, altitude, timezone and lock state). The GPS cache is refreshed before responding, and the call returns
503if GPS is not locked.- GET /api/solution
The current plate-solve solution — RA, Dec, Roll, field of view and the matched-star statistics.
AltandAzare added when a location and time are available. Returns503if there is no valid solve yet.- GET /api/imu
The current IMU data (orientation and movement state). Returns
503when no IMU is present or no reading is available.- GET /api/sqm
The latest Sky Quality Meter estimate of sky brightness. Returns
503when no reading is available.- GET /api/visible_stars
Re-renders the star field for the current pointing and returns the visible stars as structured data, optionally with the rendered chart as a base64 PNG. It uses the camera solve (RA / Dec / Roll) so the result isn’t shifted by IMU dead-reckoning.
The response carries the solve
sourceand pointing, thefiltersthat were applied, acountandlabel_count, and avisible_starsarray. Each star includes its catalog fields, adisplay_name, and alabelflag (withlabel_reason) marking the stars suggested for on-screen labelling. Rendered star positions are returned in the coordinate system set byrender_size.
Query parameters for /api/visible_stars:
render_mag_limitMagnitude limit for the stars returned for rendering. Default:
5.5. The legacy namemag_limitis still accepted.label_mag_limitMagnitude limit for the stars suggested for labelling. Default:
2.5.max_labelsMaximum number of suggested labels, clamped to 0–30. Default:
5. If too few stars fall withinlabel_mag_limit, the brightest stars in the field are added to reach this count.use_camera_solvePrefer the camera solve over the integrated, IMU-corrected solution. Default:
true.fovRendering field of view in degrees. Default: the solve’s FOV, or
10.2.render_sizeOutput resolution in pixels, clamped to 128–4096. Star positions are returned in this coordinate system. Default:
1088.constellation_brightnessBrightness of the constellation lines (0–255). Default:
32.shade_frustrumWhether to shade the camera frustum. Default:
true.include_imageInclude the rendered star chart in the response as a base64-encoded PNG. Default:
false.
Images
These endpoints return a PNG directly, which makes them easy to embed in a browser or save to a file.
- GET /api/screen
The current 128×128 device screen as a PNG — the same image shown on the OLED.
- GET /api/camera/raw
The raw CMOS camera image as a PNG, when one is available; otherwise
503.- GET /api/camera/debug
The most recent solver debug frame from the debug-dump directory, as a PNG;
503if none have been written.
Control
These endpoints accept a POST with a JSON body and change the state of the PiFinder, so use them with care.
- POST /api/key
Simulate a keypad press. JSON body:
{"button": "UP"}(a button name) or{"button": 1}(a raw key code).- POST /api/stop
Cleanly shut down the entire PiFinder application, reproducing a terminal Ctrl-C. Optional JSON body
{"delay": <seconds>}(default0.5, capped at5) sets how long to wait before signalling, so the HTTP response can flush first.
Example
# One-shot status, then individual values
curl http://pifinder.local/api/status
curl http://pifinder.local/api/solution
curl http://pifinder.local/api/sqm
# Visible stars, with the rendered chart embedded as a base64 PNG
curl "http://pifinder.local/api/visible_stars?render_mag_limit=5.5&include_image=true"
# Save the current screen to a file
curl http://pifinder.local/api/screen -o screen.png
# Simulate pressing the UP button
curl -X POST http://pifinder.local/api/key \
-H "Content-Type: application/json" \
-d '{"button": "UP"}'