Partner integrations

Partner API

Sell AcademyOS courses on your own marketplace: read the catalog licensed to you, grant buyers access and revoke it, with one server-side key.

What the API does

The partner API lets another marketplace sell AcademyOS courses. You list a licensed slice of the AcademyOS catalog on your own site, sell it to your own customers on your own terms, and then call this API to give those customers access. Courses are always taken inside AcademyOS: the API hands out access, never course content.

Base URL: https://content.academyos.app/api/partners/v1. Requests and responses are JSON, and every time is ISO 8601 in UTC.

MethodPathWhat it does
GET /api/partners/v1/courses List the courses you may sell
GET /api/partners/v1/courses/:id One course from your catalog, by public id or slug
POST /api/partners/v1/enrollments Give a buyer access to a course
GET /api/partners/v1/enrollments List the grants you made
GET /api/partners/v1/enrollments/:external_reference One grant, by your external reference
DELETE /api/partners/v1/enrollments/:external_reference Revoke a grant you made

Authentication

Every request carries a partner API key as a bearer token:

HTTP
Authorization: Bearer aos_pk_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  • Register your organisation in the developer portal and create a key there, or ask an AcademyOS administrator to issue one. A key is shown once, when it is created. AcademyOS keeps only a digest of it, so a lost key is revoked and replaced, never recovered.
  • A newly registered partner has no catalog yet: its key works, but GET /courses is empty and every grant answers 404 course_not_found until AcademyOS licenses courses to you. Ask for catalog access from the portal; it is a commercial decision, not a technical step.
  • The key is a server-side secret for your whole organisation: whoever holds it can grant and revoke access for your account. Never put it in a browser, a mobile app or a public repository.
  • There is no session, cookie or OAuth path into this API. A signed-in AcademyOS browser session, a personal AcademyOS API token and a Sign in with AcademyOS token are all refused.
  • To rotate, create a second key, deploy it, then revoke the first. A partner may hold several live keys so that rotation needs no downtime.

Every authentication failure gets the same 401 and the same body: a missing header, a wrong scheme, a malformed, unknown or revoked key, or a deactivated partner account. The answer cannot be used to find out which keys exist.

Errors

Every error in this API has the same shape. Branch on code; message is for people and may change.

JSON
{ "error": { "code": "course_not_found", "message": "No course matches that identifier." } }
HTTPcodeWhen you get it
401 unauthorized The key is missing, malformed, unknown or revoked, or the partner is switched off
404 course_not_found The course does not exist or is not licensed to you
404 grant_not_found No grant of yours has that external reference
404 not_found The path does not exist
400 invalid_page A page value the API cannot use (a safeguard: a page past the end is normally an empty list)
422 invalid_request A required parameter is missing
422 external_reference_required external_reference is missing
422 external_reference_too_long external_reference is longer than the limit
422 email_required email is missing
422 invalid_email email is not a valid address
422 invalid_expires_at expires_at is not an ISO 8601 time in the future
422 course_not_grantable The course is in your catalog but cannot be granted right now (taken down, its school's plan ended, or the learner is suspended there)
422 grant_failed The grant could not be saved; try again with the same reference
409 duplicate_request An identical request was being processed at the same moment; try again
409 external_reference_conflict The reference was already used for another email or course
429 rate_limited Too many requests this minute
429 grant_quota_exceeded The daily grant quota is used up

404 stands in where you might expect 403 or 422. A course you are not licensed to list is reported exactly like a course that does not exist, so the API cannot be used to discover the rest of the catalog.

The catalog

GET /courses lists the courses you may sell. A course is listed when it is approved, published and public, its creator is in good standing, and AcademyOS has licensed it to you: the course itself, its whole creator, or the whole catalog. Your licensed set is managed by AcademyOS, and a change shows on your next read.

A course can be a bundle: one product holding several of the creator's courses at one price. It is listed, priced and granted like any course, under one id. A grant gives the learner every course in it, and a revoke takes back only what that grant created.

ParameterDefaultNotes
query–Words in the course name or short description
category–An exact category slug
page1A page past the end is an empty list
per_page25At most 100; a larger value is lowered to 100
HTTP
GET /api/partners/v1/courses?category=mathematics&per_page=2
Authorization: Bearer aos_pk_…
JSON
{
  "courses": [
    {
      "id": "prod_8kQz1rXpLmN4vYbT2aCdEfGh",
      "slug": "practical-math",
      "name": "Practical Math",
      "short_description": "Master everyday math with hands-on lessons.",
      "description": "Plain-text course description.",
      "price_cents": 4900,
      "free": false,
      "billing_interval": null,
      "currency": "usd",
      "estimated_duration_minutes": 360,
      "tags": ["math", "beginner"],
      "cover_image_url": "https://cdn.example.com/covers/practical-math.jpg",
      "published_at": "2026-08-06T09:12:00Z",
      "access": { "kind": "days", "days": 30, "until": null },
      "category": { "name": "Mathematics", "slug": "mathematics" },
      "creator": { "name": "Example Studio", "slug": "example-studio" }
    }
  ],
  "meta": {
    "pagination": {
      "current_page": 1, "next_page": 2, "prev_page": null,
      "total_pages": 4, "total_count": 7, "per_page": 2
    }
  }
}
  • id is a stable public id (prod_…). Use it, or slug, wherever the API asks for a course_id. AcademyOS database ids are never exposed.
  • description is plain text, not HTML. Show it as text, or wrap it yourself.
  • access says what a buyer gets. kind is lifetime (never ends; days and until are null), days (lasts days days from the grant) or until (ends on the until date). Tell your buyers before they pay.
  • price_cents is the AcademyOS list price, for reference. What you charge your customers is your decision and is not sent to AcademyOS. Local prices a creator sets for buyers on AcademyOS are not part of this field. free is true when the creator gives the course away, and its price is then 0. billing_interval is "month" or "year" when the creator sells the course as a subscription on AcademyOS, and price_cents is then the price per period; it is null for a one-time price. A grant you make is not a subscription.
  • cover_image_url is an absolute URL anyone can fetch.

GET /courses/:id returns the same object for one course, by public id or slug. Anything outside your licensed catalog is 404.

Granting access

POST /enrollments gives a customer access to a course.

ParameterRequiredNotes
course_idyesPublic id or slug from the catalog. Not licensed to you: 404
emailyesThe learner's email, trimmed and lower-cased before it is stored
external_referenceyesYour idempotency key, such as your order id, at most 191 characters (see Idempotency)
expires_atnoISO 8601, in the future. It can only shorten access (see below). Leave it out to use the course's own access terms

A new grant answers 201 Created, a repeated one 200 OK, with the same body:

HTTP
POST /api/partners/v1/enrollments
Authorization: Bearer aos_pk_…
Content-Type: application/json

{
  "course_id": "prod_8kQz1rXpLmN4vYbT2aCdEfGh",
  "email": "learner@example.com",
  "external_reference": "order-99213",
  "expires_at": null
}
JSON
{
  "external_reference": "order-99213",
  "status": "active",
  "grant_status": "granted",
  "email": "learner@example.com",
  "granted_at": "2026-08-11T14:03:22Z",
  "revoked_at": null,
  "course": {
    "id": "prod_8kQz1rXpLmN4vYbT2aCdEfGh",
    "slug": "practical-math",
    "name": "Practical Math"
  },
  "enrollment": {
    "status": "active",
    "expires_at": "2026-09-10T14:03:22Z",
    "days_remaining": 30,
    "active": true
  }
}

What status tells you

status is the field to branch on.

statusWhat happenedWhat to tell the buyer
activeThe email already had an AcademyOS account; access is live now“Sign in to AcademyOS and start learning.”
pending_activationNo account has that email yet. Access waits for it, an invitation is sent, and it switches on at the first sign-in“Check your inbox and create your AcademyOS account with this exact email address.”
expiredThe access period has passed“Your access period has ended.”
revokedYou revoked the grant–

grant_status is the state of the grant itself (granted or revoked). enrollment.days_remaining is null for lifetime access and 0 once access has lapsed.

How long access lasts

Access lasts until the earlier of what you ask for and what the course allows; a lifetime course has no limit. Ask for two years on a 30-day course and you get 30 days, without an error. enrollment.expires_at and days_remaining describe your grant: if the learner already had the course some other way, the answer is the same and does not say so.

Idempotency

external_reference is unique per partner: two partners may use the same string, you may not use it twice.

  • Sending a POST again with a reference you have used returns the same grant with 200. It never creates a second one, and this holds forever, not for a retry window.
  • When two identical requests arrive together, one wins and the other returns the winner's grant. A 409 duplicate_request is possible in a narrow race; retry it and you get the 200.
  • Use a value you can rebuild from your own records, such as your order id, never a fresh random id per attempt.
  • A request that failed is not recorded: fix it and retry with the same reference.
  • A reference belongs to one customer and one course. Reusing it with another email or course_id is 409 external_reference_conflict, nothing is granted, and the answer says nothing about the earlier grant. To give the same customer a second course, send a second reference.

Reading and revoking grants

GET /enrollments lists the grants you made, filtered by email (exact, any case), course_id or external_reference, and paged with page and per_page as in the catalog. No filter reaches another partner's grants or people who bought from AcademyOS directly.

GET /enrollments/:external_reference returns one grant, the same object as above; an unknown reference is 404 grant_not_found. URL-encode the reference.

DELETE /enrollments/:external_reference revokes access you granted, for a refund, a chargeback or a cancellation:

HTTP
DELETE /api/partners/v1/enrollments/order-99213
Authorization: Bearer aos_pk_…
JSON
{
  "external_reference": "order-99213",
  "status": "revoked",
  "grant_status": "revoked",
  "email": "learner@example.com",
  "granted_at": "2026-08-11T14:03:22Z",
  "revoked_at": "2026-08-19T08:41:05Z",
  "course": { "id": "prod_8kQz1rXpLmN4vYbT2aCdEfGh", "slug": "practical-math", "name": "Practical Math" },
  "enrollment": null
}
  • It answers 200 whether or not the grant was already revoked, so it is safe to retry. Grants you did not make are 404 grant_not_found.
  • A revoke withdraws only the access your grant created. If the learner already had the course (bought from AcademyOS, given by their teacher, or granted by another partner), your grant extended it without owning it, and your revoke leaves it as it was.
  • The answer is the same either way and does not say whether anything was withdrawn.

Rate limits and quotas

Going over a per-minute budget answers 429 with rate_limited. Back off and retry; the windows are one minute.

Separately, POST /enrollments has a daily grant quota per partner, counted over a rolling 24 hours. Going over it answers 429 with grant_quota_exceeded. Grants to an email that has no AcademyOS account yet have their own, lower quota inside the first one, because each sends an invitation email.

ScopeBudget
Every request, per API key600 a minute
Grants and revokes, per API key60 a minute
Every request, per IP address300 a minute
Quota (rolling 24 hours)Default
Grants per partner1,000
Grants to emails without an AcademyOS account250
  • A grant_quota_exceeded answer granted nothing: no access, no invitation, and the reference is still free. Retry the same reference later.
  • Repeats of a grant that already succeeded never count against the quota, so a nightly reconciliation is always safe.
  • The quotas are set per partner. If your real volume is higher, or you plan a bulk backfill, ask before you run it.

What the API shows and hides

The API gives you what you need to sell and deliver a course, and nothing more.

  • Exposed: for courses licensed to you, the name, slug, plain-text description, list price, currency, access terms, estimated duration, category, tags, cover image, publication date and the creator's public name and slug; for grants you made, the email you sent, the course, when it was granted and revoked, and whether access is live.
  • Not exposed: any other personal data about buyers (no names, user ids or purchase history), other partners' grants, people who bought from AcademyOS directly, whether an email already had access, creator finances, sales figures, unpublished courses, AcademyOS database ids, and the course content itself.

Webhooks

Instead of polling for activations, a partner can receive grant.activated and grant.revoked events. The partner's owner adds an https endpoint on the partner's page in the developer portal. Each event carries the same grant object as GET /enrollments/:external_reference, and only for grants you made. Signing, retries and the message format are in the webhooks guide.

Webhooks add to the nightly reconciliation; they do not replace it. Events from a time your endpoint was off are not sent again.

Integration checklist

  1. Get a key, keep it in your secret manager, and check that GET /courses returns the catalog you expect.
  2. Copy the catalog on a schedule, and read access on every sync: creators can change it, and your product page must show the current terms.
  3. At your checkout, ask for the email the buyer will use on AcademyOS, and say so on the form.
  4. When payment succeeds, POST /enrollments with your order id as external_reference. On a network error, retry with the same reference.
  5. Branch on status: active means “sign in”, pending_activation means “check your inbox and use this email”.
  6. On a refund or chargeback, DELETE /enrollments/:external_reference.
  7. Reconcile every night with GET /enrollments, and alert on any grant you expect that is missing.

Was this page useful?

Last updated November 26, 2026