Add User

POST /user

Add a new user to the whitelist. The user will be able to sign in with the application.

Note:

  • The system can only have 01 superadmin.
  • "manager" can't add more users.
  • "admin" can't add more superadmins.
application/json

Body Required

  • email string Required
  • role string Required

    Values are superadmin, admin, or manager.

Responses

  • 200 application/json

    Successful Response. Either added successfully or already exists.

    Hide response attribute Show response attribute object
    • detail string

      Values are User added successfully. or User already exists..

  • 400 application/json

    Invalid added roles

    Hide response attribute Show response attribute object
    • detail string

      Default value is Invalid added roles..

  • 401 application/json

    Unauthorized

    Hide response attribute Show response attribute object
    • detail string

      Default value is Unauthorized.

  • 422 application/json

    Validation Error

    Hide response attribute Show response attribute object
    • detail array[object]
      Hide detail attributes Show detail attributes object
      • loc array[string | integer] Required
      • msg string Required
      • type string Required
POST /user
curl \
 -X POST http://localhost:5000/user \
 --cookie "fastapiusersauth=$API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"email":"abcxyz@gmail.com","role":"superadmin"}'
Request example
{
  "email": "abcxyz@gmail.com",
  "role": "superadmin"
}
Response examples (200)
{
  "detail": "User added successfully."
}
Response examples (400)
{
  "detail": "Invalid added roles."
}
Response examples (401)
{
  "detail": "Unauthorized"
}
Response examples (422)
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}