API: Authentication
Login
POST /api/v3/login
Request Parameter:
Parameter | Type | Description |
---|---|---|
username | string | The usernameof the authenticating user |
password | string | The password of the authenticating user |
code | string (optional) | The 2FA code of the authenticating user |
Response Parameter (Success):
Parameter | Type | Description |
---|---|---|
token | string | A JWT authentication token used in other requests |
Response Parameter (Error):
Parameter | Type | Description |
---|---|---|
error | string | A message containing information about the error |
qr | string (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)" }
GET /api/v3/logout
Request Parameter:
No request Parameter
Response Parameter (Success):
Parameter | Type | Description |
---|---|---|
success | string | A success message |
Response Parameter (Error):
Parameter | Type | Description |
---|---|---|
error | string | A 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" }
POST /api/v3/clearCache
Request Parameter:
No request Parameter
Response Parameter (Success):
Parameter | Type | Description |
---|---|---|
success | string | A success message |
Response Parameter (Error):
Parameter | Type | Description |
---|---|---|
error | string | A 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" }