Skip to content

API: files

Add, update, list and delete files in the file repository.

The file repository holds files you reuse in courses, such as a SCORM package linked to several activities. These endpoints add a file as base64 content, update its content and metadata, list all tracked files and delete a file. The same actions in the interface: Manage files in the file repository.

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.

EndpointDescription
POST /file/addAdd a new file to the system
POST /file/updateUpdate a file by ID
GET /file/listList all tracked files
POST /file/deleteDelete a file by ID

POST /file/add

Add a new file to the system. Uploads a base64-encoded file and stores metadata in the database.

Request body (application/json).

FieldTypeRequiredDescription
filenamestringyesExample: "report.pdf".
filecontentstringyesExample: "base64-encoded-content".
titlestringnoExample: "Quarterly Report".
referencestringnoExample: "REF-2025".
versionstringnoExample: "1.0".

Example request

curl -X POST -H "Access-Token: <your token>" -H "Content-Type: application/json" \
  -d '{"filename": "report.pdf", "filecontent": "base64-encoded-content"}' \
  "https://<your-platform>/local/ltisaas/api.php/v1/file/add"

Example response (200). File added successfully.

{
  "filesize": 1024,
  "filepath": "/moodledata/repository/api/report.pdf",
  "status": "success",
  "id": 42,
  "filename": "report.pdf"
}

Errors: the specification lists no error responses for this endpoint.

POST /file/update

Update a file by ID. Updates the content and metadata of a file.

Request body (application/json).

FieldTypeRequiredDescription
idintegeryesExample: 42.
filenamestringyesExample: "report.pdf".
filecontentstringyesExample: "base64-encoded-content".
titlestringnoExample: "Quarterly Report".
referencestringnoExample: "REF-2025".
versionstringnoExample: "1.1".

Example request

curl -X POST -H "Access-Token: <your token>" -H "Content-Type: application/json" \
  -d '{"id": 42, "filename": "report.pdf", "filecontent": "base64-encoded-content"}' \
  "https://<your-platform>/local/ltisaas/api.php/v1/file/update"

Example response (200). File updated successfully.

{
  "filesize": 1024,
  "filepath": "/moodledata/repository/api/report.pdf",
  "status": "success",
  "filename": "report.pdf"
}

Errors: the specification lists no error responses for this endpoint.

GET /file/list

List all tracked files. Returns a list of all tracked files in the system.

Parameters

This endpoint has no parameters.

Example request

curl -H "Access-Token: <your token>" \
  "https://<your-platform>/local/ltisaas/api.php/v1/file/list"

Example response (200). List of files.

[
  {
    "id": 1,
    "filename": "demo.pdf",
    "revision": 1,
    "version": "1.0",
    "title": "Quarterly Report",
    "reference": "REF-2025",
    "datecreated": 1700000000,
    "dateupdated": 1700000100
  }
]

Errors: the specification lists no error responses for this endpoint.

POST /file/delete

Delete a file by ID. Deletes a file by its database ID and removes the file from disk.

Request body (application/json).

FieldTypeRequiredDescription
idintegeryesExample: 3.

Example request

curl -X POST -H "Access-Token: <your token>" -H "Content-Type: application/json" \
  -d '{"id": 3}' \
  "https://<your-platform>/local/ltisaas/api.php/v1/file/delete"

Example response (200). Success.

{
  "status": "success"
}

Errors: the specification lists no error responses for this endpoint.

Last updated on