OpenStax APIopenstax.org ↗
Access structured data from 60+ OpenStax textbooks: book metadata, full table of contents, and learning outcomes organized by chapter and section.
What is the OpenStax API?
The OpenStax API gives programmatic access to 60+ free textbooks across Business, Science, Math, Social Sciences, Humanities, Computer Science, and Nursing. Three endpoints cover book discovery, table-of-contents retrieval, and learning-outcome extraction. The get_learning_outcomes endpoint returns verbatim objective statements organized by chapter and section, with an optional chapter filter to scope results for large books.
curl -X GET 'https://api.parse.bot/scraper/97903193-4df4-40f4-8924-422c78e72ed7/list_books?subject=Business' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace openstax-org-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: OpenStax Textbooks SDK — browse catalog, inspect TOC, extract learning outcomes."""
from parse_apis.openstax_textbooks_api import OpenStax, Subject, BookNotFound
client = OpenStax()
# List science textbooks — limit= caps total items fetched.
for book in client.books.list(subject=Subject.SCIENCE, limit=5):
print(book.title, book.slug, book.subjects)
# Drill into one book's table of contents via constructible key.
bio = client.book(slug="biology-2e")
toc = bio.toc()
print(toc.book_title, len(toc.chapters), "chapters")
for ch in toc.chapters[:3]:
print(ch.title, ch.sections)
# Extract learning outcomes for chapter 1 of the same book.
outcomes = bio.learning_outcomes(chapter="1")
print(outcomes.total_learning_outcomes, "outcomes across", outcomes.total_sections_with_outcomes, "sections")
for section in outcomes.chapters[0].sections[:2]:
print(section.section_title, section.learning_outcomes)
# Typed error handling for an invalid slug.
try:
client.book(slug="nonexistent-book-xyz").toc()
except BookNotFound as exc:
print(f"Book not found: {exc.book_slug}")
print("exercised: books.list / book.toc / book.learning_outcomes / BookNotFound")List all available OpenStax textbooks with their titles, slugs, subjects, and content IDs. Optionally filter by subject area. Returns only books with 'live' or 'new_edition_available' state. No pagination — the full catalog (~60 books) is returned in one response.
| Param | Type | Description |
|---|---|---|
| subject | string | Filter by subject area. Case-insensitive partial match against book subjects. Common values include 'Business', 'Science', 'Math', 'Social Sciences', 'Humanities', 'Computer Science'. If omitted or empty, returns all live books. |
{
"type": "object",
"fields": {
"books": "array of book objects with title, slug, subjects, cnx_id, book_state",
"total": "integer total count of books returned"
},
"sample": {
"data": {
"books": [
{
"slug": "anatomy-and-physiology-2e",
"title": "Anatomy and Physiology 2e",
"cnx_id": "4fd99458-6fdf-49bc-8688-a6dc17a1268d",
"subjects": [
"Science"
],
"book_state": "live"
}
],
"total": 1
},
"status": "success"
}
}About the OpenStax API
Book Discovery
The list_books endpoint returns all textbooks currently in a live or new_edition_available state. Each record includes the book title, URL slug, subjects array, cnx_id (the OpenStax content identifier), and book_state. An optional subject parameter accepts a case-insensitive partial match, so filtering by 'Science' returns Biology, Chemistry, Physics, and related titles without requiring an exact string.
Table of Contents
get_book_toc accepts a book_slug from list_books and returns the full chapter-section hierarchy. The chapters array nests section objects, each carrying a title and slug. The response also echoes book_title and subjects so callers can confirm they fetched the right book without a separate lookup. Large books like *University Physics* return dozens of chapters and hundreds of sections.
Learning Outcomes
get_learning_outcomes is the most data-dense endpoint. For each section that has defined objectives, it returns the verbatim learning_outcomes strings alongside section_title and section_slug. The response includes total_learning_outcomes and total_sections_with_outcomes counts at the top level. Because some books (Anatomy & Physiology, for example) carry hundreds of objectives, the optional chapter parameter—an integer string like '3'—limits the response to a single chapter. The chapter_filter field in the response confirms which filter was applied, or returns null when all chapters are included.
The OpenStax API is a managed, monitored endpoint for openstax.org — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when openstax.org changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official openstax.org API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a curriculum-alignment tool by mapping
learning_outcomesstrings to course standards across subjects. - Generate a structured study guide for any OpenStax book using the nested chapters and sections from
get_book_toc. - Populate a course catalog or LMS with accurate book metadata (title, slug, subjects, cnx_id) from
list_books. - Create chapter-by-chapter quiz banks derived from verbatim learning objective statements.
- Filter OpenStax books by subject area to programmatically build reading lists for a specific discipline.
- Track which sections have defined learning outcomes versus those that do not, using
total_sections_with_outcomesagainst the total section count. - Sync OpenStax TOC structure into a knowledge graph or ontology for academic research tooling.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does OpenStax have an official developer API?+
What does `get_learning_outcomes` actually return, and how granular is it?+
section_title, section_slug, and a learning_outcomes array of verbatim objective strings exactly as they appear in the textbook. The top-level fields total_learning_outcomes and total_sections_with_outcomes give aggregate counts for the full book (or filtered chapter) without having to iterate the nested structure.Can I retrieve the full text or page content of a textbook section?+
Are retired or draft OpenStax books included in `list_books` results?+
list_books filters to books with a book_state of live or new_edition_available only. Retired editions and unpublished drafts are excluded. If you need to track a specific older edition, you can fork the API on Parse and revise the state filter to include additional book states.