In this article, you will be able to see the updated LearnWorlds API endpoints to help you scale your usage on the platform.
You can use our API to get information on a number of entities, such as courses, user info, bundles, subscriptions, promotions, payments, certifications, and 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 use the API via your School (under Settings → Developers → API). 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 performs maintenance tasks over an API. Another example would be a client requesting 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 an access token. This grant is suitable for trusted clients such as a service’s own mobile client (for example, Spotify’s iOS app).
- 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.
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.
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.
Courses
- 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 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 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.
Reporting
- Get analytics for a course: This endpoint returns analytics about the course specified by the provided 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 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.
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.
Subscription plans
- 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.
User Subscriptions
- Get users subscriptions: This endpoint returns a list with the user subscriptions.
Installments
- Get active installments: This endpoint returns a list of active installments of users.
Calendar
- Get school events: This endpoint returns all the upcoming scheduled school events regarding course drip-feed, file assignments, and live sessions.
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 of 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.
- 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.
- Update user progress: Updates the progress of a user on course or learning activity level.
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.
Leads
- Get leads: This endpoint returns a list with all the leads of the school.
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 course 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.
Affiliates
- Create an affiliate: This endpoint makes a user, specified by the provided user ID, an affiliate.
- Get affiliates: This endpoint returns a list of all the school's affiliates.
- 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.
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.
Events logs
- Get event logs: This endpoint returns a list with all event logs of the school.
Assessments
- Get assessment responses: Retrieves all the responses a user has submitted in an assessment, with the most recent submission appearing first. The list is paginated with a limit of 20 responses per page (id=Unique identifier of the assessment learning activity)
Multiple Seats
- Get all seat offerings: Returns a list of all seat offerings of the school. The seat offerings are in sorted order, with the most recently created appearing first, and the list is paginated, with a default limit of 20 users per page.
- Create a seat offering: Creates a new seat offering. The endpoint response is the created Seat offering resource.
- Get a specific seat offering: Returns the seat offering specified by the provided seat offering id.
- Update a seat offering: Updates a seat offering. The endpoint response is the updated seat offering resource.
- Add a user to a seat offering: Add a user to a seat offering.
User Roles
- Get all users roles: This endpoint returns a list with all the user roles of the school. The roles are in alphabetical ascending order according to their title.