Submit a ticket My Tickets
Welcome
Login  Sign up
Open navigation

LearnWorlds API Documentation

In this article, you will be able to see the updated LearnWorlds API endpoints to help you scale your usage on the platform (available for our Learning Center plans or higher). 

Ιntroduction

You can use our API to get information on a number of entities, such as courses, user info, bundles, subscriptions, promotions, payments, certifications, and many more. 


You can find our detailed API documentation (including examples), here.

Authentication

Learnworlds uses OAuth2 to allow access to its API. You may request credentials to start using the API via your School (under My Account → Premium Members). Kindly note that Learnworlds expects the Access Token to be included in all API requests to the server in a header.


  • Client credentials grant
The client’s credentials are used to authenticate a request for an access token. This grant should only be allowed to be used by trusted clients. It is suitable for machine-to-machine authentication, for example for use in a cron job that is performing maintenance tasks over an API. Another example would be a client making requests to an API that doesn’t require the user’s permission. Keep this access_token a secret.


  • Resource owner credentials grant
When this grant is implemented the client itself will ask the user for their username and password (as opposed to being redirected to an IdP authorization server to authenticate) and then send these to the authorization server along with the client’s own credentials. If the authentication is successful then the client will be issued with an access token. This grant is suitable for trusted clients such as a service’s own mobile client (for example Spotify’s iOS app). 
By sending the user's username and password to your server and then adding the client_id/client_secret & grant to the request before forwarding it to us, you are able to achieve this.


  • Refresh Token grant

As you might have noticed, when using the Resource owner credentials grant you also get a refresh token. When the access token expires instead of sending the user back through the authorization code grant the client can use the refresh token to retrieve a new access token with the same permissions as the old one.


Note: We recommend using a proxy for both requests, as not to expose your client_secret.

Single Sign-on

It redirects users from your website/application to your LearnWorlds and seamlessly logs them in with the same email address they used to sign up for your original website/application. If no account with that email address exists yet, one is created. There is no need to synchronize any customer databases. 


You can find more information on implementing a) SSO with a User's Email or User ID and b) SSO with a User's Access Token here.


Note: The API URL api.learnworlds.com in our API documentation is used as an example. Make sure to submit a request for your API Keys and use the API URL that will be provided to you by our support team to make the calls on the backend.

Endpoints

Existing and legacy API calls will remain intact, so no existing setup is expected to break, although we do recommend using our updated endpoints. You can also find the documentation of the previous version here.


Affiliates

  • Create an affiliate: This endpoint makes a user, specified by the provided user ID, an affiliate. 

  • Get affiliates: This endpoint returns a list with all the affiliates of the school.            

  • Get all customers per affiliate: This endpoint retrieves all the customers connected with the affiliate specified by the provided affiliate ID. 

  • Get all leads per affiliate: This endpoint retrieves all the leads connected with the affiliate specified by the provided affiliate ID.

  • Get affiliate payments: This endpoint returns a list with all the affiliate payments. 

  • Get completed affiliate payouts: This endpoint returns a list with all the completed payouts related to the provided affiliate. 

  • Get due affiliate payouts: This endpoint returns the due payouts related to the provided affiliate. 

  • Get upcoming affiliate payouts: This endpoint returns the upcoming payouts related to the provided affiliate. 

Bundles

  • Get all bundles: This endpoint returns a list of all bundles of the school. 


  • Get bundle: This endpoint returns the bundle specified by the provided bundle ID.

Certificates

  • Get certificates: This endpoint returns a list with certificates.


  • Delete a certificate (Revoke/Invalidate)This endpoint deletes the certificate specified by the provided certificate ID.


  • Update a certificate (Reissue): This endpoint updates the certificate specified by the provided certificate ID.

Courses / Learning units / Assessments

  • Create a course: This endpoint creates a new course 


  • Get all courses: This endpoint returns a list of all courses of the school. 


  • Get a course: This endpoint returns information about the course specified by the provided course ID.


  • Update a course: This endpoint updates the course specified by the provided course ID.


  • Get analytics for a course: This endpoint returns analytics about the course specified by the provided course ID.

 

  • Get contents of a course: This endpoint returns the contents of the course specified by the provided course ID.


  • Create course section: This endpoint creates a new course section, specified by the course ID.


  • Get analytics for a learning unit: This endpoint returns analytics about a learning unit of a course, specified by the provided course ID and unit ID. 


  • Get all users per course: This endpoint retrieves all the users enrolled in the course specified by the provided course ID. 

  • Get course grades: This endpoint retrieves the grades of all enrolled users in the course specified by the provided course id. 


  • Get assessment responses: This endpoint retrieves all the responses a user has submitted in an assessment, with the most recent submission appearing first, specified by the id of the assessment (Unique identifier of the assessment learning activity).

Installments

  • Get active installments: This endpoint returns a list with active installments of users. 

Leads

  • Get leads: This endpoint returns a list with all the leads of the school. 

Payments

  • Get all payments: This endpoint returns a list with all the payments.

 

  • Get payment: This endpoint returns information about the payment specified by the provided payment ID.

 

  • Get invoice link per payment: This endpoint returns the invoice number and a private expiring link to access the invoice. 

Promotions

  • Get promotions: This endpoint returns a list with all the promotions of the school.

 

  • Get a promotion: This endpoint returns the promotion specified by the provided promotion ID. 

 

  • Create coupons in a promotion (Bulk): This endpoint bulk creates coupons in a promotion.

 

  • Create a coupon in a promotion: This endpoint creates a coupon for the promotion specified by the provided promotion ID. 

  • Get promotions coupons: This endpoint returns all coupons for the promotion specified by the provided promotion ID.

 

  • Get coupon usage: This endpoint returns information about the coupon specified by the provided promotion ID and coupon code. 

 

  • Create a promotion: This endpoint creates a new promotion without coupons.

School events

  • Get school events: This endpoint returns all the upcoming scheduled school events, regarding course drip-feed, file assignment, and live session.


  • Get event logs: This endpoint returns a list with all event logs of the school. 

Subscriptions

  • Get a list of subscription plans: This endpoint returns a list of all subscription plans. 


  • Get subscription plan: This endpoint returns the subscription plan specified by the provided subscription plan ID.


  • Get users subscriptions: This endpoint returns a list with the user subscriptions.

User

  • Get products of user: This endpoint returns a list with all the products of the user specified by the provided user ID.


  • Create a user: This endpoint creates a new user. 


  • Get all users: This endpoint returns a list with all the users of the school.


  • Get a user: This endpoint returns the user specified by the provided user ID.


  • Update a user: This endpoint updates user information.


  • Get courses (enrollments) of user: This endpoint returns a list with all course enrollment data of the specified user.


  • Get user progress per course: This endpoint returns information about the user progress for the user and course specified by the provided user ID and course ID. 


  • Get user progress: This endpoint returns information about the user progress, for the user specified by the provided user id, for all courses the user is enrolled in. 


  • Enroll user to product: This endpoint enrolls user to product (course, bundle, manual subscription).


  • Unenroll user from product: This endpoint unenrolls users from a product.


  • Update user tags: This endpoint updates the tags of the user specified by the provided user ID or email.


  • Suspend a user: This endpoint suspends a user from logging in or creating another account. 


  • Unsuspend user: This endpoint unsuspends a user.


  • Get users by product: This endpoint retrieves all the users with access to the product specified by the provided product ID. 


  • Get users by segment: This endpoint retrieves all the users in the segment specified by the provided segment ID.


  • Get user segments: This endpoint returns a list of all user segments in the school.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.