API Reference V1 - SayidHosseini/authentiq GitHub Wiki

Heartbeat

This is used to check if the service is up.

HTTP Method GET
URL /authentiq/v1/heartbeat
Request Body empty
Response OK 200 OK
Response ERROR no response

Register User

This is used to register a new user.

HTTP Method POST
URL /authentiq/v1/user/register
Request Body

{
    "email": "EMAIL ADDRESS",
    "password": "PASSWORD"
}
Response OK 201 Created
Response ERROR 400 Invalid Parameters
409 Email Already Exists

Login

This is used to login. It returns a JWT token which is used when authentication is required.

HTTP Method POST
URL /authentiq/v1/user/login
Request Body

{
    "email": "EMAIL ADDRESS",
    "password": "PASSWORD"
}
Response OK 200 OK

{
    "token": "GENERATED TOKEN"
}
Response ERROR 400 Invalid Parameters
401 Invalid Credentials
429 Too Many Requests

Validate Token

This is to check if the user is logged in and his/her session is not expired. The token that needs to be validated is sent in Authorization header as Bearer Token.

HTTP Method GET
URL /authentiq/v1/validate/token
Request Body empty
Response OK 200 OK
Response ERROR 400 Invalid Parameters
401 Invalid Credentials

Change Password

This is used to change user password. The user needs to login first to make this request. The acquired token must be provided in Authorization header as Bearer Token.

HTTP Method PUT
URL /authentiq/v1/user/password
Request Body

{
    "password": "CURRENT PASSWORD",
    "newPassword": "NEW PASSWORD"
}
Response OK 200 OK
Response ERROR 400 Invalid Parameters
401 Invalid Credentials

List Users

This is used to get a dynamic list of users' id, email and role. The user needs to login first to make this request. The acquired token must be provided in Authorization header as Bearer Token. Only admin role users can do this.

HTTP Method GET
URL /authentiq/v1/user/list
Request Body empty
Response OK 200 OK
Response ERROR 400 Invalid Parameters
401 Invalid Credentials
403 Unauthorized

Get Role

This is used to get the current role of the user. The user needs to login first to make this request. The acquired token must be provided in Authorization header as Bearer Token. All roles can do this.

HTTP Method GET
URL /authentiq/v1/user/role
Request Body empty
Response OK 200 OK

{
    "id": "GENERATED_USER_ID",
    "email": "EMAIL ADDRESS",
    "role": "admin" | "user" | "guest"
}
Response ERROR 400 Invalid Parameters
401 Invalid Token

Change Role

This is used to change the current role of a user. The user needs to login first to make this request. The acquired token must be provided in Authorization header as Bearer Token. Only admin role users can do this.

HTTP Method PUT
URL /authentiq/v1/user/role
Request Body

{
    "email": "EMAIL ADDRESS",
    "role": "admin" | "user" | "guest"
}
Response OK 200 OK
Response ERROR 400 Invalid Parameters
401 Invalid Credentials
403 Unauthorized
404 Email Not Found

Logout

This is used to logout, which makes the user's token invalid after request success. The user needs to login first to make this request. The acquired token must be provided in Authorization header as Bearer Token.

HTTP Method DELETE
URL /authentiq/v1/user/logout
Request Body empty
Response OK 200 OK
Response ERROR 400 Invalid Parameters
401 Invalid Credentials

Delete User

This is used to delete a user completely from the service, which makes the user's credentials invalid after request success. The user needs to login first to make this request. The acquired token must be provided in Authorization header as Bearer Token.

HTTP Method DELETE
URL /authentiq/v1/user/delete
Request Body

{
    "password": "PASSWORD",
}
Response OK 200 OK
Response ERROR 400 Invalid Parameters
401 Invalid Credentials
403 Unauthorized
⚠️ **GitHub.com Fallback** ⚠️