Auth API
Session endpoints for local password compatibility and reading the current account. Public market data needs no session; private resources use a Bearer token.
Password login
PublicPOST
/api/auth/loginAuthenticates a retained email/password account and returns a native Bearer JWT. The hosted first-party app prefers Dynamic; this flow remains for local development and compatible integrations.
Body parameters
emailstringbodyrequiredAccount email.
passwordstringbodyrequiredAccount password.
Request
cURL
curl -X POST "https://api.majjha.fun/api/auth/login" \
-H "Content-Type: application/json" \
-d '{ "email": "[email protected]", "password": "correct horse battery staple" }'Request body
{ "email": "[email protected]", "password": "correct horse battery staple" }Response
200 OK
{ "token": "eyJhbGciOiJIUzI1NiJ9…", "user": { "id": "usr_123", "email": "[email protected]", "name": "Ada", "username": "ada", "role": "USER" }, "isNewUser": false, "signupGrant": null }Get current session
Requires authGET
/api/auth/meValidates the Bearer JWT and returns the current account plus its indexed available, reserved, and total test-token balance.
Request
cURL
curl "https://api.majjha.fun/api/auth/me" \
-H "Authorization: Bearer $MAJJ_TOKEN"Response
200 OK
{ "user": { "id": "usr_123", "email": "[email protected]", "name": "Ada", "username": "ada", "role": "USER", "createdAt": "2026-06-24T12:00:00Z" }, "balance": { "available": "1000.00000000", "reserved": "0.00000000", "total": "1000.00000000" } }