Application Programming Interface (APIs) is an interface that allows one application to communicate with another via commands designed by programmers. APIs, either public or private, serve as instruction booklets that allow different systems to communicate using predefined commands
This article provides a list of the 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. |
Ensure that you're utilizing the latest version of the LearnWorlds API, as version 1 is no longer supported. Our API documentation extensively covers the current version, enabling you to access the latest features and functionalities.
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
- POST https://api.learnworlds.com/v2/courses
- Get all courses: This endpoint returns a list of all courses of the school.
- GET https://api.learnworlds.com/v2/courses
- Get a course: This endpoint returns information about the course specified by the provided course ID.
- GET https://api.learnworlds.com/v2/courses/{id}
- Update a course: This endpoint updates the course specified by the provided course ID.
- PUT https://api.learnworlds.com/v2/courses/{id}
- Get contents of a course: This endpoint returns the contents of the course specified by the provided course ID.
- GET https://api.learnworlds.com/v2/courses/{id}/contents
- Create course section: This endpoint creates a new course section specified by the course ID.
- POST https://api.learnworlds.com/v2/courses/{id}/sections
- Get all users per course: This endpoint retrieves all the users enrolled in the course specified by the provided course ID.
- GET https://api.learnworlds.com/v2/courses/{id}/users
- Get course grades: This endpoint retrieves the grades of all enrolled users in the course specified by the provided course id.
- GET https://api.learnworlds.com/v2/courses/{id}/grades
Reporting
- Get analytics for a course: This endpoint returns analytics about the course specified by the provided course ID.
- GET https://api.learnworlds.com/v2/courses/{id}/analytics
- 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 https://api.learnworlds.com/v2/courses/{id}/units/{uid}/analytics
- 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 https://api.learnworlds.com/v2/users/{id}/courses/{cid}/progress
- 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.
- GET https://api.learnworlds.com/v2/users/{id}/progress
Bundles
- Get all bundles: This endpoint returns a list of all bundles of the school.
- GET https://api.learnworlds.com/v2/bundles
- Get bundle: This endpoint returns the bundle specified by the provided bundle ID.
- GET https://api.learnworlds.com/v2/bundles/{id}
Subscription plans
- Get a list of subscription plans: This endpoint returns a list of all subscription plans.
- GET https://api.learnworlds.com/v2/subscription-plans
- Get subscription plan: This endpoint returns the subscription plan specified by the provided subscription plan ID.
- GET https://api.learnworlds.com/v2/subscription-plans/{id}
User Subscriptions
- Get users subscriptions: This endpoint returns a list with the user subscriptions.
- GET https://api.learnworlds.com/v2/user-subscriptions
Installments
- Get active installments: This endpoint returns a list of active installments of users.
- GET https://api.learnworlds.com/v2/installments/active
Calendar
- Get school events: This endpoint returns all the upcoming scheduled school events regarding course drip-feed, file assignments, and live sessions.
- GET https://api.learnworlds.com/v2/school/events
User
- Get products of user: This endpoint returns a list with all the products of the user specified by the provided user ID.
- GET https://api.learnworlds.com/v2/users/{id}/products
- Create a user: This endpoint creates a new user.
- POST https://api.learnworlds.com/v2/users
- Get all users: This endpoint returns a list of all the users of the school.
- GET https://api.learnworlds.com/v2/users
- Get a user: This endpoint returns the user specified by the provided user ID.
- GET https://api.learnworlds.com/v2/users/{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 https://api.learnworlds.com/v2/users/{id}/courses
- Enroll user to product: This endpoint enrolls user to product (course, bundle, manual subscription).
- POST https://api.learnworlds.com/v2/users/{id}/enrollment
- Unenroll user from product: This endpoint unenrolls users from a product.
- DELETE https://api.learnworlds.com/v2/users/{id}/enrollment
- Update user tags: This endpoint updates the tags of the user specified by the provided user ID or email.
- PUT https://api.learnworlds.com/v2/users/{id}/tags
- Suspend a user: This endpoint suspends a user from logging in or creating another account.
- PUT https://api.learnworlds.com/v2/users/{id}/suspend
- Unsuspend user: This endpoint unsuspends a user.
- PUT https://api.learnworlds.com/v2/users/{id}/unsuspend
- 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.
- Mark as complete: Marks the progress of a user on course or learning activity level as complete.
- Reset user progress: Resets the user’s progress on a course or learning activity level.
Payments
- Get all payments: This endpoint returns a list with all the payments.
- GET https://api.learnworlds.com/v2/payments
- Get payment: This endpoint returns information about the payment specified by the provided payment ID.
- GET https://api.learnworlds.com/v2/payments/{id}
- Get invoice link per payment: This endpoint returns the invoice number and a private expiring link to access the invoice.
- GET https://api.learnworlds.com/v2/payments/{id}/invoice-link
Leads
- Get leads: This endpoint returns a list with all the leads of the school.
- GET https://api.learnworlds.com/v2/leads
Promotions
- Get promotions: This endpoint returns a list with all the promotions of the school.
- GET https://api.learnworlds.com/v2/promotions
- Get a promotion: This endpoint returns the promotion specified by the provided promotion ID.
- GET https://api.learnworlds.com/v2/promotions/{id}
- Create coupons in a promotion (Bulk): This endpoint bulk creates coupons in a promotion.
- POST https://api.learnworlds.com/v2/promotions/{id}/coupons-bulk
- Create a coupon in a promotion: This endpoint creates a course coupon for the promotion specified by the provided promotion ID.
- POST https://api.learnworlds.com/v2/promotions/{pid}/coupons
- Get promotions coupons: This endpoint returns all coupons for the promotion specified by the provided promotion ID.
- GET https://api.learnworlds.com/v2/promotions/{pid}/coupons
- Get coupon usage: This endpoint returns information about the coupon specified by the provided promotion ID and coupon code.
- GET https://api.learnworlds.com/v2/promotions/{pid}/coupons/{cid}/usage
- Create a promotion: This endpoint creates a new promotion without coupons.
- POST https://api.learnworlds.com/v2/promotions
Affiliates
- Create an affiliate: This endpoint makes a user, specified by the provided user ID, an affiliate.
- POST https://api.learnworlds.com/v2/affiliates/{id}
- Get affiliates: This endpoint returns a list of all the school's affiliates.
- GET https://api.learnworlds.com/v2/affiliates
- Get all customers per affiliate: This endpoint retrieves all the customers connected with the affiliate specified by the provided affiliate ID.
- GET https://api.learnworlds.com/v2/affiliates/{id}/customers
- Get all leads per affiliate: This endpoint retrieves all the leads connected with the affiliate specified by the provided affiliate ID.
- GET https://api.learnworlds.com/v2/affiliates/{id}/leads
- Get affiliate payments: This endpoint returns a list with all the affiliate payments.
- GET https://api.learnworlds.com/v2/affiliates/{id}/payments
- Get completed affiliate payouts: This endpoint returns a list with all the completed payouts related to the provided affiliate.
- GET https://api.learnworlds.com/v2/affiliates/{id}/payouts/completed
- Get due affiliate payouts: This endpoint returns the due payouts related to the provided affiliate.
- GET https://api.learnworlds.com/v2/affiliates/{id}/payouts/due
- Get upcoming affiliate payouts: This endpoint returns the upcoming payouts related to the provided affiliate.
- GET https://api.learnworlds.com/v2/affiliates/{id}/payouts/upcoming
Certificates
- Get certificates: This endpoint returns a list with certificates.
- GET https://api.learnworlds.com/v2/certificates
- Delete a certificate (Revoke/Invalidate): This endpoint deletes the certificate specified by the provided certificate ID.
- DELETE https://api.learnworlds.com/v2/certificates/{id}
- Update a certificate (Reissue): This endpoint updates the certificate specified by the provided certificate ID.
- PUT https://api.learnworlds.com/v2/certificates/{id}
Events logs
- Get event logs: This endpoint returns a list with all event logs of the school.
- GET https://api.learnworlds.com/v2/event-logs
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.
- GET https://api.learnworlds.com/v2/seats
- Create a seat offering: Creates a new seat offering. The endpoint response is the created Seat offering resource.
- POST https://api.learnworlds.com/v2/seats
- Get a specific seat offering: Returns the seat offering specified by the provided seat offering id.
- GET https://api.learnworlds.com/v2/seats/{id}
- Update a seat offering: Updates a seat offering. The endpoint response is the updated seat offering resource.
- PUT https://api.learnworlds.com/v2/seats/{id}
- Add a user to a seat offering: Add a user to a seat offering.
- Remove a user from a seat and a seat offering: Removes use from a seat and a seat offering
User Groups
- Get all user groups: Returns a list of all user groups of the school. The user groups 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.
- GET https://api.learnworlds.com/v2/user_groups
- Create a user group: Creates a new user group. The endpoint response is the created user group resource.
- POST https://api.learnworlds.com/v2/user_groups
- Get a user group: Returns the seat offering specified by the provided seat offering id.
- GET https://api.learnworlds.com/v2/user_groups/{id}
- Update a user group: Updates a user group. The endpoint response is the updated user group resource.
- PUT https://api.learnworlds.com/v2/user_groups/{id}
- Add a user to a user group: Add a user to a user group.
- POST https://api.learnworlds.com/v2/user_groups/{id}/users/{uid}-copy
- Remove a user from a user group: Removes a user from a user group
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.
- Get user role of a user: This endpoint returns the user role of the user specified by the provided user id.
- Update user role of a user: This endpoint updates the user role of the user specified by the provided user id.
Community
- Get all community collections: This endpoint returns a list of all community collections of the school. The community collections are in sorted order, with the oldest created collections appearing first
- Get community spaces: This endpoint returns a list of all community spaces of the school. The community spaces are in sorted order, with the oldest created spaces appearing first
- GET https://api.learnworlds.com/v2/community/spaces
- Create community space: This endpoint creates a community space. The endpoint response is the created community Space resource.
- POST https://api.learnworlds.com/v2/community/spaces
- Get a community space: This endpoint returns information about the community space specified by the provided space id.
- GET https://api.learnworlds.com/v2/community/spaces/{id}
- Update a community space: This endpoint updates the community space specified by the provided space ID. The endpoint response is the updated community space resource.
- PUT https://api.learnworlds.com/v2/community/spaces/{id}
- Delete a community space: This endpoint deletes the community space specified by the provided space ID.
- DELETE https://api.learnworlds.com /v2/community/spaces/{id}
- Get users of a community space: This endpoint returns a list of all the users of the space. The users are in sorted order, with the oldest created user appearing first, and the list is paginated, with a default limit of 10 users per page.
- GET https://api.learnworlds.com/v2/community/spaces/{id}/users
- Add/Invite users to a community space: This endpoint adds or invites users to a space. If space has the is_invitation_required property set to true then users will be sent an invitation in their inbox to join, otherwise they will be directly added. Returns an array of the affected users, if the user is already in space, the user will not be returned.
- POST https://api.learnworlds.com/v2/community/spaces/{id}/users
- Remove a user from a community space: This endpoint removes the user specified by the provided user ID from the provided space ID.
- DELETE https://api.learnworlds.com/v2/community/spaces/{id}/users/{uid}
- Get community posts: This endpoint returns a list with all the posts of the school community. The posts are in sorted order, with the most recently created post appearing first, and the list is paginated, with a default limit of 10 posts per page. To refine the list of posts, there are a number of query params outlined in the following section; In case more than one Query param is provided, then all of them will be applied (AND operator).
- GET https://api.learnworlds.com/v2/community/posts
- Get a community post: This endpoint returns information about the community post specified by the provided post ID.
- GET https://api.learnworlds.com/v2/community/posts/{id}