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
| Route | Returns |
|---|---|
GET /api | The groups, section slugs, filters, topics, classifications and limits the running API accepts. |
GET /api/compounds | Published compounds, paged. |
GET /api/compounds/{slug} | One published compound. |
GET /api/categories | Category slugs, for the category filter. |
GET /api/classes | Class slugs, for the class filter. |
GET /api/articles | Published 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.
| Group | Holds | Default |
|---|---|---|
identity | slug, name, class, publishedAt, updatedAt. Always returned. | yes |
aliases | Other names, with aliasSources beside them. Other names include approved-product brand names, which is why this group is off by default. | no |
descriptions | Short and clinical description. | yes |
facts | CAS number, sequence and molecular weight, with sources. | no |
legalStatus | FDA 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 |
categories | Categories, primary first. | no |
sources | The report's bibliography. | no |
sections | Every 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 |
protocols | The structured protocols: a list of { label, dose, length, notes } in the report's order. dose is the text as authored. | no |
handling | Storage and handling, one row per form: { form, storageTempC, storageNotes, lightSensitive, shelfLifeDays, reconstitution }. form may gain values. | no |
| Group | Holds | Default |
|---|---|---|
summary | slug, title, summary, topic, position, publishedAt, updatedAt. Always returned. | yes |
body | The text. | no |
compounds | Published compounds the article mentions. | no |
sources | Its sources. | no |
Filters and paging
| Parameter | Accepts |
|---|---|
category | A category slug. GET /api/categories lists them. |
class | A class slug. GET /api/classes lists them. |
q | Matches name and other names, ignoring case and punctuation. |
updatedSince | An ISO 8601 instant. Returns compounds whose updatedAt is later. Percent-encode an offset: a raw + decodes to a space and is a 400. |
limit | 1 to 100, default 50 |
cursor | The nextCursor from the previous page. |
| Parameter | Accepts |
|---|---|
topic | One of basics, safety, evidence. |
limit | 1 to 100, default 50 |
cursor | The 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/.