Developer documentation

Customer API v1

A predictable, versioned server-to-server API for trusted school automation.

Effective 2026-07-30 Version 2026-07-30 Operator: Better Brain Lab LLC

Start here

The management API lets a school integrate its courses, learners, contacts, enrollments, commerce records, campaigns, automations, community moderation, usage, and signed outbound webhooks. It is designed for trusted backend systems, never browser or mobile client code.

Download the OpenAPI 3.1 contract for complete request schemas, response schemas, parameters, examples, and status codes.

Authentication

A school owner creates a key from Settings → API keys, chooses only the permissions the integration needs, and may set an expiry, IP allowlist, and per-minute request budget. API access is available on every plan. Some scopes appear only when their corresponding school feature is enabled.

CoursePan shows the complete credential once and retains only a non-secret prefix and one-way verifier. Store it in a server-side secret manager. Do not put it in a URL, browser bundle, analytics event, log, support ticket, or source control.

Authorization: Bearer ck_live_<prefix>.<secret>

Every key identifies exactly one school. CoursePan checks expiry, revocation, current plan access, optional IP restrictions, the endpoint scope, and the key’s rate limit on every request. Revocation is immediate; rotation revokes the old key in the same transaction that creates its one-time replacement.

Base URL and first request

https://api.coursepan.com/api/v1/management

curl --fail-with-body \
  --header "Authorization: Bearer $COURSEPAN_API_KEY" \
  --header "Accept: application/json" \
  "https://api.coursepan.com/api/v1/management/courses?per_page=25"

Authenticated responses use Cache-Control: no-store, private and include X-RateLimit-Limit and X-RateLimit-Remaining. A limited request also includes Retry-After.

Endpoint reference

The tables below are generated from the same OpenAPI source that is checked against CoursePan’s live route middleware. A key needs the exact listed scope; write access never implies an unrelated read or moderation permission.

Courses

Method and pathRequired scopeGuardsPurpose
GET /v1/management/coursescourses:read—List courses
POST /v1/management/coursescourses:writeIdempotency-KeyCreate a course
GET /v1/management/courses/{course}courses:read—Get a course
PATCH /v1/management/courses/{course}courses:writeIdempotency-Key + If-MatchUpdate a course

Learners

Method and pathRequired scopeGuardsPurpose
GET /v1/management/studentsstudents:read—List learners
GET /v1/management/students/{student}students:read—Get a learner
PATCH /v1/management/students/{student}students:writeIdempotency-Key + If-MatchUpdate learner identity or account state

Contacts

Method and pathRequired scopeGuardsPurpose
GET /v1/management/contactscontacts:read—List CRM contacts
POST /v1/management/contactscontacts:writeIdempotency-KeyCreate a CRM contact without inferring consent
GET /v1/management/contacts/{contact}contacts:read—Get a CRM contact
PATCH /v1/management/contacts/{contact}contacts:writeIdempotency-Key + If-MatchUpdate a CRM contact
POST /v1/management/contacts/{contact}/archivecontacts:writeIdempotency-Key + If-MatchArchive a contact without deleting consent history

Enrollments

Method and pathRequired scopeGuardsPurpose
GET /v1/management/enrollmentsenrollments:read—List enrollments
GET /v1/management/enrollments/{enrollment}enrollments:read—Get an enrollment
POST /v1/management/enrollment-grantsenrollments:grantIdempotency-KeyGrant course access from an explicit external source
POST /v1/management/enrollments/{enrollment}/revokeenrollments:revokeIdempotency-Key + If-MatchRevoke only the named API-managed access source

Usage

Method and pathRequired scopeGuardsPurpose
GET /v1/management/usageusage:read—Get plan and reconciled video usage

Offers

Method and pathRequired scopeGuardsPurpose
GET /v1/management/offersoffers:read—List offers
POST /v1/management/offersoffers:writeIdempotency-KeyCreate an offer and its catalogue
GET /v1/management/offers/{offer}offers:read—Get an offer
PATCH /v1/management/offers/{offer}offers:writeIdempotency-Key + If-MatchUpdate an offer; purchased catalogues cannot be replaced
POST /v1/management/offers/{offer}/publishoffers:writeIdempotency-Key + If-MatchPublish an offer
POST /v1/management/offers/{offer}/archiveoffers:writeIdempotency-Key + If-MatchArchive an offer
POST /v1/management/offers/{offer}/draftoffers:writeIdempotency-Key + If-MatchReturn an unpublished offer to draft

Orders

Method and pathRequired scopeGuardsPurpose
GET /v1/management/ordersorders:read—List retained order and entitlement facts
GET /v1/management/orders/{order}orders:read—Get an order

Subscriptions

Method and pathRequired scopeGuardsPurpose
GET /v1/management/subscriptionssubscriptions:read—List subscription lifecycle records
GET /v1/management/subscriptions/{subscription}subscriptions:read—Get a subscription and immutable billing cycles

Campaigns

Method and pathRequired scopeGuardsPurpose
GET /v1/management/campaignscampaigns:read—List campaigns and aggregate delivery outcomes
POST /v1/management/campaignscampaigns:writeIdempotency-KeyCreate a draft campaign
GET /v1/management/campaigns/{campaign}campaigns:read—Get a campaign
PATCH /v1/management/campaigns/{campaign}campaigns:writeIdempotency-Key + If-MatchUpdate a draft campaign before audience confirmation
POST /v1/management/campaigns/{campaign}/confirmcampaigns:writeIdempotency-Key + If-MatchFreeze the audience and campaign configuration
POST /v1/management/campaigns/{campaign}/sendcampaigns:writeIdempotency-Key + If-MatchStart or reschedule confirmed campaign delivery now
POST /v1/management/campaigns/{campaign}/pausecampaigns:writeIdempotency-Key + If-MatchPause a sending campaign
POST /v1/management/campaigns/{campaign}/resumecampaigns:writeIdempotency-Key + If-MatchResume a paused campaign
POST /v1/management/campaigns/{campaign}/cancelcampaigns:writeIdempotency-Key + If-MatchCancel unsent campaign work while retaining history

Automations

Method and pathRequired scopeGuardsPurpose
GET /v1/management/automationsautomations:read—List versioned automations and aggregate run outcomes
POST /v1/management/automationsautomations:writeIdempotency-KeyCreate a draft automation version
GET /v1/management/automations/{automation}automations:read—Get an automation and its latest definition
PATCH /v1/management/automations/{automation}automations:writeIdempotency-Key + If-MatchRename an automation or replace its complete draft definition
POST /v1/management/automations/{automation}/dry-testautomations:writeIdempotency-Key + If-MatchValidate the latest draft without executing side effects
POST /v1/management/automations/{automation}/publishautomations:writeIdempotency-Key + If-MatchPublish the successfully tested latest draft
POST /v1/management/automations/{automation}/pauseautomations:writeIdempotency-Key + If-MatchPause a live automation
POST /v1/management/automations/{automation}/resumeautomations:writeIdempotency-Key + If-MatchResume a paused automation
POST /v1/management/automations/{automation}/versionsautomations:writeIdempotency-Key + If-MatchCopy the live version into a new editable draft
POST /v1/management/automations/{automation}/archiveautomations:writeIdempotency-Key + If-MatchArchive an automation and cancel unfinished work

Community

Method and pathRequired scopeGuardsPurpose
GET /v1/management/community-spacescommunity:read—List community spaces and operational counts
GET /v1/management/community-spaces/{space}community:read—Get a community space
GET /v1/management/community-postscommunity:read—List posts; private conversations are never included
GET /v1/management/community-posts/{post}community:read—Get a post and safe attachment metadata
GET /v1/management/community-commentscommunity:read—List community comments
GET /v1/management/community-comments/{comment}community:read—Get a community comment
GET /v1/management/community-eventscommunity:read—List events without exposing private join URLs
GET /v1/management/community-events/{event}community:read—Get a community event without its private join URL
GET /v1/management/community-membershipscommunity:read—List memberships needed for community operations and moderation
GET /v1/management/community-memberships/{membership}community:read—Get a community membership
GET /v1/management/community-reportscommunity:read—List encrypted-at-rest learner reports
GET /v1/management/community-reports/{report}community:read—Get a community report
GET /v1/management/community-moderation-actionscommunity:read—List the immutable moderation ledger
POST /v1/management/community-moderation-actionscommunity:moderateIdempotency-Key + If-MatchApply a reasoned, immutable moderation decision
GET /v1/management/community-moderation-actions/{action}community:read—Get one immutable moderation decision

Webhooks

Method and pathRequired scopeGuardsPurpose
GET /v1/management/webhook-eventswebhooks:manage—List supported outbound event names and versions
GET /v1/management/webhook-endpointswebhooks:manage—List outbound webhook endpoints
POST /v1/management/webhook-endpointswebhooks:manageIdempotency-KeyCreate a signed outbound webhook endpoint
GET /v1/management/webhook-endpoints/{endpoint}webhooks:manage—Get an outbound webhook endpoint
PATCH /v1/management/webhook-endpoints/{endpoint}webhooks:manageIdempotency-Key + If-MatchUpdate endpoint name, URL, or event subscriptions
POST /v1/management/webhook-endpoints/{endpoint}/rotatewebhooks:manageIdempotency-Key + If-MatchRotate the signing secret and return the new secret once
POST /v1/management/webhook-endpoints/{endpoint}/pausewebhooks:manageIdempotency-Key + If-MatchPause outbound delivery
POST /v1/management/webhook-endpoints/{endpoint}/resumewebhooks:manageIdempotency-Key + If-MatchResume outbound delivery
POST /v1/management/webhook-endpoints/{endpoint}/testwebhooks:manageIdempotency-Key + If-MatchQueue a harmless signed test delivery
GET /v1/management/webhook-endpoints/{endpoint}/deliverieswebhooks:manage—List delivery outcomes and sanitized attempts
POST /v1/management/webhook-deliveries/{delivery}/replaywebhooks:manageIdempotency-Key + If-MatchQueue a new delivery that references a terminal source delivery

Safe mutations

Every POST, PATCH, PUT, or DELETE operation requires an opaque Idempotency-Key between 8 and 191 characters. Create one stable key for one logical operation and reuse it only when retrying that exact request. CoursePan retains the replay record for at least 24 hours by default.

curl --fail-with-body \
  --request POST \
  --header "Authorization: Bearer $COURSEPAN_API_KEY" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: crm-import-2026-08-01-row-1842" \
  --data '{"email":"[email protected]","name":"Example Learner"}' \
  "https://api.coursepan.com/api/v1/management/contacts"

Reusing a key with a different HTTP method, route, If-Match value, or canonical JSON body returns 409 idempotency_conflict. A completed replay returns the original response with Idempotent-Replayed: true.

Updating existing state

Mutations of existing resources also require optimistic concurrency. Read the resource, retain its opaque ETag response header, and send that exact value in If-Match. Never construct or modify an ETag yourself.

HTTP/1.1 200 OK
ETag: "v4-opaque-value"

curl --fail-with-body \
  --request PATCH \
  --header "Authorization: Bearer $COURSEPAN_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: contact-name-01900000-attempt-1" \
  --header 'If-Match: "v4-opaque-value"' \
  --data '{"name":"Updated Learner"}' \
  "https://api.coursepan.com/api/v1/management/contacts/01900000-0000-7000-8000-000000000001"

A missing precondition returns 428; a stale ETag returns 412. Fetch the current resource, reconcile your intended change, and retry with a new idempotency key and the new ETag.

Important resource rules

  • Money is always an integer in the currency’s smallest unit. Byte counts are exact integers.
  • Offer prices and courses become purchase history once used. Archive and replace a purchased catalogue instead of rewriting it.
  • Enrollment revocation removes only the named API-managed grant; it cannot erase access supplied by a purchase, group, or another source.
  • Confirming a campaign freezes its audience and configuration. Cancel unsent work or create a replacement instead of mutating confirmed history.
  • Automation definitions are versioned. Dry-test before publishing and create a new version for a published workflow.
  • Community moderation requires its own scope, an explicit reason, a client correlation ID, and authorized staff membership. Decisions enter an immutable moderation ledger.
  • Private conversations, direct messages, file storage paths, payment credentials, and raw provider secrets are not exposed by this API.

Pagination, filters, and response shape

List endpoints accept page and per_page. Page size defaults to 25 and is capped at 100. Most resources also expose stable filters such as state, status, identifiers, or updated_after; see the OpenAPI contract for each endpoint.

{
  "data": [],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total": 0,
    "last_page": 1
  }
}

Single resources use {"data": {...}}. Dates and times use ISO 8601. UUIDs are opaque identifiers and should not be interpreted.

Signed outbound webhooks

Create an HTTPS endpoint with webhooks:manage, select explicit event names, and copy the signing secret shown once. CoursePan validates public DNS, permits HTTPS on port 443, pins the resolved destination for the request, rejects redirects and private/reserved networks, retries transient failures, and exposes sanitized delivery evidence and explicit replay controls.

CoursePan-Delivery-Id: <delivery UUID>
CoursePan-Event: enrollment.started
CoursePan-Timestamp: <Unix seconds>
CoursePan-Signature: v2=<lowercase hex HMAC-SHA256>

Verify the signature over the exact raw request bytes before parsing JSON:

signed_payload = timestamp + "." + delivery_id + "." + raw_body
expected = hex_hmac_sha256(signing_secret, signed_payload)

Parse every comma-separated signature and accept a constant-time match for a secret version you currently trust. During the default 24-hour rotation window CoursePan may send both the new and previous signatures. Reject timestamps outside your chosen tolerance (five minutes is recommended), persist processed delivery IDs, and return a 2xx only after the event is durably accepted. Events are versioned and may be delivered more than once.

Errors

{
  "error": {
    "code": "insufficient_scope",
    "message": "This API key does not include the required scope."
  }
}

Clients should branch on the stable error.code, not the human message. Validation failures may also contain a field map. Expected status classes are:

  • 401 missing, malformed, expired, or revoked key;
  • 403 unavailable plan feature, disallowed IP, or insufficient scope;
  • 404 resource not found within the key’s school;
  • 409 lifecycle, immutable-history, or idempotency conflict;
  • 412 stale If-Match value;
  • 422 invalid request fields or missing idempotency key;
  • 428 required If-Match header missing;
  • 429 key request budget exhausted.

Audit, privacy, and support

The API key screen shows recent append-only lifecycle and request activity. Audit data contains fixed route names, scope, HTTP method, status, reason code, and actor where applicable. It does not retain bearer values, request or response bodies, URLs, query strings, email content, private messages, or raw client IP addresses.

CoursePan may add optional response fields or new event types within v1. Breaking request or response changes require a new API version. For integration help or to report unsafe behavior, use the support and abuse channel.