> ## 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.

# Create prediction

> Submits an unseen (unlabelled) CSV file for inference using the specified model.

The CSV must have the same feature columns as the training data, without the label column(s).
Returns a `predictionKey` — poll `GET /api/v1/predictions/{predictionKey}/progress` until
status is `COMPLETED`, then retrieve the result CSV.




## OpenAPI

````yaml POST /api/v1/predictions/models/{modelKey}
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/v1/predictions/models/{modelKey}:
    post:
      tags:
        - Predictions
      summary: Create prediction
      description: >
        Submits an unseen (unlabelled) CSV file for inference using the
        specified model.


        The CSV must have the same feature columns as the training data, without
        the label column(s).

        Returns a `predictionKey` — poll `GET
        /api/v1/predictions/{predictionKey}/progress` until

        status is `COMPLETED`, then retrieve the result CSV.
      operationId: createPrediction
      parameters:
        - name: modelKey
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              additionalProperties: false
              properties:
                file:
                  type: string
                  format: binary
            encoding:
              file:
                contentType: text/csv
      responses:
        '201':
          description: Prediction created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PredictionCreationOutput'
        '400':
          description: Invalid prediction request
        '500':
          description: Internal server error
components:
  schemas:
    PredictionCreationOutput:
      required:
        - predictionKey
        - status
        - predictionCreationProgressUrl
      type: object
      properties:
        predictionKey:
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/PredictionStatus'
        predictionCreationProgressUrl:
          type: string
          description: URL to poll for prediction progress
    PredictionStatus:
      type: string
      description: |
        Status of a prediction job:

        | Status | Description |
        |---|---|
        | `PENDING` | Created, queued for processing |
        | `RUNNING` | Inference in progress |
        | `COMPLETED` | Finished. Result CSV available for download. |
        | `FAILED` | Failed due to an error |
        | `TIMEOUT` | Exceeded the processing time limit |
      enum:
        - PENDING
        - RUNNING
        - COMPLETED
        - FAILED
        - TIMEOUT
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Obtain a token from `POST /api/login`. Valid for 1 hour.

````