Skip to main content

Endpoint

GET /businesses Returns an HTML page listing businesses with support for filtering, sorting, and pagination. When called with the HX-Request header, returns only the business table rows partial for HTMX-driven updates.

Query parameters

name
string
Filter by partial business name match. Case-insensitive.
industry
string
Filter by partial industry match. Case-insensitive.
country
string
Filter by partial country match. Case-insensitive.
date_from
string
ISO date string. Returns businesses created on or after this date (e.g., 2024-01-01).
date_to
string
ISO date string. Returns businesses created on or before this date, inclusive through end of day (e.g., 2024-12-31).
sort
string
Column to sort by. Accepted values: name, industry, country, created_at, risk_score. Sorting by risk_score uses the most recent evaluation for each business. Defaults to created_at.
order
string
Sort direction. Accepted values: asc, desc. Defaults to desc.
page
integer
Page number for pagination. Defaults to 1. Each page returns up to 15 results. Values below 1 are clamped to 1; values beyond the last page are clamped to the last page.

Response

Returns an HTML page. When the HX-Request header is present, returns only the partials/business_rows.html fragment containing the business table rows, pagination info, and totals.
When making requests via HTMX (i.e., requests that include the HX-Request: true header), the server returns a partial HTML fragment instead of the full page. This allows the UI to swap in updated table rows without a full page reload. Direct browser navigation always returns the full page.

Examples

# List all businesses
curl http://localhost:8000/businesses

# Filter by country and sort by risk score
curl "http://localhost:8000/businesses?country=usa&sort=risk_score&order=desc"

# Filter by date range
curl "http://localhost:8000/businesses?date_from=2024-01-01&date_to=2024-12-31"

Build docs developers (and LLMs) love