thepaliaDevelopers

Create a course enrollment

Connect your checkout to thepalia and send participants their registration link.

Before you start

You need a server that can make API requests, an existing checkout, and the course's suitability confirmation before purchase. Contact our dev team for the suitability text, client_id, client_secret, and the offerId for your chosen environment.

Start with https://api.staging.thepalia.de. Staging is for testing and does not generate completion certificates. Production uses https://api.thepalia.de; enrollments there are billed. Use the supplied credentials and the offer ID for your selected environment.

1. Obtain an access token

Call POST /v1/oauth/token from your server. See Obtain an API access token for JSON, form, and HTTP Basic options.

{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET"
}

A successful HTTP 200 response contains:

{
  "access_token": "EXAMPLE_ACCESS_TOKEN",
  "token_type": "Bearer"
}

Reuse the token for up to 24 hours; you do not need a new token before every request. Issuance is limited to 20 requests per minute per client IP. Obtain a new token when it expires. If a replacement token is rejected too, check credentials instead of repeatedly requesting tokens.

Keep credentials on your server. Do not put them in customer-facing JavaScript, URLs, source control, or logs.

2. Create the enrollment after purchase

Call POST /v1/course-enrollments only after the purchase succeeded and the participant confirmed the suitability requirements. See Create a course enrollment for the full contract and playground.

Send this header:

Authorization: Bearer EXAMPLE_ACCESS_TOKEN
Content-Type: application/json

Send this body, replacing the example offer ID with the one supplied by thepalia:

{
  "offerId": "11111111-1111-4111-8111-111111111111",
  "firstName": "Alex",
  "lastName": "Example",
  "eMail": "alex@example.com"
}

Existing users are matched by email; their enrollment is added to the existing user. A successful HTTP 200 response contains:

{
  "userId": "22222222-2222-4222-8222-222222222222",
  "courseEnrollmentId": "33333333-3333-4333-8333-333333333333",
  "registrationUrl": "https://staging.thepalia.app/enrollment/registration?enrollmentId=33333333-3333-4333-8333-333333333333"
}

Store userId and courseEnrollmentId with the customer and order in your system. Use the enrollment ID for course access, progress, cancellation, and support requests.

Email registrationUrl to the participant. The registration window lasts 31 days. Tell the participant to complete registration within that period; contact thepalia if the window has expired.

After registration, thepalia provides course delivery and course-related support. For a button that opens an existing course, follow the magic-link guide.

4. Handle unsuccessful requests

Check the response before deciding whether another request is safe:

  • 400 or 422: correct the request; resending the same invalid input will not help.
  • 401: check or renew an expired token, then retry with valid authentication.
  • 403: check that the offer belongs to your partner account in the selected environment.
  • 404: check the offer or enrollment ID and selected environment.
  • 429 on token issuance: wait before trying again; reuse a valid token when available.
  • Timeout, lost connection, or an unexpected server error during creation: the enrollment may already exist. Reconcile with thepalia before submitting another creation request.

Enrollment creation has no idempotency protection. Repeating the same request creates another enrollment and can result in additional billing. For read requests, use limited retries with a delay rather than an immediate retry loop.

Read progress

Call GET /v1/course-enrollments/{enrollment_id}/progress with your Bearer token. Replace {enrollment_id} with the stored courseEnrollmentId.

The progress reference describes completed sections and units, durations, the access period, and completion dates. Dates can be null while no completion has occurred.

Cancel an enrollment

Call DELETE /v1/course-enrollments/{enrollment_id} with your Bearer token. The cancellation reference describes the request and errors.

Success returns HTTP 204 with no response body. Deletion removes course access; a missing or already deleted enrollment returns 404. Payment refunds are a separate action in your checkout system.

Activation codes: only when instructed

Legacy integration: use POST /v1/activation-codes only if thepalia explicitly tells you to. Otherwise, use course enrollment creation. See the activation-code reference for the agreed alternative flow.

Check your integration

Using staging, complete a test purchase and verify that you receive HTTP 200, store both IDs, send the returned registration link, and can complete registration and access the course. Confirm that the email address and course match your test purchase before preparing production credentials and offer IDs.

On this page