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

# Login

> Authenticates a user and returns a JWT Bearer token.
The token is valid for **1 hour** and must be included as
`Authorization: Bearer <token>` on all `/api/v1/*` requests.

Re-authenticate when you receive a `401 Unauthorized` response.




## OpenAPI

````yaml POST /api/login
openapi: 3.0.1
info:
  title: MathFi.ai API
  description: >
    The MathFi.ai REST API lets you build predictive AI applications
    programmatically.


    Upload labelled CSV data, train a model, and run predictions — all in
    minutes.

    The API supports binary and multi-class classification on tabular data using

    Cellular Balanced Learning (CBL), running entirely on commodity CPUs.


    ## Base URL


    ```

    https://api.mathfi.ai

    ```


    ## Authentication


    All `/api/v1/*` endpoints require a Bearer token obtained from `POST
    /api/login`.

    Tokens are valid for **1 hour**. Re-authenticate when you receive a `401`.


    ```

    Authorization: Bearer <token>

    ```
  contact:
    name: MathFi.ai
    url: https://mathfi.ai
    email: support@mathfi.ai
  license:
    name: Mathficast Limited
    url: https://mathfi.ai
  version: 1.0.0
servers:
  - url: https://api.mathfi.ai
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Authentication
    description: Obtain a Bearer token to authenticate API requests
  - name: Datasets
    description: Create and manage labelled training data in CSV format
  - name: Training
    description: Train models from datasets using a small set of hyperparameters
  - name: Models
    description: Inspect trained models and their performance metrics
  - name: Predictions
    description: Run inference on unseen data using trained models
paths:
  /api/login:
    post:
      tags:
        - Authentication
      summary: Obtain a Bearer token
      description: |
        Authenticates a user and returns a JWT Bearer token.
        The token is valid for **1 hour** and must be included as
        `Authorization: Bearer <token>` on all `/api/v1/*` requests.

        Re-authenticate when you receive a `401 Unauthorized` response.
      operationId: login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
            examples:
              Login request:
                summary: Login with email and password
                value:
                  email: user@example.com
                  password: your-password
      responses:
        '200':
          description: Authentication successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
              examples:
                Successful login:
                  summary: Successful login response
                  value:
                    token: >-
                      eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJtYXRoZmktYWkiLCJzdWIiOiJ1c2VyQGV4YW1wbGUuY29tIiwibmJmIjoxNzAwMDAwMDAwLCJleHAiOjE3MDAwMDM2MDB9.example
        '401':
          description: Invalid credentials
      security: []
components:
  schemas:
    LoginRequest:
      required:
        - email
        - password
      type: object
      properties:
        email:
          type: string
          format: email
          example: user@example.com
        password:
          type: string
          format: password
    LoginResponse:
      required:
        - token
      type: object
      properties:
        token:
          type: string
          description: JWT Bearer token, valid for 1 hour
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Obtain a token from `POST /api/login`. Valid for 1 hour.

````