Skip to content

Enrollment

Use the client enrollment endpoints when payment happens outside Blend-ed. Call them from a trusted server after the external system has confirmed the payment or refund.

Both routes require:

clientapisecret: <CLIENT_API_SECRET>
Content-Type: application/json
POST /blendxapi/enrollments/client/enroll/
{
"email": "[email protected]",
"course_id": "267ce96d-1454-4292-aa42-1a0487c7eaaa",
"mode": "honor"
}
FieldRequiredDescription
emailYesLearner email and the join key for pending registration.
course_idYesBlendX/Hasura course UUID returned by discovery.
modeYesValid Open edX enrollment mode.

For an existing account:

{
"message": "User enrolled successfully",
"status": "success",
"enrollment_state": "enrolled"
}

For an email without an account:

{
"message": "User has no account; auto-enrollment queued and registration email sent",
"status": "success",
"enrollment_state": "pending_registration"
}

The learner must register with the same email address. Blend-ed then resolves the pending enrollment automatically.

The operation is safe to retry. Repeating an existing enrollment updates its mode rather than adding a duplicate; repeating a pending enrollment leaves one pending record.

POST /blendxapi/enrollments/client/unenroll/
{
"email": "[email protected]",
"course_id": "267ce96d-1454-4292-aa42-1a0487c7eaaa"
}

For a registered learner, the API removes the Hasura enrollment record and its trigger requests the matching Open edX unenrollment. For an unregistered email, it cancels the pending auto-enrollment.

The route returns 200 when the course exists even if there was nothing to remove. This makes refund and chargeback retries safe.

StatusMeaning
400Invalid body, unsupported mode, or enrollment operation failed.
401Missing or invalid clientapisecret.
404The course UUID does not exist in BlendX.
500Required server configuration, such as the service account, is missing.

Retry network failures and 5xx responses with backoff. Do not retry 401 or 404 until configuration or identifiers change.