Enrollment API

The Enrollment API allows you to automate the process of subscribing new users to plans based on predefined rules. This is particularly useful for automatically assigning new sign-ups to a free or trial plan.

Overview

The Enrollment API has two main functions:

  • Rule Management: Create, list, and delete enrollment rules for your plans.
  • User Enrollment: Enroll a user into a plan, which creates a subscription for them based on matching rules.

Authentication

All API requests require authentication via merchant credentials.

Endpoints

List Enrollment Rules

Retrieves all enrollment rules for a specific plan.

GET https://api.getlumen.dev/v1/enrollment/rules?planId={planId}

Query Parameters

ParameterTypeDescription
planIdstringThe ID of the plan to list rules for.

Create Enrollment Rule

Creates a new enrollment rule for a plan.

POST https://api.getlumen.dev/v1/enrollment/rules

Request Body

{
  "planId": "plan_123",
  "matcherType": "domain",
  "matcherValue": "example.com"
}

Delete Enrollment Rule

Soft deletes an enrollment rule.

DELETE https://api.getlumen.dev/v1/enrollment/rules/{id}

Enroll User

Enrolls a user, creating a subscription for them based on the first matching enrollment rule. If no rules match, it may fall back to creating a free subscription.

POST https://api.getlumen.dev/v1/enrollment/enroll

Request Body

{
  "customerEmail": "user@example.com",
  "customerName": "John Doe",
  "userId": "user_ext_123"
}