CANNALIB API · GET ONLY · DOCUMENTED
Read the catalogue by machine. Nothing to write, nothing to sign up for.
Base https://api.cannalib.org. GET, HEAD and OPTIONS only; POST returns 405. There are no write endpoints. The catalogue is public; metrics take a key. Calls without a key get an hourly allowance, reported in X-RateLimit-Remaining; the family tree file needs a website pass or a key.
● 0.7.0-stdlib · 143,612 strains served
● hourly allowance without a key · CORS *
ENDPOINTS
Seven routes. Each one says what it counts.
GET /health
Liveness. Returns status, version, auth mode, db_exists, media_root_exists, trust_proxy.
curl -sS https://api.cannalib.org/health
GET /v1/corpus
Counts precomputed at each publish: served_strains, catalogue_strains, lab_tested_products, facts_evidence_served, lineage_edges_served, awards_served, competition_results, sources and more. If counts_source is not meta.corpus_counts, do not show the numbers.
curl -sS https://api.cannalib.org/v1/corpus
GET /v1/catalogs/strains?q=&limit=
Full-corpus typeahead. q up to 120 characters, limit up to 50. Matches name, normalised name and aliases, then hydrates a slim card.
curl -sS "https://api.cannalib.org/v1/catalogs/strains?q=og%20kush&limit=2"
GET /v1/catalogs/strains/{id}
The full record (schema strain_tree_v1). {id} is the exact normalised name, alias or strain slug, not a search. Every THC, CBD, flowering and height claim with its sources; lab range from three or more flower tests; parents with sources and a family-tree diagram; competition results and checked award claims; pictures with credit. 404 if missing; ledgered names redirect or 404.
curl -sS "https://api.cannalib.org/v1/catalogs/strains/blue%20dream"
GET /v1/catalogs/{nutrients|mediums|lights}
Product search. Returns id, name, brand. 867 nutrients, 321 mediums, 696 lights.
GET /v1/lineage/graph.json
The prebuilt family tree the lineage map draws: 57,015 strains, 118,186 links, layout precomputed. Cached a day, gzip sibling served as-is. Needs a website pass (the lineage page gets one for you) or a key.
curl -sSI https://api.cannalib.org/v1/lineage/graph.json
GET /v1/catalogs/media?kind=
Licensed reference images by kind. Comparative and pathology images are reference material, not cultivar portraits.
GET /media/...
Sandboxed WEBP, PNG and JPEG from the media root. No directory listing.
GET /v1/metrics
Traffic and corpus snapshot. Key required. Used by Home Assistant sensors. The catalogue itself stays public.
RESULT SHAPE
Slim card, then the tree
List (?q=): id, name, name_norm, type, breeder, curated, has_chemistry, thc_range, thc_basis, cbd_range, cbd_basis, top_terpenes, height_cm, height_band, flowering_days, want, matched_via. No branches.
Record ({id}): schema strain_tree_v1, evidence with chemistry and grow spans plus samples, branches.photoperiod and branches.autoflower with combined, subtypes and breeders. Missing science is null or an empty array. Conflicting chemistry keeps its rows; there is no unlabelled average.
LIMITS, STATED
What it will not do
No bulk dump. No write endpoints. No find-by-path filter yet; the explorer has no fake filter box for it. Callers without a key get an hourly allowance (X-RateLimit-Remaining says what is left); the public search shows ten results and no next page, on purpose, so every look is a deliberate request. The corpus endpoint is edge-cached briefly; the version in X-Cannalib-Version is the truth.
