Skip to main content
POST
https://api-dev.weir.ai/
/
auth
/
login
curl -X POST 'https://api.weir.ai/auth/login' \
  -H 'Content-Type: application/json' \
  -d '{
    "username": "[email protected]",
    "password": "SecureAdminPass123!"
  }'
{
  "data": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "refreshToken": "admin_refresh_123456789",
    "expiresIn": 3600,
    "user": {
      "id": "admin_123456789",
      "fullname": "Admin User",
      "email": "[email protected]",
      "role": "Super_Admin"
    }
  },
  "message": "Login successful",
  "status": "success"
}

Admin Login

Authenticate admin users with username and password to access admin APIs.
curl -X POST 'https://api.weir.ai/auth/login' \
  -H 'Content-Type: application/json' \
  -d '{
    "username": "[email protected]",
    "password": "SecureAdminPass123!"
  }'
{
  "data": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "refreshToken": "admin_refresh_123456789",
    "expiresIn": 3600,
    "user": {
      "id": "admin_123456789",
      "fullname": "Admin User",
      "email": "[email protected]",
      "role": "Super_Admin"
    }
  },
  "message": "Login successful",
  "status": "success"
}

Request Body

username
string
required
Admin username or email.
password
string
required
Admin password.

Usage Examples

const adminLogin = async (username, password) => {
  const response = await fetch('https://api.weir.ai/auth/login', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ username, password })
  });
  if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
  return await response.json();
};
Admin login uses the same endpoint as regular user login but with admin credentials.