📘
Lynx
GitHub
  • Welcome
  • Installation
    • Installation
      • Native
      • Docker
    • Post Installation
    • Environment Variables
  • Guides
    • Backups
  • API
    • Using the API
    • API Reference
      • Accounts
      • Users
      • Links
      • Import
      • Export
      • About
      • ShareX
  • Roadmap
Powered by GitBook
On this page
  • Authentication
  • Get Users
  • Create User
  • Update user role
  • Delete User

Was this helpful?

Edit on GitHub
  1. API
  2. API Reference

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

Name
Type
Description

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

Name
Type
Description

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",
}

{
  "success": false,
  "message": "Invalid field(s)",
  "details": {
      "invalid": {
          "email": false,
          "username": false,
          "password": true,
      },
  },  
}
{
  "success": false,
  "message": "Field(s) are already used",
  "details": {
      "exists": {
          "email": true,
          "username": true,
          "password": false,
      },
  },  
}

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

Name
Type
Description

token*

String

Your JWT Session

Request Body

Name
Type
Description

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

Name
Type
Description

token*

String

Your JWT Session

Request Body

Name
Type
Description

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 1 year ago

Was this helpful?