> ## Documentation Index
> Fetch the complete documentation index at: https://doc-dev.weir.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Authenticate Admin

> Authenticate admin user with token

# Authenticate Admin

Authenticate an admin user using an admin token to access admin APIs.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://api.weir.ai/auth/authenticateAdmin' \
    -H 'Content-Type: application/json' \
    -d '{
      "token": "admin_token_123456789"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "data": {
      "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "refreshToken": "admin_refresh_123456789",
      "expiresIn": 3600,
      "admin": {
        "adminId": "admin_123456789",
        "fullname": "Admin User",
        "email": "admin@weir.ai",
        "role": "Super_Admin"
      }
    },
    "message": "Admin authenticated successfully",
    "status": "success"
  }
  ```
</ResponseExample>

## Request Body

<ParamField body="token" type="string" required>
  Admin authentication token provided by the system.
</ParamField>

## Response Fields

<ResponseField name="data.accessToken" type="string" required>
  JWT access token for admin API requests.
</ResponseField>

<ResponseField name="data.refreshToken" type="string" required>
  Refresh token for obtaining new access tokens.
</ResponseField>

<ResponseField name="data.expiresIn" type="integer" required>
  Token expiration time in seconds.
</ResponseField>

<ResponseField name="data.admin" type="object" required>
  Admin user information.

  <Expandable title="Admin Properties">
    <ResponseField name="admin.adminId" type="string" required>
      Unique admin identifier.
    </ResponseField>

    <ResponseField name="admin.fullname" type="string" required>
      Admin's full name.
    </ResponseField>

    <ResponseField name="admin.email" type="string" required>
      Admin's email.
    </ResponseField>

    <ResponseField name="admin.role" type="string" required>
      Admin role (Super\_Admin, Admin, Support\_Admin).
    </ResponseField>
  </Expandable>
</ResponseField>

## Usage Examples

<CodeGroup>
  ```javascript JavaScript theme={null}
  const authenticateAdmin = async (token) => {
    const response = await fetch('https://api.weir.ai/auth/authenticateAdmin', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ token })
    });
    if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
    return await response.json();
  };
  ```

  ```python Python theme={null}
  import requests

  def authenticate_admin(token):
      response = requests.post(
          'https://api.weir.ai/auth/authenticateAdmin',
          json={'token': token}
      )
      response.raise_for_status()
      return response.json()
  ```
</CodeGroup>

<Warning>
  **Admin Access**: This endpoint requires a valid admin token. Contact system administrators for access.
</Warning>
