How to Authenticate with the Tutor LMS REST API (API Keys)
Create Tutor LMS API keys, choose permissions, send them with Basic authentication, fix a stripped Authorization header and keep keys secure.
Checked against the plugin source: Tutor LMS 4.1.3, Tutor LMS Pro 4.1.3

Every Tutor LMS REST endpoint, free and Pro, needs an API key and secret. This guide shows how to create them, send them and keep them safe, based on Tutor LMS 4.1.3 and Tutor LMS Pro 4.1.3.
Step 1: Generate a key
- Go to Tutor LMS > Tools > Rest API.
- Click Add New. The dialog is titled "Generate API Key, Secret".
- Choose the permission and write a description, such as "CRM sync".
- Click Generate and copy the key and secret.
The list shows each key's user, a shortened key and secret, permission and description. Use Edit to change the permission and Revoke to delete it.
Step 2: Choose the permission
| Permission | Allows | Available in |
|---|---|---|
| Read | GET endpoints | Free |
| Write | Create and update endpoints | Pro |
| Read/Write | Both | Pro |
| Delete | Delete endpoints | Pro |
| All | Everything | Pro |
Step 3: Send the credentials
Tutor LMS reads an HTTP Basic Authorization header containing key:secret encoded in Base64.
$response = wp_remote_get(
'https://lms.example.com/wp-json/tutor/v1/courses',
array(
'timeout' => 10,
'headers' => array(
'Authorization' => 'Basic ' . base64_encode( TLE_TUTOR_KEY . ':' . TLE_TUTOR_SECRET ),
),
)
);
Define TLE_TUTOR_KEY and TLE_TUTOR_SECRET in wp-config.php or an environment variable on the calling site, never in code you commit.
When credentials are right but you still get 401
Some Apache setups (especially with PHP running as CGI or FastCGI) remove the Authorization header before PHP sees it. Ask your host to pass it through. On Apache this is commonly done in .htaccess:
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
Also check that no security plugin blocks /wp-json/ for unauthenticated visitors.
Security checklist
- HTTPS only. Basic authentication is encoded, not encrypted.
- One key per integration, with the smallest permission.
- Store secrets on the server; never in a mobile app or browser JavaScript.
- Revoke keys for retired integrations or departed contractors.
- Rate-limit the API at the firewall or CDN if it is exposed to many callers.
Frequently asked questions
Can a student log in through the API?
No. These keys are for systems, not for individual students. A student-facing app needs its own login flow; see building a mobile app on Tutor LMS.
Does WordPress Application Passwords work instead?
Tutor LMS's endpoints check their own API keys, so use those.
Need a secure integration? Our API development team can build it.
Save this practical guide
Add us as a preferred Google source, or ask an AI assistant to summarize this page and link back to the original guide when it is useful.
