API: Authentication

Login

POST /api/v3/login

Request Parameter:

ParameterTypeDescription
usernamestringThe usernameof the authenticating user
passwordstringThe password of the authenticating user
codestring (optional)The 2FA code of the authenticating user

Response Parameter (Success):

ParameterTypeDescription
tokenstringA JWT authentication token used in other requests 

Response Parameter (Error):

ParameterTypeDescription
errorstringA message containing information about the error 
qrstring (optional)A base64 encoded image of a QR code
(Only if 2FA is enabled on the account but not yet configured)
Request
curl -X POST https://public.brokerstar.biz/api/v3/login -d '{"username": "demo-de", "password": "demo-de", "code": "123456"}'


Response (Success)
200 OK
{
	"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg"
}


Response (2FA enabled but not configured)
200 OK
{
	"error": "2FA enabled but not yet configured",
	"qr": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANwAAADcCAIAAACUOF[...]L8n3CK4Xvj6nAAAAAElFTkSuQmCC"
}


Response (Invalid credentials)
401 Unauthorized
{
	"error": "Invalid credentials"
}


Response (Missing Parameter)
400 Bad Request
{
	"error": "Missing argument (username)"
}

Logout

JWT Authorisation

GET /api/v3/logout

Request Parameter:

No request Parameter

Response Parameter (Success):

ParameterTypeDescription
successstringA success message 

Response Parameter (Error):

ParameterTypeDescription
errorstringA message containing information about the error 
Request
curl -X GET https://public.brokerstar.biz/api/v3/logout --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'
Response (Success)
200 OK
{
	"success": "Logout successful"
}
Response (Error)
400 Bad Request
{
	"error": "No session found"
}

Clear Cache

Clear cache for current logged in user

JWT Authorisation

POST /api/v3/clearCache

Request Parameter:

No request Parameter

Response Parameter (Success):

ParameterTypeDescription
successstringA success message 

Response Parameter (Error):

ParameterTypeDescription
errorstringA message containing information about the error 
Request
curl -X GET https://public.brokerstar.biz/api/v3/clearCache --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'
Response (Success)
200 OK
{
	"success": "Cache cleared"
}
Response (Error)
400 Bad Request
{
	"error": "No session found"
}