Back

LearnDash API Essential Guide

Aug 14, 20246 minute read

What type of API does LearnDash provide?

Based on the search results provided, LearnDash has a REST API. The key points are:

REST API

LearnDash offers a REST API for developers to interact with LearnDash data programmatically. The API allows access to various LearnDash resources such as courses, lessons, topics, groups, assignments, and user course progress.

API Version

The search results specifically mention "REST API v2", indicating it's the second version of LearnDash's REST API.

API Documentation

LearnDash provides developer documentation for their REST API at developers.learndash.com/rest-api/v2/.

MemberDash Module

There's also mention of a "MemberDash Module Rest API" which can be enabled in the MemberDash settings. This appears to be a separate but related REST API, possibly for integration with a membership plugin.

Key Considerations

  • REST APIs are widely supported and relatively easy to work with for most developers.
  • They use standard HTTP methods and typically return JSON data.
  • REST is a good choice for web and mobile applications interacting with LearnDash data.

Does the LearnDash API have webhooks?

Based on the search results provided, it does not appear that the official LearnDash API has built-in webhook functionality. However, there are a few key points to consider:

  1. LearnDash does offer integration with Zapier, which can be used to create webhook-like functionality:
  • The LearnDash Zapier integration allows you to connect LearnDash with over 1,500 other applications and automate data transfer.
  • It supports various triggers that can be used to initiate actions in other apps, such as:
    • User enrolls into a course
    • User completes a course
    • User completes a lesson/topic
    • User completes/passes/fails a quiz
    • User submits an essay
  1. For direct API access, LearnDash provides an API that can be used to perform various actions:
  • The "Make an API call" module in Zapier can be used to perform any action supported by the LearnDash API.
  • For more information on the LearnDash API, developers can refer to: https://developers.learndash.com/
  1. While not native webhooks, LearnDash does support webhook functionality for certain payment integrations:
  • The Stripe integration for LearnDash uses webhooks to handle payment events.
  • Specific events like customer.subscription.deleted, invoice.payment_failed, invoice.paid, and checkout.session.completed can be configured in the Stripe webhook settings.
  1. For custom implementations, developers may be able to create webhook-like functionality using WordPress hooks and the LearnDash API, but this would require custom development.

In summary, while LearnDash doesn't have a native webhook system built into its API, it does offer integration options (like Zapier) and payment-related webhooks (for Stripe) that can provide similar functionality for many use cases. For more advanced or custom needs, developers would need to work with the LearnDash API directly.

Rate Limits and other limitations

Based on the search results provided, here are the key points about the API rate limits for the LearnDash API:

Rate Limits for Course Users Endpoint

  1. There is a limit of 50 user IDs per request when updating or removing users from a course [1][3].

  2. For listing course users, there is a default pagination of 10 items per page, which can be adjusted using the per_page parameter [1].

General API Limits

The search results do not provide specific information about overall API rate limits for LearnDash. However, some general points to consider are:

  1. The API uses pagination for listing endpoints, with a default of 10 items per page [1][2].

  2. There are various filtering and sorting options available for different endpoints, which can help optimize API usage [1][2].

  3. The API is currently in beta, which means endpoints and parameters may change [1][2].

Key Considerations

  1. When working with course users, be mindful of the 50 user IDs per request limit for updates and removals [1][3].

  2. Use pagination and filtering options to optimize your API requests and avoid unnecessary data transfer [1][2].

  3. As the API is in beta, stay updated on any changes to endpoints or parameters that might affect your implementation [1][2].

It's important to note that the search results do not provide comprehensive information about LearnDash's overall API rate limits. For more detailed and up-to-date information on rate limits, it would be best to consult the official LearnDash API documentation or contact their support directly.

Latest API Version

Based on the information provided, here are the key points regarding the most recent version of the LearnDash API:

Current API Version

The most recent version of the LearnDash API is version 2 (v2) [2].

Key Points

  1. The LearnDash REST API v2 is currently in beta. New endpoints are still being added, and parameters of existing endpoints may change [2].

  2. There are some differences between v1 and v2 of the API. For example, the user has reported an issue with the course users endpoint in v2 returning all users instead of just those enrolled in a specific course, while v1 works as expected [5].

  3. The API v2 endpoints include various resources such as Courses, Lessons, Topics, Questions, Assignments, Groups, and more [2].

Considerations

  1. Since the v2 API is in beta, developers should be prepared for potential changes and updates.

  2. If you encounter issues with v2, you may need to check the documentation or contact LearnDash support for the most up-to-date information on how to use specific endpoints.

  3. It's important to stay updated with LearnDash releases and changelogs, as they may include updates to the API [4].

Best Practices

  1. Always refer to the official LearnDash API documentation for the most accurate and up-to-date information.

  2. When using the API, ensure you're properly authenticated and using the correct endpoints and parameters.

  3. Be prepared to adapt your code as the v2 API evolves, given its beta status.

  4. If you encounter issues specific to v2, consider reporting them to LearnDash or checking their support channels for known issues and workarounds.

In summary, while v2 is the most recent version of the LearnDash API, it's important to be aware of its beta status and potential differences from v1. Developers should stay informed about updates and be prepared to adapt their integrations as needed.

How to get a LearnDash developer account and API Keys?

1. Set up a WordPress site with LearnDash

  • Install and activate the LearnDash LMS plugin on your WordPress site. LearnDash is a WordPress plugin, so you'll need a WordPress site to use it.

2. Enable the WordPress REST API

  • LearnDash uses the WordPress REST API. Make sure the REST API is enabled on your WordPress site.

3. Install the Application Passwords plugin

  • Install and activate the Application Passwords plugin on your WordPress site. This allows you to create API credentials without sharing your main WordPress password.

4. Generate API credentials

  • Go to Users > Your Profile in the WordPress admin
  • Scroll down to the Application Passwords section
  • Enter a name for the application and click "Add New Application Password"
  • This will generate a username and application password to use for API authentication

5. Configure authentication

  • Use the generated username and application password for basic authentication when making API requests
  • The API endpoint URL will be: https://your-site.com/wp-json/ldlms/v1/

6. Review API documentation

  • Check the LearnDash API documentation at https://developers.learndash.com/rest-api/v2/ for available endpoints and methods

Key points:

  • No separate "developer account" is needed - you just need a WordPress site with LearnDash installed
  • Authentication is handled through WordPress application passwords
  • The LearnDash API is an extension of the WordPress REST API
  • Review the API docs to understand available endpoints and data you can access

What can you do with the LearnDash API?

Based on the search results provided, here is a list of data models that can be interacted with using the LearnDash API, along with what is possible for each:

Course Data Model

  • Retrieve course information
  • Create new courses
  • Update existing course details
  • Enroll users in courses
  • Manage course access and enrollment

User Activity Data Model

  • Track user progress in courses, lessons, topics, and quizzes
  • Store activity start and completion timestamps
  • Record activity status (e.g., completed, in progress)
  • Store meta information related to user activities (e.g., scores, points)

Quiz Data Model

  • Retrieve quiz information
  • Create and update quizzes
  • Manage quiz questions and answers
  • Track quiz statistics and user performance

Assignment Data Model

  • Manage assignment submissions
  • Approve or reject assignments
  • Track assignment completion status

Essay Data Model

  • Manage essay submissions
  • Grade and provide feedback on essays

Group Data Model

  • Create and manage groups
  • Enroll users in groups
  • Assign group leaders

Question Data Model

  • Create and manage individual questions
  • Associate questions with quizzes

Lesson and Topic Data Models

  • Retrieve lesson and topic information
  • Create and update lessons and topics
  • Manage lesson/topic order within courses

User Data Model

  • Manage user enrollment in courses and groups
  • Track user progress across various LearnDash components

Product Data Model

  • Manage product information (for courses or groups treated as products)
  • Handle pricing and access settings
  • Check user access to products

Pricing Data Model

  • Manage pricing information for courses or groups
  • Handle different pricing types (e.g., one-time, recurring)
  • Manage trial periods for products

It's important to note that the LearnDash API is built on top of the WordPress REST API, so many of these interactions would be done through WordPress post types and custom fields specific to LearnDash. The API allows for CRUD (Create, Read, Update, Delete) operations on most of these data models, enabling developers to build custom integrations and automate various aspects of course management and user interactions within the LearnDash LMS.