Base Path
/api/library/v1
api docs
This API is for app developers, researchers, and health builders who need structured supplement and intervention data they can trust. It helps you move from discovery to ranked evidence quickly with stable filtering, consistent pagination, and clear quota headers.
Base Path
/api/library/v1
Auth
Authorization: Bearer <token>
Response Type
application/json
Response Headers
The Unfair Library API gives product teams, researchers, and developers structured access to supplement and intervention data backed by graded evidence.
Use it to power supplement detail pages, rank interventions by outcome, or build discovery experiences on top of the full intervention-outcome graph.
Four core concepts drive everything in the API:
Most integrations follow the same path: browse or search supplements to target a health outcome, rank linked interventions by evidence quality, then inspect individual evidence links if you need custom scoring logic. You do not have to follow it in order, but it is the fastest way to get oriented.
Start here if you want to confirm auth, test one endpoint, and then build a real workflow.
Authorization header.limit and offset for stable pagination.Smoke Test
bashcurl -sS -H "Authorization: Bearer $UAF_TOKEN" "https://unfairapp.com/api/library/v1/meta"Research Graph Smoke Test
bashcurl -sS -H "Authorization: Bearer $UAF_TOKEN" "https://unfairapp.com/api/library/v1/health-outcomes?category=disease&limit=3"Every response includes x-library-version, x-contract-version, and x-snapshot-id. Treat them as separate signals: freshness, schema contract, and immutable snapshot identity.
2026-03-18T01:53:00.432Z.1.0.0.snapshot.a4154a2908a032ac407e.2026-03-18T01:39:01Z.2026-03-18T01:53:00.432Z.Use /api/library/v1/snapshots and /api/library/v1/diffs when you need auditable changes between snapshots.
Use this table when integrations fail. Each error includes cause, immediate fix, and whether automatic retry makes sense.
Error Payload
json{
"ok": false,
"code": "invalid_token",
"message": "Invalid API token"
}| Status | Code | Meaning | What to do | Recoverability |
|---|---|---|---|---|
| 401 | missing_token | No bearer token was provided | Send Authorization with Bearer token and retry. | Recoverable by client |
| 401 | invalid_token | Token hash does not match any active token | Regenerate the token in admin and update your env. | Recoverable after token update |
| 403 | token_inactive | Token exists but has been revoked | Reach out through the contact page to re-enable access. | Requires human action |
| 403 | capability_missing | Token is valid but missing required route capability | Update token capabilities in admin for the premium contract routes. | Requires token update |
| 404 | not_found | Requested resource id or slug does not exist | Check slug formatting and confirm id from list endpoints. | Recoverable by request correction |
| 429 | monthly_limit_exceeded | Token exhausted its monthly request quota | Pause requests until reset time or request a higher quota. | Time based or support based recovery |
Need help with credentials or quota updates? Reach out through our contact page.
Use this section as a map. Each endpoint description explains what it does and what to do with the result.
/api/library/v1/supplementsReturns a list of supplements. Filters apply before sorting, so results are ranked by evidence tier strength and then alphabetically.
q
Example: q=creatine. Use this to narrow results by keyword.
category
Example: category=amino-acid. Use this to scope to one category.
tier
Example: tier=B. Use this to keep only stronger evidence bands.
limit
Example: limit=25. Use this to control payload size per page.
offset
Example: offset=50. Use this to page forward through results.
Tip: If you apply a tier filter, the ranking still uses the same sort rule inside that tier.
/api/library/v1/supplements/{slug}Returns one supplement by slug. Unknown slugs return a 404. Double-check spelling because supplement slugs are lowercase and hyphenated.
include
Example: include=content. Embeds the full article markdown in the response.
/api/library/v1/supplements/{slug}/contentReturns the full article markdown for a supplement. Use this when you need the content separately from the structured data.
/api/library/v1/metaReturns library metadata and filter facets (categories and tiers), plus research graph metadata/facets for health outcomes and interventions.
Tip: Call this endpoint once during app start to prefill filters and cache metadata.
/api/library/v1/health-outcomesReturns paginated health outcomes with category/source filters and intervention linkage counts.
q
Example: q=sleep. Use this to find matching outcomes quickly.
category
Example: category=disease. Use this to constrain outcome class.
sourceType
Example: sourceType=healthOutcomeFile. Use this to target curated outcomes only.
hasInterventions
Example: hasInterventions=true. Use this to return actionable outcomes.
limit / offset
Example: limit=20&offset=0. Use this for stable pagination windows.
Gotcha: sourceType=interventionDerived means the outcome was inferred from intervention mappings, while healthOutcomeFile comes from curated outcome records.
/api/library/v1/health-outcomes/{id}Returns one health outcome by id. Missing ids return 404 with code: not_found.
/api/library/v1/health-outcomes/{id}/interventionsReturns interventions associated with a health outcome, ordered by combined evidence strength.
condition
Example: condition=Insomnia. Use this to target one condition context.
minGrade
Example: minGrade=B. Use this to exclude weaker evidence grades.
effect
Example: effect=decrease. Use this to align direction with your goal.
limit / offset
Example: limit=50&offset=0. Use this to paginate ranked interventions.
Tip: Use minGrade to narrow the response to better supported interventions.
/api/library/v1/interventionsReturns paginated interventions with condition and linked-outcome category filters.
q
Example: q=theanine. Use this to find interventions by name or context.
condition
Example: condition=Anxiety. Use this to focus on one target condition.
outcomeCategory
Example: outcomeCategory=behavior-and-context. Use this to narrow outcome type.
noStudyDatabase
Example: noStudyDatabase=false. Use this to keep evidence-backed entries.
limit / offset
Example: limit=20&offset=20. Use this for paginated browsing.
Tip: Use condition first, then add outcomeCategory for tighter targeting.
/api/library/v1/interventions/{id}Returns one intervention by id. Missing ids return 404 with code: not_found.
/api/library/v1/interventions/{id}/health-outcomesReturns health outcomes associated with an intervention, ordered by combined evidence strength.
category
Example: category=disease. Use this to focus linked outcomes by category.
condition
Example: condition=Insomnia. Use this to keep one condition thread.
minGrade
Example: minGrade=B. Use this to remove lower confidence links.
effect
Example: effect=increase. Use this for directional outcome analysis.
limit / offset
Example: limit=50&offset=0. Use this to page linked outcome sets.
Tip: Start with minGrade=B if you want a high confidence subset.
/api/library/v1/evidence-linksReturns individual evidence links between interventions and outcomes. Most integrations do not need this endpoint unless you are building custom ranking or graph logic.
q
Example: q=magnesium. Use this to locate relevant evidence links quickly.
outcomeID / interventionID
Example: interventionID=l-theanine. Use this for one-node graph slices.
condition / category
Example: condition=Insomnia. Use this to refine graph context.
grade / effect
Example: grade=B&effect=decrease. Use this for custom ranking inputs.
limit / offset
Example: limit=100&offset=0. Use this to stream large edge sets safely.
/api/library/v1/studiesReturns paginated studies with search, PubMed ID lookup, and effect estimate filtering. Each study includes structured metadata: design details (blinding, randomization, duration), population (sample size, age range, sex), publication info (journal, year, authors), conclusions, adverse events, and funding sources.
q
Example: q=creatine cognition. Full-text search across study titles and abstracts.
pmid
Example: pmid=12345678. Lookup by PubMed ID directly.
doi
Example: doi=10.1234/example. Lookup by DOI.
hasEffectEstimates
Example: hasEffectEstimates=true. Only return studies with quantitative effect data.
limit / offset
Example: limit=100&offset=0. Paginate through the study catalog.
/api/library/v1/studies/{studyID}Returns one study by id with full metadata and linked supplement associations. The response includes structured design, population, intervention, and publication objects along with author details, conclusions, adverse events, and funding.
design
type, blinding, control, durationDays, randomized
population
description, sampleSize, ageRange, sex
interventions
description, dose
publication
journal, year
authors
Array of name, affiliation, email
conclusions / adverseEvents / funding
Free-text fields extracted from the source paper.
/api/library/v1/studies/{studyID}/contentReturns the paper content markdown for a study. Use this for full-text rendering in research tools.
/api/library/v1/evidenceReturns structured evidence statements linking supplements to outcomes with predicate, population, and source metadata.
supplementID
Example: supplementID=creatine. Filter statements to one supplement.
predicateID
Example: predicateID=improves. Filter by relationship type.
objectID
Example: objectID=cognitive-performance. Filter by target outcome.
population
Example: population=elderly. Scope to a specific population context.
limit / offset
Example: limit=100&offset=0. Paginate evidence statements.
/api/library/v1/evidence/reverseReverse evidence query: given an outcome, find which supplements have evidence for it. Returns grouped statements with supplement IDs.
objectID
Example: objectID=cognitive-performance. The outcome to reverse-lookup.
predicateID
Example: predicateID=improves. Filter by relationship direction.
population
Example: population=athletes. Narrow to a population group.
Tip: Use this to power “what helps with X?” discovery experiences.
/api/library/v1/interactionsReturns supplement-drug and supplement-supplement interactions with target typing and external code references.
q
Example: q=warfarin. Search interactions by name or target.
targetType
Example: targetType=drug. Filter by interaction target category.
system / code
Example: system=rxnorm&code=11289. Lookup by external coding system.
limit / offset
Example: limit=100&offset=0. Paginate interaction results.
/api/library/v1/lookupCross-reference lookup. Maps external identifiers (PubChem, UNII, RxNorm) to Unfair entity IDs and back. Use this to bridge your existing data with the Unfair graph.
system
Example: system=pubchem. The external identifier system.
code
Example: code=586. The external code to resolve.
source / externalID
Example: source=unii&externalID=MU72812GK0. Alternative crosswalk lookup.
/api/library/v1/assertionsCanonical assertion ledger endpoint. Query claims, interactions, contraindications, regulatory facts, and intervention-outcome edges from one schema.
kind
Example: kind=claim. Filters assertion domain.
subjectType / subjectID
Example: subjectType=supplement&subjectID=creatine.
studyID
Example: studyID=pmid-12345678. Keeps only assertions linked to one study.
coverage
Example: coverage=text_only. Filters by machine-readable status.
Requires capability assertions.read.
/api/library/v1/assertions/{id}Returns one assertion by deterministic id for audit trails and deep links.
Requires capability assertions.read.
/api/library/v1/interaction-factsStructured interaction facts view over the assertion ledger with supplement, target typing, severity, and coverage fields.
supplementID
Example: supplementID=st-johns-wort. Filter to one supplement.
severity
Example: severity=major. Filter by interaction severity level.
targetType
Example: targetType=drug. Filter by what the supplement interacts with.
coding
Example: coding=complete. Filter by machine-readable coding status.
limit / offset
Example: limit=100&offset=0. Paginate interaction facts.
Requires capability interaction-facts.read.
/api/library/v1/identifiersIdentifier graph and crosswalk lookup across supplements, studies, outcomes, and interventions.
entityType
Example: entityType=supplement. Scope to one entity kind.
entityID
Example: entityID=creatine. Get all identifiers for a specific entity.
system / code
Example: system=pubchem&code=586. Find entities by external identifier.
limit / offset
Example: limit=100&offset=0. Paginate identifier records.
Requires capability identifiers.read.
/api/library/v1/coveragePer-entity coverage transparency for evidence linkage, coding completeness, and unresolved gaps.
entityType
Example: entityType=supplement. Scope coverage to one entity kind.
entityID
Example: entityID=ashwagandha. Check coverage for one entity.
gap
Example: gap=missing_evidence. Filter to entities with a specific gap type.
limit / offset
Example: limit=100&offset=0. Paginate coverage records.
Requires capability coverage.read.
/api/library/v1/snapshotsSnapshot manifests with contract version, artifact digests, and immutable snapshot identifiers.
limit / offset
Example: limit=20&offset=0. Paginate through snapshot history.
Requires capability snapshots.read.
/api/library/v1/diffsSnapshot diff feed. Compare two snapshots to see added, modified, and removed entities.
fromSnapshotID
Example: fromSnapshotID=snap-2026-02. Required. The baseline snapshot to diff from.
toSnapshotID
Example: toSnapshotID=snap-2026-03. Optional, defaults to current snapshot.
entityType
Example: entityType=supplement. Scope the diff to one entity kind.
limit / offset
Example: limit=100&offset=0. Paginate diff entries.
Requires capability diffs.read.
These are job based examples you can copy and adapt.
Outcome to Intervention Workflow
bash# 1) Find sleep-related outcomes
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/health-outcomes?q=sleep&limit=1"
# 2) Use the returned id to fetch linked interventions with stronger evidence
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/health-outcomes/OUTCOME_ID/interventions?minGrade=B&limit=20"
# 3) Inspect one intervention and validate evidence details
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/interventions/INTERVENTION_ID"Expected Output Shape
json{
"selectedOutcomeID": "sleep-latency",
"interventionCount": 12,
"topIntervention": "L-theanine",
"topGrade": "B"
}Supplement Detail Workflow
bash# 1) Get supplement candidates for focus
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/supplements?q=focus&tier=B&limit=10"
# 2) Open one supplement detail by slug
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/supplements/alpha-gpc"
# 3) Render dose, safety, and evidence fields in your UIExpected Output Shape
json{
"slug": "alpha-gpc",
"dose": {
"typical": "300-600 mg/day"
},
"safety": {
"interactions": ["cholinergic medications"]
},
"evidence": {
"tier": "B"
}
}Evidence Graph Workflow
bash# 1) Find interventions for a condition
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/interventions?condition=Insomnia&limit=5"
# 2) Pull linked outcomes for one intervention
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/interventions/INTERVENTION_ID/health-outcomes?minGrade=B"
# 3) Fetch raw evidence links if you need custom scoring
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/evidence-links?interventionID=INTERVENTION_ID&limit=100"Expected Output Shape
json{
"interventionID": "l-theanine",
"linkedOutcomeCount": 8,
"edgeCount": 43,
"exampleEffect": "decrease"
}Use interaction-facts, assertions, and coverage together to verify a supplement is safe to surface in a consumer-facing app.
Safety Check Workflow
bash# 1) Find drug interactions for a supplement
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/interaction-facts?supplementID=st-johns-wort&severity=major"
# 2) Pull contraindication assertions for the same supplement
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/assertions?kind=contraindication&subjectType=supplement&subjectID=st-johns-wort"
# 3) Check coverage completeness before surfacing in UI
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/coverage?entityType=supplement&entityID=st-johns-wort"Expected Output Shape
json{
"majorInteractions": 4,
"contraindications": ["pregnancy", "SSRI co-administration"],
"coverageLevel": "complete",
"safeToSurface": false
}Use snapshots and diffs to detect what changed between releases so your integration only invalidates stale cache entries.
Audit Trail Workflow
bash# 1) List recent snapshots to find the previous version
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/snapshots?limit=5"
# 2) Diff two snapshots to see what changed
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/diffs?fromSnapshotID=snap-2026-02&toSnapshotID=snap-2026-03&entityType=supplement"
# 3) Invalidate your cache for changed entities onlyExpected Output Shape
json{
"fromSnapshotID": "snap-2026-02",
"toSnapshotID": "snap-2026-03",
"changedEntities": 12,
"entityType": "supplement",
"actions": ["added", "modified"]
}Use identifiers and lookup to map between Unfair entity IDs and external systems like PubChem, UNII, or RxNorm.
Cross-Reference Workflow
bash# 1) Find all external identifiers for a supplement
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/identifiers?entityType=supplement&entityID=creatine"
# 2) Reverse lookup: find the Unfair entity from an external code
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/lookup?system=pubchem&code=586"Expected Output Shape
json{
"entityID": "creatine",
"identifiers": [
{ "system": "pubchem", "code": "586" },
{ "system": "unii", "code": "MU72812GK0" }
]
}Use studies, evidence, and evidence/reverse to build research tools that trace claims back to primary sources.
Deep Evidence Workflow
bash# 1) Search studies with effect estimates for a supplement
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/studies?q=creatine&hasEffectEstimates=true&limit=5"
# 2) Get structured evidence statements
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/evidence?supplementID=creatine&limit=10"
# 3) Reverse query: which supplements have evidence for an outcome?
curl -sS -H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/evidence/reverse?objectID=cognitive-performance"Expected Output Shape
json{
"studyCount": 5,
"evidenceStatements": 10,
"reverseHits": ["creatine", "omega-3", "caffeine"],
"topStudyType": "Systematic review",
"exampleStudy": {
"sampleSize": 281,
"blinding": "double-blind",
"randomized": true,
"journal": "Journal of the ISSN",
"publicationYear": 2017
}
}Request
bashcurl -i -sS \
-H "Authorization: Bearer $UAF_TOKEN" \
"https://unfairapp.com/api/library/v1/supplements?limit=2&offset=0"Response
httpHTTP/2 200
x-library-version: 2026-03-18T01:53:00.432Z
x-contract-version: 1.0.0
x-snapshot-id: snapshot.a4154a2908a032ac407e
x-rate-limit-remaining: 497
x-rate-limit-reset: 2026-03-01T00:00:00.000Z
{
"ok": true,
"total": 384,
"limit": 2,
"offset": 0,
"filters": {
"q": null,
"category": null,
"categoryLabel": null,
"tier": null
},
"data": [
{
"slug": "5-htp",
"displayName": "5-HTP",
"categoryID": "amino-acid"
},
{
"slug": "7-keto-dhea",
"displayName": "7-Keto DHEA",
"categoryID": "hormone"
}
]
}These fields are domain-specific and are easiest to use when you know what they represent.
tier is the normalized evidence strength bucket. Higher quality evidence sorts first.endpointRelevance scores how directly a study endpoint supports the claim.biasRisk estimates methodological risk of bias for that evidence entry.Evidence tier is a normalized confidence label used for sorting and filtering. Higher tiers represent stronger supporting evidence and are surfaced first in ranked responses.
Use tiers to control strictness in your product. For example, start with minGrade=B in decision-focused views, then allow lower tiers in exploration views.
Evidence quality metadata helps explain why an item was ranked a certain way. Fields like endpointRelevance and biasRisk describe how directly a study supports a claim and how likely the result is to be biased.
Use these fields for transparency in your UI. Show users when a recommendation is backed by stronger endpoint alignment and lower bias risk, and flag weaker entries as lower confidence.
For deeper definitions, see the Evidence Tier and Evidence Quality Metadata glossary entries.
Build clients that respect quotas by reading response headers on every request.
x-rate-limit-remaining to decide when to throttle prefetching.x-rate-limit-reset to schedule retries after quota resets.x-library-version as a cache key so clients can skip unnecessary refetches.429 monthly_limit_exceeded until reset.Use this checklist when adding or updating endpoints so docs stay consistent.
GET /supplements
json{
"ok": true,
"total": 384,
"limit": 50,
"offset": 0,
"filters": {
"q": null,
"category": null,
"categoryLabel": null,
"tier": null
},
"data": [
{
"slug": "5-htp",
"displayName": "5-HTP",
"scientificName": "5-Hydroxy-L-tryptophan",
"categoryID": "amino-acid",
"summary": "5-HTP is a serotonin precursor...",
"dose": {
"typical": "100-300 mg/day"
},
"evidence": {
"tier": "C",
"effectWindow": "2-4 weeks"
}
}
]
}GET /supplements/{slug}
json{
"ok": true,
"data": {
"slug": "5-htp",
"displayName": "5-HTP",
"mechanismSummary": "Precursor to serotonin...",
"dose": {
"min": "Not established",
"typical": "100-300 mg/day",
"maxCaution": "Low-risk cautious titration"
},
"safety": {
"contraindications": ["pregnancy", "lactation"],
"interactions": ["SSRI", "SNRI", "MAOI"]
},
"evidence": {
"tier": "C",
"effectWindow": "2-4 weeks",
"table": [
{
"sourceID": "SRC-001",
"studyType": "Systematic review",
"studyURL": "https://pubmed.ncbi.nlm.nih.gov/12345678/",
"endpointRelevance": 4,
"biasRisk": 4,
"blinding": "double-blind",
"sampleSize": 120,
"durationDays": 56,
"randomized": true,
"conclusions": "Significant improvement in...",
"adverseEvents": "Well tolerated, mild GI...",
"dose": "300 mg/day",
"journal": "Nutrients",
"publicationYear": 2020
}
]
}
}
}GET /meta
json{
"ok": true,
"data": {
"metadata": {
"generatedAt": "2026-03-18T01:39:01Z",
"sourceManifestGeneratedAt": "2026-03-14T11:01:19Z",
"sourceSupplementCount": 384,
"importedSupplementCount": 384,
"exportedSupplementCount": 384,
"byCategory": {
"chemical-compound": 16,
"amino-acid": 31
}
},
"facets": {
"categories": ["chemical-compound", "amino-acid"],
"tiers": ["A", "B", "C", "D"]
},
"research": {
"metadata": {
"generatedAt": "2026-03-18T01:53:00.432Z",
"counts": {
"healthOutcomeCount": 781,
"interventionCount": 182,
"edgeCount": 3919
},
"quality": {
"level": "High"
}
},
"facets": {
"healthOutcomeCategories": ["Behavior and Context", "Biology"],
"interventionConditions": ["Acute Respiratory Infection", "Aerobic Exercise Performance"]
}
},
"contracts": {
"contractVersion": "1.0.0",
"snapshotID": "snapshot.a4154a2908a032ac407e",
"supportedAssertionKinds": [
"claim",
"interaction",
"contraindication",
"avoid_if",
"regulatory",
"intervention_outcome"
]
}
}
}