FreshLearn API Reference

This article explains how to use Freshlearn APIs

The FreshLearn API is based around REST. We return JSON for every request.

This is unique API key which you will use in the API’s .


Authentication


To start using the FreshLearn API, You have to login to your Admin account and go to Settings -> User and click on your user. You will find the API Key.


API Methods


FreshLearn API lets you send the information about member and course enrollment related details seamlessly.


Get Member


GET/integration/member

Retrieve all of the existing member for the authenticated user.

https://api.freshlearn.com/v1/integration/member

Header Parameters

KeyValue
api-keyThis is the request header parameter, unique key assigned in your admin settings.
cURL example
curl -X GET --header 'Accept: application/json' --header 'api-key: ffec555c3fc0a0882f2720weewew'' ‘https://api.freshlearn.com/v1/integration/member' }
Example Response: 200 OK
{
"id": 39744,
"fullName": "Rahul Mehta",
"email": "rahul.mehta@freshlms.com",
"phone": "9898121211",
"city": "Hyderabad",
"source": "Zapier",
"message": "Member created successfully ",
"createdDate": "2021-04-27"
}
{
"id": 39745,
"fullName": "Manisha Mehta",
"email": "manisha.mehta@freshlms.com",
"phone": "9898121211",
"city": "Hyderabad",
"source": "Zapier",
"message": "Member created successfully ",
"createdDate": "2021-04-27"
}


Create Member


POST/integration/member

Adds a New Member

https://api.freshlearn.com/v1/integration/member

Header Parameters

KeyValue
api-keyThis is the request header parameter, unique key assigned in your admin settings.

Request Parameters:

In each POST Request body following parameters need to be sent in JSON

emailMandatory, Member’s email address
fullNameMandatory, Member’s full name
phoneMember’s Phone Number
cityMember’s city of residence
sourceMandatory, Zapier/FreshLearn/etc
cURL example
curl -X POST \
https://api.freshlearn.com/v1/integration/member \
-H 'api-key: ffec555c3fc0a0882f2720weewew' \
-H 'content-type: application/json' \
-d '{{'{'} "email": "john@gmail.com","fullName": "John Sculley",
"phone": "0113452310", "city": "Seattle", "source": "Zapier’
}
Example Request
{
"email": "john@gmail.com",
"fullName": "John Sculley",
"phone": "0113452310",
"city": "Seattle",
"source": "Zapier"
}
Example Response: 201 Created
{
"id": 39744,
"fullName": "John Sculley",
"email": "john@gmail.com",
"phone": "0113452310",
"city": "Seattle",
"source": "Zapier",
"message": "Member created successfully ",
"createdDate": "2021-04-27"
}


Update Member


PUT/integration/member/update

Update member information based on registered email

https://api.freshlearn.com/v1/integration/member/update

Header Parameters:

KeyValue
api-keyThis is the request header parameter, unique key assigned in your admin settings.

Request Parameters:

In each PUT Request body following parameters need to be sent in JSON

emailMandatory, Member’s email address, (email can not be modified)
fullNameMandatory, Member’s full name
phoneMember’s Phone Number
cityMember’s city of residence
sourceMandatory, Zapier/FreshLearn/etc
cURL example

curl -X PUT \
https://api.freshlearn.com/v1/integration/member/update \
-H 'api-key: ffec555c3fc0a0882f2720weewew' \
-H 'content-type: application/json' \
-d '{ "email": "john@gmail.com","fullName": "John Sculley",
"phone": "0113452310", "city": "Seattle", "source": "Zapier’
}'

Example Request
{
"email": "john@gmail.com",
"fullName": "John Sculley",
"phone": "0113452310",
"city": "Seattle",
"source": "Zapier"
}
Example Response: 200 OK
{
"id": 39744,
"fullName": "John Sculley",
"email": "john@gmail.com",
"phone": "0113452310",
"city": "Seattle",
"source": "Zapier",
"message": "Member created successfully ",
"createdDate": "2021-04-27"
}


Enroll Member


POST/integration/member/enroll

Enroll existing member in a course

https://api.freshlearn.com/v1/integration/member/enroll

Parameters:

KeyValue
api-keyThis is the request header parameter, unique key assigned in your admin settings.

Request Parameters:

In each POST Request body following parameters need to be sent in JSON

courseIdMandatory, Course unique identifier from Admin Portal.You will find this under the course name. See here
planIdMandatory, You will find this against the course -> pricing.
memberEmailMandatory, Member’s Email Address,
paymentGatewaySTRIPE/RAZORPAY/PAYPAL/MANUAL/FREE
paymentTypeCHEQUE/ONLINE/CASH/GIFT/RECURRING/OTHER
referenceReferences if any for enrollment
transactionDatePayment transaction date in ‘yyyy-MM-dd’ format
transactionIdMandatory, Payment unique identifier for the enrollment
sourceMandatory, Zapier/FreshLearn/etc
cURL example

curl -X POST \
https://api.freshlearn.com/v1/integration/member/enroll \
-H 'api-key: ffec555c3fc0a0882f2720weewew' \
-H 'content-type: application/json' \
-d '{ "courseId": 39555,"planId": 40234, "memberEmail":
"john@gmail.com","paymentGateway": "stripe",
"paymentType": "cheque", "reference": "Course Enrollment Fee",
"transactionDate": "2021-01-01","transactionId": "abc_1123345",
"source": "zapier"
}

Example Request

{
"courseId": 39555,
"planId": 40234,
"memberEmail": "john@gmail.com",
"paymentGateway": "stripe",
"paymentType": "cheque",
"reference": "Course Enrollment Fee",
"transactionDate": "2021-01-01",
"transactionId": "abc_1123345",
"source": "zapier"
}

Example Response: 200 OK
{
"enrollmentId": 39745,
"courseId": 39555,
"memberEmail": "john@gmail.com",
"planId": 40234,
"transactionId": "abc_1123345",
"transactionDate": "2021-01-01",
"paymentType": null,
"paymentGateway": null,
"reference": "Course Enrollment Fee",
"source": "zapier",
"createdDate": "2021-04-27"
}


Course Completed Members


GET/integration/member/completed-courses

Course Completed Members

https://api.freshlearn.com/v1/integration/member/completed-courses

Parameters:

KeyValue
api-keyThis is the request header parameter, unique key assigned in your admin settings.
cURL example

curl -X GET \
https://api.freshlearn.com/v1/integration/member/completed-courses \

Here is the sample response

{
"id": 1011804,
"courseId": 157636,
"courseName": "Email Marketing Mastery",
"email": "john.doe@example.com",
"amount": 245,
"planId": 40234,
"planName": "Premium Subscription",
"courseCompletionTime": "2023-12-18",
"createdTime": 1702888189,
"domainId": "57",
"rating": "null",
"courseCompletion": "100",
}


Course Enrollment for New and Existing Members:


POST/integration/member

Enroll Course for New and Existing Members:

https://api.freshlearn.com/v1/integration/member/createMemberAndEnroll

Header Parameters

KeyValue
api-keyThis is the request header parameter, unique key assigned in your admin settings.

Request Parameters:

In each POST Request body following parameters need to be sent in JSON

emailMandatory, Member’s email address
fullNameMandatory, Member’s full name
phoneMember’s Phone Number
cityMember’s city of residence
sourceMandatory, Zapier/FreshLearn/etc
courseIdMandatory, Course unique identifier from Admin Portal.You will find this under the course name. See here
planIdMandatory, You will find this against the course -> pricing.
paymentGatewaySTRIPE/RAZORPAY/PAYPAL/MANUAL/FREE
paymentTypeCHEQUE/ONLINE/CASH/GIFT/RECURRING/OTHER
referenceReferences if any for enrollment
transactionDatePayment transaction date in ‘yyyy-MM-dd’ format
transactionIdMandatory, Payment unique identifier for the enrollment
sourceMandatory, Zapier/FreshLearn/etc
Example Request
{
"fullName": "John D'Souza",
"email": "john@gmail.com",
"phone": "9898121211",
"city": "Toronto",
"state": "Telangana",
"country": "Ontario",
"uidNumber": "Canada",
"createdDate": "2021-04-27",
"description": "Enrolment",
"message": "string",
"courseId": 39555,
"planId": 0,
"paymentGateway": "STRIPE",
"paymentType":"ONLINE",
"reference": "string",
"transactionDate": "2021-04-27",
"transactionId": "543627",
"source": "FreshLearn"
}
Sample Response
{
"enrollmentId": 39745,
"courseId": 39555,
"memberEmail": "john@gmail.com",
"planId": 40234,
"transactionId": "abc_1123345",
"transactionDate": "2021-01-01",
"paymentType": null,
"paymentGateway": null,
"reference": "Course Enrollment Fee",
"source": "zapier",
"createdDate": "2021-04-27"
}


Unenroll Member from a course


POST/integration/member

Unenroll member from a course.

https://api.freshlearn.com/v1/integration/member/unenroll/course

Header Parameters

KeyValue
api-keyThis is the request header parameter, unique key assigned in your admin settings.
Example Request:
{
"courseId": 143698,
"email": "rahul.mehta@freshlms.com",
}
Example Response:
{
"courseId": 143698,
"email": "rahul.mehta@freshlms.com",
"message": "A member has been unenrolled from the course"
}


Product Bundle Enrollment for New and Existing Members:


POST/integration/member

Enroll a New and Existing Member to ProductBundle

https://api.freshlearn.com/v1/integration/member/enroll/productBundle

Header Parameters

KeyValue
api-keyThis is the request header parameter, unique key assigned in your admin settings.

Request Parameters:

In each POST Request body following parameters need to be sent in JSON

emailMandatory, Member’s email address
fullNameMandatory, Member’s full name
phoneMember’s Phone Number
cityMember’s city of residence
sourceMandatory, Zapier/FreshLearn/etc
courseIdMandatory, Course unique identifier from Admin Portal.You will find this under the course name. See here
planIdMandatory, You will find this against the course -> pricing.
paymentGatewaySTRIPE/RAZORPAY/PAYPAL/MANUAL/FREE
paymentTypeCHEQUE/ONLINE/CASH/GIFT/RECURRING/OTHER
referenceReferences if any for enrollment
transactionDatePayment transaction date in ‘yyyy-MM-dd’ format
transactionIdMandatory, Payment unique identifier for the enrollment
sourceMandatory, Zapier/FreshLearn/etc
Example Request
{
"fullName": "John D'Souza",
"email": "john@gmail.com",
"phone": "9898121211",
"city": "Toronto",
"state": "Telangana",
"country": "Ontario",
"uidNumber": "Canada",
"createdDate": "2021-04-27",
"description": "Enrolment",
"message": "string",
"productBundleId": 0,
"planId": 0,
"paymentGateway": "STRIPE",
"paymentType":"ONLINE",
"reference": "string",
"transactionDate": "2021-04-27",
"transactionId": "543627",
"source": "FreshLearn"
}
Sample Response
{
"enrollmentId": 39745,
"productBundleId": 39555,
"memberEmail": "john@gmail.com",
"planId": 40234,
"transactionId": "abc_1123345",
"transactionDate": "2021-01-01",
"paymentType": null,
"paymentGateway": null,
"reference": "Course Enrollment Fee",
"source": "zapier",
"createdDate": "2021-04-27"
}

API Errors

FreshLearn API integration uses HTTP status to indicate the status of the request, Here is the possible response codes

200 OK Success response
201 CREATED when new requested item is created
400 Bad Request you did not provide Mandatory, parameter or wrong data
401 Unauthorized you did not provide a valid api key