OpenLingu API Reference

Technical documentation for developers

API Endpoints

About This API

This API is built with FastAPI, a modern, fast (high-performance) web framework for building APIs with Python 3.7+ based on standard Python type hints.

Authentication

  • Most endpoints require authentication using a Bearer token
  • Obtain a token by using the /login or /login_contributer endpoints
  • User operations (get/delete) require the token to match the target username
  • Contributor endpoints require a valid contributor token

Authentication

POST
/login
Authenticate and get token
POST
/login_contributer
Authenticate as a contributor and get token
POST
/register
Register a new user account
POST
/logout
Log out by removing the current token

Users

GET
/users/me
Get current user's profile (requires valid token)
GET
/users/{username}
Get a user's profile (requires matching token)
DELETE
/users/{username}
Delete a user account (requires matching token)

Languages

GET
/languages
Get list of all languages
POST
/languages/{language_name}
Add a new language (contributor only)
DELETE
/languages/{language_name}
Delete a language (contributor only)

Lections

GET
/languages/{language_name}/lections
Get list of all lections for a language
GET
/languages/{language_name}/lections/title/{title}
Get a lection by title
GET
/languages/{language_name}/lections/{lection_id}
Get a lection by ID
POST
/languages/{language_name}/lections
Create a new lection (contributor only)
PUT
/languages/{language_name}/lections
Update an existing lection (contributor only)
DELETE
/languages/{language_name}/lections/{lection_name}
Delete a lection (contributor only)