LearnDash icon

LearnDash

Interact with the LearnDash LMS REST API

Actions60

Quizzes → Create

AI-generated

Summary

Create a new quiz in LearnDash by specifying quiz details such as title, content, excerpt, status, slug, and parent course/lesson/topic IDs, or by providing a custom JSON body payload for advanced use cases.

Inputs

  • Quiz Fields — Specify common quiz properties including Title, Content, Excerpt, Status (Draft, Pending, Private, Publish, Trash), Slug, Course ID (parent course), Lesson ID (parent lesson, optional for quizzes), and Topic ID (for quizzes belonging to a topic).
  • Body (JSON) — Provide a raw JSON payload to send in the request body for advanced cases where custom or additional fields are needed beyond the standard Quiz Fields.

Output shape

a single JSON object representing the newly created quiz returned by the LearnDash API

The response contains the created quiz data as returned by the LearnDash REST API. Using the 'Body (JSON)' field overrides or complements the standard quiz fields. Errors in JSON formatting will cause the operation to fail with a descriptive error.

Examples

Example 1: Create a quiz titled 'Sample Quiz' under course ID 123 with status 'publish'.

Set 'Title' to 'Sample Quiz', set 'Course ID' to 123, set 'Status' to 'Publish'. Leave 'Body (JSON)' empty.

Example 2: Create a quiz with custom advanced properties not exposed separately.

Leave Quiz Fields empty and fill the 'Body (JSON)' input with a valid JSON object containing the desired quiz properties.

Discussion