Skip to content

API documentation

ShadowCrafter011 edited this page Mar 1, 2026 · 5 revisions

API documentation

Index

Base path

The base path for all API requests is https://www.freequiz.ch/api/

Content type

Content-Type is application/json unless specified otherwise

Authentication

Work in progress

General errors

Work in progress

Bug reports

Work in progress

Languages

Work in progress

Users

Data

https://www.freequiz.ch/api/user/data

  • Request method: GET
  • Authentication: required
  • Content: No content
  • Reponse: 200
{
    "success": true,
    "data": {
        "username": "username",
        "avatar_url": "avatar_url",
        "email": "email",
        "unconfirmed_email": null,
        "role": "role",
        "quizzes": 0,
        "created_at": 1772374484,
        "updated_at": 1772374497,
        "settings": {
            "locale": "en",
            "dark_mode": true,
            "write_amount": 2,
            "cards_amount": 2,
            "multi_amount": 2,
            "round_amount": 10
        },
        "confirmation": {
            "confirmed": false,
            "confirmed_at": null
        },
        "logins": {
            "count": 2,
            "current_login_at": 1772374497,
            "last_login_at": 1772374484,
            "sessions": [
                {
                    "purpose": "api",
                    "expires": 1803910497,
                    "last_activity": 1772374502,
                    "current_session": true,
                    "session_id": "session_id"
                }
            ]
        }
    }
}

Logout

https://www.freequiz.ch/api/user/logout

This request invalidated the current session and even if the access token is still known it cannot be used to authenticate anymore.

  • Request method: DELETE
  • Authentication: required
  • Content: No content
  • Response: 200
{
    "success": true,
    "message": "Logged out"
}

Destroy session

https://www.freequiz.ch/api/user/destroy_session/:session_id

This endpoint can be used to invalidate other sessions than the current one. Though the current one can also be invalidated using this endpoint. All required information to invalidate a session is the session_id which is obtained through the user data endpoint

  • Request method: DELETE
  • Authentication: required
  • Content: No content
  • Response:
    • 200: Session successfuly invalidated
    • 404: Session does not exist anymore or does not belong to that user

200: Session successfuly invalidated

{
    "success": true,
    "message": "Session deleted"
}

404: Session does not exist anymore or does not belong to that user

{
    "success": false,
    "token": "session.notfound",
    "message": "Session to be deleted was not found or does not belong to the user"
}

Quizzes

Work in progress

Clone this wiki locally