DOCS

Connect Moodle

Enable Web Services + REST in Moodle, create a service user + External Service, generate a token, and connect it in Enrollait.

← Back to Documentation Updated: February 10, 2026
What you’ll do

You’ll enable Moodle Web Services + REST, create an External Service and a dedicated integration user, generate a token, then paste the Moodle URL + token into Enrollait.

Key takeaways

  • Use a dedicated integration user (don’t use your personal admin).
  • REST must be enabled, otherwise the token won’t work.
  • Enrollait can enroll students even if a Moodle course is hidden. Students will see the course only after it’s set to Visible/Public.
  • If something fails, start by re-checking Web Services + REST, then permissions.

Requirements

Before connecting Moodle, make sure you have:

  • Admin access to your Moodle site.
  • A Moodle URL (example: https://school.edu/moodle).
  • Permission to create Web Services tokens and manage External Services.

Moodle connection setup

Follow these steps in order. Most setups take ~10 minutes.

Step 1

Enable Web Services

  • Log in to Moodle as an Admin.
  • Go to: Site administration → General → Advanced features.
  • Turn ON “Enable web services”.
  • Click “Save changes”.
Moodle Advanced features screen showing Enable web services
Moodle → Site administration → Advanced features
Note

If you don’t see Web Services options later, return here and confirm this setting is still enabled.

Step 2

Enable the REST protocol

  • Go to: Site administration → Server → Web services → Manage protocols.
  • Make sure “REST protocol” is Enabled.
  • Save changes (if required).
Step 3

Create a dedicated integration user

You can use an admin user, but it’s best to create a dedicated integration user so you can rotate credentials safely.

  • Go to: Site administration → Users → Accounts → Add a new user.
  • Create a user.
  • Click “Create user”.
EXAMPLE
Username: enrollait-user
Email: support@enrollait.com
Password: (set a strong password)
Note

Before continuing, go back to Advanced features and confirm “Enable web services” is still ON.

Step 4

Create an External Service for Enrollait

  • Go to: Site administration → Server → Web services → External services.
  • Click “Add”.
  • Name: Enrollait Service
  • Short name: enrollait
  • Enabled: On
  • Authorised users only: On
  • Click “Add service”.
Step 5

Add the required functions

Open your External Service (Enrollait Service) → Functions → Add functions, then add the functions below.

FUNCTIONS
core_webservice_get_site_info
core_course_get_courses
core_course_get_categories
core_user_get_users
core_user_create_users
core_enrol_get_course_enrolment_methods
enrol_manual_enrol_users
Note

If a function doesn’t show up, Web Services or REST is usually disabled — re-check Step 1 and Step 2.

Step 6

Authorize the user for this service

  • Go to: Site administration → Server → Web services → External services.
  • Open Enrollait Service → Authorised users.
  • Select the user you created: enrollait-user (Enrollait User).
  • Click on Add
Step 7

Grant the right permissions

Most connection failures happen here. The simplest setup is to make the integration user a Site Administrator.

  • Go to: Site administration → Users → Permissions → Site administrators.
  • Click on enrollait-user. (Enrollait User)
  • Click on Add
Note

If your organization can’t grant Site Administrator, you’ll need to manually grant the capabilities required by the functions you enabled.

Step 8

Create a Web Services token

  • Go to: Site administration → Server → Web services → Manage tokens.
  • Click “Create Token”.
  • Name: Enrollait Token
  • User: enrollait-user (Enrollait User)
  • Service: Enrollait Service
  • Disable expiration date.
  • Click “Save changes”.
Note

Moodle will generate a token (example: 3b8f2c…). Copy it immediately and store it safely.

Next

Connect Moodle inside Enrollait

  • In Enrollait Admin, go to: Admin → Integrations → Moodle.
  • Paste: Moodle URL + Moodle Token.
  • Paste Moodle URL in Moodle Site URL
  • Paste Moodle Token in Web Service Token
  • Click “Test connection”, if it works then “Save”.
  • Continue to “Sync Courses & Categories”.
EXAMPLE

    Moodle URL: https://your-moodle.com
    Moodle Token: 3b8f2c…
    
After

Sync courses and categories

Click “Sync courses & categories” to pull your Moodle categories and courses into Enrollait.

Sync can be run again any time if you add new courses or change category structure.

Note

Enrollait can enroll students even if the course is hidden in Moodle. Students will only see the course in their Moodle dashboard once the course is set to Visible/Public.

Troubleshooting

“Access denied” or “Missing capability”
  • Confirm enrollait-user is a Site administrator (Step 7).
  • Confirm your External Service includes the required functions (Step 5).
“REST is disabled” / requests fail
  • Re-check: Manage protocols → REST protocol enabled (Step 2).
“Token invalid”
  • Recreate the token and confirm it was created for:
  • User: enrollait-user
  • Service: Enrollait Service