Read API

Read-only JSON of every published compound report and article, for the servers of the sites that carry Compendium content.

Keys

Every request needs a key, sent as Authorization: Bearer <key>. Without a recognised key every route, /api included, answers 401. A key is cmp_ followed by 43 characters. Keys are issued by the Compendium team to each consuming site; ask for one. A key is shown once, when it is issued, and cannot be shown again.

A key belongs in a server's environment, never in a browser. The API sends no CORS headers, so a page on another origin cannot call it, and anything in a page is public.

curl -H "Authorization: Bearer $COMPENDIUM_KEY" \
  "https://peptidecompendium.org/api/compounds?include=facts,sections&limit=20"

What is served

Published compounds and published articles. Anything else is a 404 with the same body as an unknown slug. Report sections are served in reported voice only; drafts, unpublished changes and instructional content are never served.

Every response, errors included, carries "version": 1.

Endpoints

Endpoints
RouteReturns
GET /apiThe groups, section slugs, filters, topics, classifications and limits the running API accepts.
GET /api/compoundsPublished compounds, paged.
GET /api/compounds/{slug}One published compound.
GET /api/categoriesCategory slugs, for the category filter.
GET /api/classesClass slugs, for the class filter.
GET /api/articlesPublished articles, by topic then position, paged.
GET /api/articles/{slug}One published article.

Choosing what comes back

Compounds and articles take include=, a comma-separated, case-sensitive list of groups. No include returns the defaults; an empty include= returns the always-returned group alone. A requested group is always present, empty if need be. An unknown name is a 400 listing the valid ones. The section slugs for sections.<slug> are listed by GET /api.

Compound include groups
GroupHoldsDefault
identityslug, name, class, publishedAt, updatedAt. Always returned.yes
aliasesOther names, with aliasSources beside them. Other names include approved-product brand names, which is why this group is off by default.no
descriptionsShort and clinical description.yes
factsCAS number, sequence and molecular weight, with sources.no
legalStatusFDA and WADA status in force, with checked dates and sources. upcoming holds a status that takes effect later; it moves into place on its effectiveDate without updatedAt changing, so refetch the compound on that date.no
categoriesCategories, primary first.no
sourcesThe report's bibliography.no
sectionsEvery report section, keyed by slug, in report order. A section is { name, body, sources, updatedAt }, or null when the compound has no published block for it. sections.<slug> asks for one, e.g. sections.origin.no
protocolsThe structured protocols: a list of { label, dose, length, notes } in the report's order. dose is the text as authored.no
handlingStorage and handling, one row per form: { form, storageTempC, storageNotes, lightSensitive, shelfLifeDays, reconstitution }. form may gain values.no
Article include groups
GroupHoldsDefault
summaryslug, title, summary, topic, position, publishedAt, updatedAt. Always returned.yes
bodyThe text.no
compoundsPublished compounds the article mentions.no
sourcesIts sources.no

Filters and paging

Compound list filters
ParameterAccepts
categoryA category slug. GET /api/categories lists them.
classA class slug. GET /api/classes lists them.
qMatches name and other names, ignoring case and punctuation.
updatedSinceAn ISO 8601 instant. Returns compounds whose updatedAt is later. Percent-encode an offset: a raw + decodes to a space and is a 400.
limit1 to 100, default 50
cursorThe nextCursor from the previous page.
Article list filters
ParameterAccepts
topicOne of basics, safety, evidence.
limit1 to 100, default 50
cursorThe nextCursor from the previous page.

A list response carries nextCursor; follow it until it is null. A cursor is opaque: pass back what was given.

Keeping a copy in sync

updatedAt moves on every served change. updatedSince may return a compound already held, and never misses one. Ask for updatedSince set to the last updatedAt seen minus 10 minutes, and treat a compound held with the same updatedAt as unchanged.

Compare updatedAt only for equality: different means refetch. A larger value is not necessarily newer, because concurrent writes can commit with an earlier timestamp.

Errors and caching

An error is { "version": 1, "error": "…" } with a message that names the bad value, for example Bad limit: 500. Use 1 to 100. A 500 means the request failed on the server, never that a key was revoked.

Every 200 is cached for five minutes (s-maxage=300, stale-while-revalidate=60), so a newly published change or a revoked key can take up to six minutes to show.

Versioning

Changes within version 1 are additive. A consumer must tolerate new fields, new groups, new handling forms and new classification values. A breaking change would ship beside this one at /api/v2/.