majjha.developers
Open beta

Public beta: activity uses test Dots with no monetary value. There is no money in or out, and interfaces may change before launch.

Authentication

Public market data needs no credentials. Private account, portfolio, and order-management requests use a majjha session token in the standard Bearer header.

Bearer tokens

Add the session token to each private request with the Authorizationheader. The token represents one majjha account and carries that account's permissions.

Header
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…

First-party app sign-in

The majjha app uses Dynamic for account sign-in. After the user completes that flow, the app exchanges the verified provider session for the same majjha Bearer token accepted by private REST and WebSocket endpoints. This exchange is handled by the first-party client; integrations should not attempt to recreate its provider flow.

Email and password (local development)

Locally created accounts can exchange credentials for a session at POST /api/auth/login. This compatibility flow is useful while developing against a local stack.

Log in
curl -X POST "https://api.majjha.fun/api/auth/login" -H "Content-Type: application/json" -d '{ "email": "[email protected]", "password": "••••••••" }'
200 OK
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
  "user": {
    "id": "usr_123",
    "email": "[email protected]",
    "name": "Ada",
    "username": "ada",
    "role": "USER"
  }
}

Verify a session and read the current account with GET /api/auth/me:

Current account
curl "https://api.majjha.fun/api/auth/me" -H "Authorization: Bearer $MAJJ_TOKEN"

Keep sessions safe

  • Treat majjha and Dynamic session tokens like passwords; never commit them.
  • Store server-side credentials in environment variables, not source control.
  • Do not expose a private session token in a public browser bundle or client log.
  • Use the smallest permission scope available for automated integrations.

Authentication errors

A missing or invalid token returns 401 Unauthorized. A valid token without the required role returns 403 Forbidden. See Errors for the response format.