API: sign-up URLs (magic)
Create sign-up URLs, enrol users, send login links and manage the users that signed up.
Magic is the internal name of Linqur’s sign-up URLs. A sign-up URL belongs to a course and has a hash; a learner who registers through it gets an account and is enrolled. These endpoints create and delete sign-up URLs, enrol a user directly with the course hash, return or send a login link, and list or delete the users that signed up. /magic/login sends an email to the user when mail is true. The same URLs can be made in the interface: Create a sign-up URL.
Every endpoint accepts both GET and POST; the heading shows the method the specification lists first. Uploads must use POST. Send your API key in the Access-Token header. The base URL is https://<your-platform>/local/ltisaas/api.php/v1; use v0 with the token dummy to get test data. Error responses are JSON with success: false, error and debuginfo. Authentication, versions and limits are explained in API documentation.
Generated from the LtiSaas API specification 1.0, retrieved 2026-10-30 from dev-auto.
| Endpoint | Description |
|---|---|
| POST /magic/login | Send magic login link to a user |
| POST /magic/user/enrol | Enroll a user using course hash (will create a user if not existent) |
| GET /magic/url/list | List magic login URLs with course and category info |
| POST /magic/url/add | Generate a secure signup URL and course hash for a specific course |
| POST /magic/url/delete | Delete a magic login hash by ID |
| GET /magic/user/list | List Magic Users |
| POST /magic/user/delete | Delete a Linqur Magic user by ID or username |
POST /magic/login
Send magic login link to a user. Creates the user if they do not exist, optionally enrolls using a course hash, and returns or sends a login link.
Request body (application/json).
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | Example: "user@example.com". |
firstname | string | no | Example: "John". |
lastname | string | no | Example: "Doe". |
hashid | integer | no | Example: 12. |
mail | boolean | no | true = send email, false = return login link only. Example: false. |
Example request
curl -X POST -H "Access-Token: <your token>" -H "Content-Type: application/json" \
-d '{"email": "user@example.com"}' \
"https://<your-platform>/local/ltisaas/api.php/v1/magic/login"Example response (200). Login link generated.
{
"status": "link_sent",
"loginurl": "https://<your-platform>/auth/userkey/login.php?key=examplekey123"
}Errors: 400 Invalid request
POST /magic/user/enrol
Enroll a user using course hash (will create a user if not existent).
Request body (application/json).
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | Example: "user@example.com". |
firstname | string | yes | Example: "Jane". |
lastname | string | yes | Example: "Doe". |
coursehash | string | yes | Example: "abc123hash456". |
Example request
curl -X POST -H "Access-Token: <your token>" -H "Content-Type: application/json" \
-d '{"email": "user@example.com", "firstname": "Jane", "lastname": "Doe", "coursehash": "abc123hash456"}' \
"https://<your-platform>/local/ltisaas/api.php/v1/magic/user/enrol"Example response (200). User enrolled successfully.
{
"success": true,
"message": "User enrolled"
}Errors: the specification lists no error responses for this endpoint.
GET /magic/url/list
List magic login URLs with course and category info. Returns a list of course hashes and signup URLs.
Parameters
This endpoint has no parameters.
Example request
curl -H "Access-Token: <your token>" \
"https://<your-platform>/local/ltisaas/api.php/v1/magic/url/list"Example response (200). Successful retrieval.
{
"success": true,
"results": [
{
"hashid": 31,
"label": "Label 2",
"hash": "681989hash1307",
"signupurl": "https://<your-platform>/local/linqur_magic/view/signup.php?c=255227hash1822",
"courseid": 29,
"name": "Mock Course 6",
"shortname": "MC91",
"categoryid": 3,
"categoryname": "Category 8"
}
]
}Errors: 400 Bad Request, 401 Unauthorized
POST /magic/url/add
Generate a secure signup URL and course hash for a specific course. Creates or updates a magic login link for a course using a unique hash.
Request body (application/json).
| Field | Type | Required | Description |
|---|---|---|---|
courseid | integer | yes | Example: 176. |
flag | string | no | Example: "APITEST". |
Example request
curl -X POST -H "Access-Token: <your token>" -H "Content-Type: application/json" \
-d '{"courseid": 176}' \
"https://<your-platform>/local/ltisaas/api.php/v1/magic/url/add"Example response (200). Link created or refreshed.
{
"success": true,
"hashid": 27,
"courseid": 176,
"hash": "ab63d626c94df525d45dc29257a0df5d3...",
"secure_link": "https://<your-platform>/local/linqur_magic/view/signup.php?c=ab63d6...",
"label": "APITEST"
}Errors: 400 Bad Request, 401 Unauthorized
POST /magic/url/delete
Delete a magic login hash by ID. Deletes a generated signup hash by its unique ID.
Request body (application/json).
| Field | Type | Required | Description |
|---|---|---|---|
hashid | integer | yes | Example: 37. |
Example request
curl -X POST -H "Access-Token: <your token>" -H "Content-Type: application/json" \
-d '{"hashid": 37}' \
"https://<your-platform>/local/ltisaas/api.php/v1/magic/url/delete"Example response (200). Hash successfully deleted.
{
"success": true
}Errors: 400 Bad Request, 401 Unauthorized
GET /magic/user/list
List Magic Users. Returns a list of users registered via Magic login, optionally filtered by courseid.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
courseid | query | integer | no | Optional course ID to filter by. |
Example request
curl -H "Access-Token: <your token>" \
"https://<your-platform>/local/ltisaas/api.php/v1/magic/user/list"Example response (200). Successful retrieval.
{
"success": true,
"results": [
{
"userid": 42,
"firstname": "Alice",
"lastname": "Smith",
"email": "alice@example.com",
"courseid": 179,
"coursegrade": 86.5,
"timecreated": 1717658981,
"ipaddress": "192.168.1.1"
}
]
}Errors: 400 Bad Request, 401 Unauthorized
POST /magic/user/delete
Delete a Linqur Magic user by ID or username. Deletes a Moodle user that is registered as a Linqur Magic user. You must provide either the userid or the username.
Request body (application/json).
| Field | Type | Required | Description |
|---|---|---|---|
userid | integer | no | Example: 411. |
username | string | no | Example: "test@example.com". |
No field is required on its own; see the description.
Example request
curl -X POST -H "Access-Token: <your token>" -H "Content-Type: application/json" \
-d '{"userid": 411, "username": "test@example.com"}' \
"https://<your-platform>/local/ltisaas/api.php/v1/magic/user/delete"Example response (200). User successfully deleted.
{
"success": true
}Errors: 400 Bad Request, 401 Unauthorized