Examples

Examples

Working requests for common jobs. Research calls need no key; vendor, product and price calls need one from the dashboard.

curl

Search peptides
curl "https://api.peptidelibrary.app/v1/peptides?search=glp&limit=5"
A research profile
curl "https://api.peptidelibrary.app/v1/peptides/bpc-157"
Prices (key required)
curl "https://api.peptidelibrary.app/v1/prices?peptide=bpc-157&form=vial&currency=USD&ships_to=US" \
  -H "Authorization: Bearer $PEPTIDE_LIBRARY_API_KEY"

Node.js

Research summary
const res = await fetch('https://api.peptidelibrary.app/v1/peptides/semaglutide/research');
const { data, meta } = await res.json();
console.log(data.clinical_evidence.human_trials, data.peptide.url);
Prices with rate-limit handling
// Server-side only: never ship your key to a browser.
const res = await fetch('https://api.peptidelibrary.app/v1/prices?peptide=bpc-157&currency=USD', {
  headers: { Authorization: `Bearer ${process.env.PEPTIDE_LIBRARY_API_KEY}` },
});
if (res.status === 429) {
  const wait = Number(res.headers.get('Retry-After') ?? 60);
  // back off and retry after `wait` seconds
}
const { data, pagination, meta } = await res.json();
for (const offer of data) console.log(offer.vendor.name, offer.price, offer.currency, offer.last_seen_at);
console.log(meta.affiliate_disclosure);

Python

Search
import requests

r = requests.get("https://api.peptidelibrary.app/v1/peptides", params={"search": "bpc", "limit": 5}, timeout=10)
r.raise_for_status()
for p in r.json()["data"]:
    print(p["name"], p["evidence"]["level"], p["url"])
Paginate the vendor directory
import os, requests

session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['PEPTIDE_LIBRARY_API_KEY']}"
url, params = "https://api.peptidelibrary.app/v1/vendors", {"ships_to": "US", "limit": 100}
while True:
    body = session.get(url, params=params, timeout=10).json()
    for vendor in body["data"]:
        print(vendor["name"], vendor["rating"]["average"])
    if not body["pagination"]["has_more"]:
        break
    params["cursor"] = body["pagination"]["next_cursor"]

Showing the data

  • Credit “Data from Peptide Library” and link each result to the url it returns.
  • Show prices with their currency and last_seen_at, and keep product_page_url links as returned.
  • Show not_documented as “not documented”, never as a value.
  • Present the data as research and education, not medical advice.