API¶
All endpoints live under /api/v1/. Writes and owner-scoped reads require Authorization: Bearer <token>. The token is FAIR_DEV_TOKEN when AUTH_PROVIDER=dev, or a Hanko-issued JWT when AUTH_PROVIDER=hanko. GET on datasets, local-models, and predictions is open anonymously for rows with visibility="public". Anonymous callers get 404 on private rows.
The running backend's OpenAPI schema covers every endpoint, including base models, categories, feedback, stars and user state. Release QA uses these endpoints in run order.
| Path | Format |
|---|---|
/api/docs/ |
Swagger UI, with a request body for each write endpoint |
/api/redoc/ |
ReDoc |
/api/schema/ |
Raw OpenAPI |
Core flow endpoints¶
| Method | Path | Purpose |
|---|---|---|
| GET | /health/ |
Dependency reachability report |
| POST | /aois/ |
Create an AOI polygon (GeoJSON Feature) |
| GET | /aois/ |
List AOIs (bbox-filterable) |
| POST | /datasets/build/ |
Enqueue a dataset build job. title, description, category, aoi_ids, imagery (TMS template per model input name, such as {"image": ...} or {"post": ..., "pre": ...}) or source_imagery (one template, read as image), zoom, label_tasks, keywords (training needs one the base model's keywords also has), label_type, geometry_type, imagery_quality (WebP quality of imagery_pmtiles: high by default, medium or lossless). Labels come from osm_tags ({"building": ["*"]}), a labels_file upload (multipart, list and object fields as JSON) or a public https labels_url: GeoJSON up to 50 MiB or GeoParquet 1.0 to 2.0 up to 100 MiB, any declared CRS, class in class_property (default class; it can't be geometry or bbox). Labels touching an AOI are kept whole. A label file the build can't use fails it with the reason in error. The item gets labels_parquet, tiles_parquet (one row per chip), labels_pmtiles and, when an input's chips are 8-bit RGB web-mercator tiles at one zoom, one chip per tile, imagery_pmtiles (imagery_pmtiles_<input> with several inputs) |
| GET | /datasets/{id}/?expand=stac |
Inspect dataset, with STAC metadata + presigned labels and per-input chips ({input name: url}) URLs once status=built |
| POST | /datasets/{id}/{publish,unpublish}/ |
Toggle dataset visibility (anonymous read) |
| DELETE | /datasets/{id}/ |
Delete a dataset and its STAC versions (owner or admin); 409 while it is building or training runs use it |
| GET | /local-models/ |
Local models with a STAC version; ?published=false lists the caller's own drafts (no STAC version yet), ?published=all both. Filter by status, visibility, category, base_model, is_pinned, user; order by created_at, last_modified, star_count |
| POST | /local-models/{id}/{publish,unpublish}/ |
Toggle local-model visibility (owner or admin); publishing a draft without a STAC version returns 409 |
| POST | /trainings/submit/ |
Enqueue a finetune. base_model_stac_id, dataset_stac_id, model_name (slugified; 400 when the slug has no ASCII letters or digits, or matches a base model's name ignoring case), overrides (must match base-model's fair:hyperparameters_spec), class_map (optional, such as {"roof=iron": "metal_sheet"}, for classes the model doesn't match itself; 400 when a class stays unmatched or a key or value is unknown) |
| GET | /trainings/{id}/ |
Run state including zenml_run_id |
| GET | /trainings/runs/{run_id}/status/ |
Force-poll ZenML; refreshes the DB row |
| GET | /trainings/runs/{run_id}/logs/?tail=N&step=name |
Tail orchestrator or step logs |
| POST | /trainings/runs/{run_id}/cancel/ |
Stop a running pipeline |
| POST | /trainings/{id}/publish/ |
Promote a completed run to a versioned local-model. Validates against base-model spec; writes a new STAC item under local-models/. Returns local_model_stac_id |
| POST | /predictions/submit/ |
Enqueue inference. model_stac_id, imagery (TMS template or TileJSON URL per model input name, such as {"image": ...} or {"post": ..., "pre": ...}) or image_uri (one URL, read as the image input), bbox or a GeoJSON Polygon or MultiPolygon geometry (exactly one), zoom, params (keys must be the model's declared inference params; a str param without values must be empty or a public http(s) URL) |
| GET | /predictions/{id}/ |
Status + assets (presigned) once results_ready=true |
| GET | /predictions/{id}/result/ |
Presigned URLs for geojson, geoparquet and pmtiles, without pmtiles when feature_count is 0; 409 until results_ready |
| POST | /predictions/runs/{run_id}/cancel/ |
Stop a running inference pipeline |
| POST | /predictions/{id}/{publish,unpublish}/ |
Toggle prediction visibility (anonymous read of result) |
| POST | /prediction-runs/ |
Count one try-now run of the local or base model with that stac_id. Returns 204; 400 without stac_id; 404 when no model the caller can see has that id. Open to anonymous callers; throttled per user or IP by MODEL_RUN_RATE_LIMIT, in place of the user and anonymous limits. Local and base models return the count as prediction_runs (run_count on local models counts training runs) |
Validation endpoints¶
Users answer yes or no for each tile of a built dataset or a prediction with results_ready, signed in or as a guest. Guests' reads are throttled per IP by VALIDATION_READ_NETWORK_RATE_LIMIT, in place of ANON_RATE_LIMIT; signed-in reads fall under USER_RATE_LIMIT. Validation project responses include respondent_count, the number of distinct signed-in users and guest_id values that answered.
Project paths take the slug from any project response: up to 40 characters of the title in URL form and 8 random characters, set at creation and kept when the title changes. The numeric id doesn't work in these paths.
| Method | Path | Purpose |
|---|---|---|
| GET | /validation/projects/ |
Published and finished projects, plus the caller's drafts (all drafts for admins). Filter by type, status, and source_id, one dataset STAC id or prediction id (projects whose source_ids include it) |
| GET | /validation/projects/{slug}/ |
One project. Drafts are visible only to the owner and admins. A GET on a draft that has been building for longer than VALIDATION_BUILD_TIMEOUT seconds queues its build again |
| POST | /validation/projects/ |
Create a draft. Body: source_ids, type (training or prediction), title, description, answers_needed (1 to 9, default 1). For a training project, source_ids lists 1 to 5 distinct built dataset STAC ids on the same single imagery input and zoom; their tiles and labels are merged into one project. A training project may set class_map: each key is a property=value class from a source's STAC label:classes, and each value is the class shown on tiles, for example {"roof:material=metal_sheet": "metal"}. Classes left out keep their own value. Returns 400 for a key that none of the sources declare, and for a non-empty class_map on a prediction project. config takes one setting for the validation client, labelled_tiles_only: when true, the client shows only the tiles marked in labelled.bin; other keys return 400. For a prediction project, source_ids holds one prediction's numeric id with results_ready, one imagery input and at least one feature. The caller owns every source, or is an admin. Returns 202 and builds tiles.bin, imagery.pmtiles, labels.pmtiles and labelled.bin in the background; build_status moves from building to built, or to failed with the reason in build_error |
| PATCH | /validation/projects/{slug}/ |
Owner or admin. Edit title, description, answers_needed or config; a config change keeps the built files. Move status from draft to published (400 until build_status is built and every source is public) or from published to finished. 400 for a change to source_ids, type or class_map, and for any change once finished |
| POST | /validation/projects/{slug}/build/ |
Owner or admin. Build the files again. Returns 202 with build_status set to building; 400 unless the project is a draft |
| POST | /validation/projects/{slug}/answers/ |
answers, a list of 1 to 50 {"tile_id", "valid"} objects (tile_id is the PMTiles tile id), and guest_id (a UUID) when signed out; 400 without it. Returns 204; a respondent's new answer for a tile replaces their earlier one. 404 on a draft, 410 once finished. Answers for tiles outside tiles.bin are stored but left out of done.bin and results.parquet. Throttled per account by VALIDATION_ANSWER_RATE_LIMIT and for guests per IP by VALIDATION_ANSWER_NETWORK_RATE_LIMIT; USER_RATE_LIMIT and ANON_RATE_LIMIT do not apply |
| GET | /validation/projects/{slug}/files/{name}/ |
Redirect to a presigned URL for tiles.bin, imagery.pmtiles, labels.pmtiles, labelled.bin, done.bin or results.parquet. 404 for any other name; for labelled.bin on a project built without it (build a draft again to add it); for done.bin and results.parquet until the first refresh writes them; and for anyone but the owner and admins while any source is private. The other three files exist once build_status is built |
| File | Content |
|---|---|
tiles.bin |
The project's PMTiles tile ids in ascending order, each an 8-byte little-endian unsigned integer |
imagery.pmtiles |
WebP tiles at one zoom. Metadata holds zoom and the tile count tiles |
labels.pmtiles |
Labels or predicted features as vector tiles at the imagery zoom, layer labels |
labelled.bin |
Bit i (least significant bit first) is the i-th id in tiles.bin, set when a label or predicted feature overlaps that tile's interior |
done.bin |
Bit i (least significant bit first) is the i-th id in tiles.bin, set once that tile has at least answers_needed answers |
results.parquet |
One row per answered tile: tile_id, z, x, y, yes, no, valid (the majority; null below answers_needed answers or on a tie) and geometry, the tile polygon in EPSG:4326 |
A worker writes done.bin and results.parquet when a project is published, every VALIDATION_REFRESH_INTERVAL seconds while it stays published, and once more when it is finished.