Skip to content
LearnSphere

For developers

LearnSphere API

Three access levels, one principle: clean JSON over HTTPS. The public catalog API is free; the creator API is part of the API plan.

Basics

All endpoints return JSON (UTF-8) over HTTPS only. Successful responses are wrapped in { "data": … }, errors in { "error": "code" } with a matching HTTP status. Prices are always cent amounts (priceCents) to avoid rounding issues.

Versioning

Every API carries its version in the path (/api/public/v1/…, /api/v1/…). Within a version, existing fields and their behaviour stay stable – at most, new optional fields are added. Breaking changes only ever ship under a new version (v2) while the old one keeps running with advance notice. Build your integration to ignore unknown additional fields.

StatusCodeMeaning
401unauthorizedAPI key missing, invalid, or revoked.
403api_plan_requiredThe key belongs to an account without an active API plan.
404not_foundCourse does not exist or is no longer public.
429rate_limitedToo many requests – wait briefly and retry.

1. Public catalog API (free)

No sign-up, no key. It returns only courses that are published and listed in the LearnSphere shop – exactly what the courses page shows. Courses a creator sells exclusively through their own channels do not appear here.

GET/api/public/v1/courses
ParameterMeaning
qSearch term, matches title and subtitle.
pagePage, starting at 1 (default 1).
perResults per page, 1–48 (default 12).
curl "https://learnsphere.one/api/public/v1/courses?q=react&per=12"
{
  "data": [
    {
      "id": "cm…",
      "slug": "react-fuer-einsteiger",
      "title": "React für Einsteiger",
      "subtitle": "Von null zur ersten App",
      "language": "de",
      "priceCents": 4900,
      "currency": "EUR",
      "creatorName": "Jane Doe",
      "sectionCount": 6,
      "lessonCount": 42,
      "averageRating": 4.8,
      "reviewCount": 31,
      "url": "https://learnsphere.one/de/courses/react-fuer-einsteiger",
      "createdAt": "2026-07-01T09:00:00.000Z"
    }
  ],
  "meta": { "total": 1, "page": 1, "pages": 1, "per": 12 }
}
GET/api/public/v1/courses/{slug}

Course detail including description and curriculum metadata (sections, lesson titles, duration, preview flag). Course content itself – videos, files, texts – is deliberately not included.

Rate limit: 60 requests per minute per IP. Responses may be cached for up to 60 seconds.

2. Affiliate API

For members of the affiliate program: the full shop catalog with your personal commission links. Purchases via these links earn you a 15% commission – valid for any course purchase within 7 days of the click.

GET/api/v1/affiliate/courses?affiliate=true

Auth: Bearer API key (same as the creator API; an API plan is not required, only program membership). The affiliate=true parameter is mandatory for the commission: only then do the returned urls carry your affiliate code (?aff=…) – without it they are neutral links with no commission. Rate limit: 60 requests/minute per key.

3. Creator API (API plan)

For creators with an active API plan (€25/month, €20/month billed yearly). Build your own shop: the API returns all of your published courses – including those not listed in the LearnSphere shop. Sales through your API links count as your own channel: 75% share instead of 50%.

Authentication

Create an API key in the creator studio under Distribution. The key (ls_…) is shown exactly once and stored only as a hash. Send it as a Bearer token:

curl "https://learnsphere.one/api/v1/courses" \
  -H "Authorization: Bearer ls_1234…abcd"

Without a valid key or active plan you get an error:

{ "error": "api_plan_required" }
GET/api/v1/courses

All of your published courses with prices, ratings, url (purchase link with ?via=api so the sale is attributed to your channel) and embedUrl for the widget.

GET/api/v1/courses/{slug}

Course detail including the full curriculum (sections and lessons with duration and preview flag) – for your own courses only.

In progress: fetching course content for enrolled users and a full API checkout. Until then, purchases run through the provided link – your customers land on the secure LearnSphere checkout and the sale is credited to you at 75%.

Protecting your key

  • Call the creator API from your server only – never from the browser, where your key would be public.
  • Keep the key in an environment variable, not in your repo.
  • Revoke keys immediately in the studio if you suspect a leak – the old key becomes invalid instantly.

Security

  • All requests use HTTPS; keys travel only as Bearer headers.
  • API keys are stored hashed only and shown in plain text exactly once.
  • Every request verifies both key and subscription status – a cancelled plan closes the API automatically.
  • Public endpoints contain no personal data and are rate-limited.
  • Payments never touch your servers: the purchase link leads to the LearnSphere checkout (Stripe) – card data stays away from your infrastructure.

Integrating with AI agents

Building your integration with Claude Code or another coding agent? We provide a ready-made SKILL.md: it describes endpoints, auth, error codes and the security rules (e.g. “never use the API key in the browser”) in a format your agent understands directly – so the integration is built correctly instead of guessed.

Put the file in your project at .claude/skills/learnsphere-api/SKILL.mdand tell your agent e.g. “embed my LearnSphere courses”. For LLM crawlers there is also a /llms.txt.

⬇ Download SKILL.md