Users

All endpoints require you to be an admin or the owner and cannot be used with an API token.

Authentication

Get Users

GET https://demo.getlynx.dev/api/user/list

Cookies

NameTypeDescription

token*

String

Your JWT Session

{
    "success": true,
    "result": [
        {
            "id": "e11fb6ed-3186-473c-87e9-a8d7c71b64e2",
            "username": "owner",
            "email": "admin@getlynx.dev",
            "role": "owner",
            "secret": "KVp6rz8P95VNa6oU0bDMWNZppCpXE5u9"
        },
        {
            "id": "3fbcf68c-84a3-48c7-8e35-a57b1621a5be",
            "username": "user",
            "email": "user@getlynx.dev",
            "role": "standard",
            "secret": null
        }
    ]
}

Create User

POST https://demo.getlynx.dev/api/user

Works, even when registration is disabled.

Request Body

NameTypeDescription

user.username*

String

user.password*

String

user.email*

String

verification.token

String

Your 2FA Token if enabled

verification.password

String

Your password if 2FA not enabled

user.role*

String

If owner, this can be "admin" or "standard". If "admin", this field can only be "standard".

{
    "success": true,
    "result": "Account created",
}

Update user role

POST https://demo.getlynx.dev/api/user/role

Requires you to be the owner, if the role is set to owner, your account will be demoted to an admin.

Cookies

NameTypeDescription

token*

String

Your JWT Session

Request Body

NameTypeDescription

user.role*

String

"owner", "admin" or "standard"

verification.password

String

Your password if 2FA not enabled

verification.token

String

Your 2FA Token if enabled

user.userID

String

User ID

{
    "success": true,
    "result": {
        "user": {
            "id": "e11fb6ed-3186-473c-87e9-a8d7c71b64e2",
            "username": "owner",
            "email": "admin@getlynx.dev",
            "role": "owner",
            "secret": "KVp6rz8P95VNa6oU0bDMWNZppCpXE5u9"
        }
    }
}

Delete User

DELETE https://demo.getlynx.dev/api/user

Cookies

NameTypeDescription

token*

String

Your JWT Session

Request Body

NameTypeDescription

user.id*

String

User ID

verification.password

String

Your password if 2FA not enabled

verification.token

String

Your 2FA Token if enabled

{
    "success": true,
    "message": "Deleted account!",
}

Manual Promotion

If you accidentally promote the wrong user or otherwise would like to make yourself an admin again, run these commands:

Connect to your database and enter your password:

mongosh --port 27017 --username user --authenticationDatabase admin

Switch to the lynx database:

use shortener

Demote the old owner to an admin

db.accounts.findOneAndUpdate({ role: "owner" },{ $set:{ role: "admin" } })

Promote yourself to owner

db.accounts.findOneAndUpdate({ username: "YOUR USERNAME" },{ $set:{ "role": "owner" } })

Last updated