> ## 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 a feature refinement

> Create a feature refinement run. Returns a key plus signed upload URLs for the train and
labelled-test CSVs (kinds `TRAIN` + `TEST`). After uploading both, call
`POST /feature-refinery/{key}/start` to begin the run, then poll `/progress`.




## OpenAPI

````yaml api-reference/openapi.yaml POST /api/v1/feature-refinery
openapi: 3.0.1
info:
  title: MathFi.ai API
  description: >
    The MathFi.ai REST API runs the two products end to end.


    **Feature Refinery** takes your labelled data and works out which columns

    actually carry the signal. It returns a reduced train and test pair, a

    per-column keep/remove decision, and the performance target the refined data

    reached.


    **Model Crucible** takes a dataset, trains every algorithm family against it

    at once, ranks the results on held-out data by fewest wrong decisions, and

    keeps the best three as versions of one model. You pick which one
    predictions

    run against.


    Everything is asynchronous: you create a thing, upload to a signed URL,
    start

    it, then poll until the state is terminal. Nothing streams and nothing
    blocks.
  contact:
    name: MathFi.ai
    url: https://mathfi.ai
    email: support@mathfi.ai
  license:
    name: MathFi.ai
    url: https://mathfi.ai
  version: 1.0.0
servers:
  - url: https://{tenant}-api.mathfi.ai
    description: >-
      Your tenant's API. Each customer has their own, so the host varies.
      Replace {tenant} with the name issued when your tenant was created.
    variables:
      tenant:
        default: your-tenant
        description: The tenant name issued to you.
security:
  - BearerAuth: []
tags:
  - name: Authentication
    description: Exchange credentials for a bearer token
  - name: Feature Refinery
    description: Reduce a dataset to the columns that earn their place
  - name: Datasets
    description: >-
      Prepare labelled data for training, from uploads or from a finished
      refinement
  - name: Training
    description: Run the Crucible against a dataset and choose the champion model
  - name: Models
    description: Trained models and their versions
  - name: Predictions
    description: Score unlabelled data against a champion model
paths:
  /api/v1/feature-refinery:
    post:
      tags:
        - Feature Refinery
      summary: Create a feature refinement
      description: >
        Create a feature refinement run. Returns a key plus signed upload URLs
        for the train and

        labelled-test CSVs (kinds `TRAIN` + `TEST`). After uploading both, call

        `POST /feature-refinery/{key}/start` to begin the run, then poll
        `/progress`.
      operationId: createFeatureRefinement
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FeatureRefineryCreationRequest'
      responses:
        '201':
          description: Feature refinement created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeatureRefineryCreationOutput'
        '400':
          description: Invalid request
        '409':
          description: >-
            A feature refinement with this name already exists (names must be
            unique)
        '500':
          description: Internal server error
components:
  schemas:
    FeatureRefineryCreationRequest:
      required:
        - name
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[A-Za-z0-9 _-]{1,100}$
          description: >-
            Human-readable run name, unique per user. Letters, digits, spaces,
            hyphen and underscore only, 1–100 characters. Rejected with 400
            otherwise — note that punctuation such as angle brackets, dots or
            slashes is not allowed.
          example: German Credit Risk
        trainFileName:
          type: string
          nullable: true
          maxLength: 260
          description: >-
            Original filename of the training CSV the user selected. Optional
            metadata, echoed back on the run so the source dataset is
            identifiable beyond the run name.
          example: german-credit-train.csv
        testFileName:
          type: string
          nullable: true
          maxLength: 260
          description: >-
            Original filename of the labelled-test CSV the user selected.
            Optional, echoed back on the run.
          example: german-credit-test.csv
        numberOfBuckets:
          type: integer
          default: 20
          description: >-
            Bucketing granularity (NoB), the one refinement hyperparameter this
            endpoint accepts. Must be 4, 10 or 20; any other value is rejected
            with 400. Defaults to 20 when omitted. 10 is the recommended
            starting point. Higher granularity can improve refinement accuracy
            at the cost of a longer run.
    FeatureRefineryCreationOutput:
      required:
        - featureRefinementKey
        - status
        - uploadTargets
        - startUrl
      type: object
      properties:
        featureRefinementKey:
          type: string
          format: uuid
        status:
          type: string
        uploadTargets:
          type: array
          items:
            $ref: '#/components/schemas/FeatureRefineryUploadTarget'
        startUrl:
          type: string
        progressUrl:
          type: string
    FeatureRefineryUploadTarget:
      description: One place the client must PUT an input file to.
      required:
        - kind
        - url
      type: object
      properties:
        kind:
          type: string
          enum:
            - TRAIN
            - TEST
        url:
          type: string
          description: Signed upload URL — PUT the CSV directly to it.
        requiredHeader:
          type: string
          nullable: true
          description: >-
            A single request header the PUT must include, as one colon-joined
            "Name:value" string (e.g.
            "X-Goog-Content-Length-Range:10,534773760"). The PUT must ALSO send
            "Content-Type: text/csv" — both headers are covered by the URL's
            signature, and omitting either yields 403 SignatureDoesNotMatch. Do
            not send an Authorization header to a signed URL. Null when no extra
            header is required (local mode). Signed URLs expire 60 minutes after
            create.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````