Skip to content

API Reference

Saman Tabatabaeian edited this page Feb 17, 2026 · 1 revision

API Reference

AstroLens exposes a REST API via FastAPI. Start it with:

uvicorn api.main:app --port 8000

Interactive docs available at http://localhost:8000/docs (Swagger UI).

Health and Info

Endpoint Method Response
/health GET {"status":"ok","version":"1.1.0","ml_model_loaded":true}
/device GET {"device_type":"mps","device_name":"Apple M4"}
/stats GET {"total_images":10000,"anomalies":500,"analyzed":9500}

Images

Endpoint Method Parameters Description
/images GET skip, limit, anomaly_only List images
/images/{id} GET -- Image details
/images/{id}/file GET -- Serve image file
/images POST file (multipart) Upload image
/images/{id} PATCH class_label, ood_score, is_anomaly Update
/images/{id} DELETE -- Delete

Analysis

Endpoint Method Description
/analysis/classify/{id} POST ViT classification
/analysis/anomaly/{id} POST OOD detection
/analysis/similar/{id} POST Find similar images
/analysis/full/{id} POST Full pipeline (classify + anomaly + similar)

Candidates

Endpoint Method Parameters Description
/candidates GET skip, limit Anomalies sorted by OOD score

Cross-Reference

Endpoint Method Description
/crossref/{id} POST Cross-reference against SIMBAD/NED/VizieR
/crossref/summary GET Counts of known/unknown/verified
/crossref/batch POST Batch cross-reference all anomalies
/crossref/{id}/verify POST Mark true_positive/false_positive

Streaming State

Endpoint Method Description
/api/streaming-state GET Live streaming discovery status and metrics

Export

Format Extension Use Case
CSV .csv Spreadsheets, pandas, R
JSON .json Programmatic access
HTML .html Visual report
VOTable .vot Astronomical tools (TOPCAT, Aladin, DS9)

Clone this wiki locally