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

# Fit (TabPFN JSON API)

> **Recommended:** Use [tabpfn-client](https://github.com/PriorLabs/tabpfn-client) (`TabPFNClassifier` / `TabPFNRegressor`). It calls these routes for you.

JSON body after you upload train files via `POST /tabpfn/prepare_train_set_upload` and PUT the returned signed URLs. Returns `fitted_train_set_id`. Long fits may stream JSON with leading keepalive whitespace; see the [TabPFN-3 changelog](/changelog/tabpfn-3).

Key fields: `train_set_upload_id` (UUID), `task` (`classification` | `regression`), `tabpfn_systems`, optional `tabpfn_config`, `thinking_effort` (`medium` | `high` or omit), `thinking_timeout_s`, `thinking_effort_metric`, `force_refit`.



## OpenAPI

````yaml /api-reference/openapi.json post /tabpfn/fit
openapi: 3.1.0
info:
  title: TabPFN API
  description: >-
    Prior Labs TabPFN API. **Prefer
    [tabpfn-client](https://github.com/PriorLabs/tabpfn-client)**. Current
    integration surface: **`/tabpfn/*` JSON routes** (prepare uploads, fit,
    predict, limits). **`/v1/*` multipart routes are deprecated.** See the
    [Changelog](/changelog).
  version: 2.0.0
  contact:
    name: Prior Labs
    email: hello@priorlabs.ai
servers:
  - url: https://api.priorlabs.ai
    description: Production TabPFN API (`/tabpfn/*` current; `/v1/*` deprecated)
security:
  - BearerAuth: []
paths:
  /tabpfn/fit:
    post:
      tags:
        - Training
      summary: Fit (TabPFN JSON API)
      description: >-
        **Recommended:** Use
        [tabpfn-client](https://github.com/PriorLabs/tabpfn-client)
        (`TabPFNClassifier` / `TabPFNRegressor`). It calls these routes for you.


        JSON body after you upload train files via `POST
        /tabpfn/prepare_train_set_upload` and PUT the returned signed URLs.
        Returns `fitted_train_set_id`. Long fits may stream JSON with leading
        keepalive whitespace; see the [TabPFN-3 changelog](/changelog/tabpfn-3).


        Key fields: `train_set_upload_id` (UUID), `task` (`classification` |
        `regression`), `tabpfn_systems`, optional `tabpfn_config`,
        `thinking_effort` (`medium` | `high` or omit), `thinking_timeout_s`,
        `thinking_effort_metric`, `force_refit`.
      operationId: tabpfn_fit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FitRequest'
            example:
              train_set_upload_id: 123e4567-e89b-12d3-a456-426614174000
              task: classification
              tabpfn_systems:
                - preprocessing
                - text
              thinking_effort: medium
      responses:
        '200':
          description: >-
            Fitted train set id (JSON; may be streamed with leading whitespace
            on long fits).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TabpfnFitResponse'
        '401':
          description: >-
            Unauthorized — authentication required or credentials invalid.


            **Possible causes:**

            - Missing or malformed `Authorization` header

            - Invalid or expired JWT token

            - User not found (token references a deleted account)

            - JWT decode errors (JWEDecodeError, JWTDecodeError, JWTClaimsError)


            **Examples:**

            - Missing token: `{"detail": "Not authenticated"}`

            - Invalid credentials: `{"detail": "Could not validate
            credentials"}`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missing_token:
                  value:
                    code: auth.unauthorized
                    detail: Not authenticated
                    retryable: false
                    support: https://discord.com/invite/VJRuU3bSxt
                invalid_credentials:
                  value:
                    code: auth.unauthorized
                    detail: Could not validate credentials
                    retryable: false
                    support: https://discord.com/invite/VJRuU3bSxt
                expired_token:
                  value:
                    code: auth.unauthorized
                    detail: Invalid or expired JWT token
                    retryable: false
                    support: https://discord.com/invite/VJRuU3bSxt
        '404':
          description: >-
            Model not found — the provided model ID does not exist or has
            expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: error.not_found
                detail: >-
                  Fitted model with ID 123e4567-e89b-12d3-a456-426614174000 not
                  found
                retryable: false
                support: https://discord.com/invite/VJRuU3bSxt
        '422':
          description: Validation error — one or more fields are incorrectly formatted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '429':
          description: Quota exceeded (predict pre-check or thinking-fit monthly limit).
      security:
        - BearerAuth: []
components:
  schemas:
    FitRequest:
      properties:
        train_set_upload_id:
          type: string
          format: uuid
          title: Train Set Upload Id
        task:
          $ref: '#/components/schemas/PredictionTask'
        tabpfn_systems:
          items:
            type: string
            enum:
              - preprocessing
              - text
              - thinking
          type: array
          title: Tabpfn Systems
          default:
            - preprocessing
            - text
        tabpfn_config:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Tabpfn Config
        thinking_effort:
          anyOf:
            - type: string
              enum:
                - medium
                - high
            - type: 'null'
          title: Thinking Effort
        thinking_timeout_s:
          anyOf:
            - type: number
            - type: 'null'
          title: Thinking Timeout S
        thinking_effort_metric:
          anyOf:
            - type: string
            - type: 'null'
          title: Thinking Effort Metric
        force_refit:
          type: boolean
          title: Force Refit
          description: >-
            Whether to force the fitting of the train set even if a fittedtrain
            set and transform states already exist.
          default: false
      additionalProperties: false
      type: object
      required:
        - train_set_upload_id
        - task
      title: FitRequest
    TabpfnFitResponse:
      type: object
      required:
        - fitted_train_set_id
      properties:
        fitted_train_set_id:
          type: string
          format: uuid
    ErrorResponse:
      type: object
      required:
        - code
        - detail
        - retryable
        - support
      properties:
        code:
          type: string
          description: Error category code (e.g., auth.unauthorized, rate.limit.exceeded)
          example: auth.unauthorized
        detail:
          type: string
          description: Human-readable error message describing what went wrong.
          example: Invalid authentication credentials
        retryable:
          type: boolean
          description: Indicates whether the request can be retried.
          example: false
        support:
          type: string
          description: URL to get support for this error.
          example: https://discord.com/invite/VJRuU3bSxt
      example:
        code: auth.unauthorized
        detail: Invalid authentication credentials
        retryable: false
        support: https://discord.com/invite/VJRuU3bSxt
    ValidationError:
      type: object
      required:
        - code
        - detail
        - errors
        - retryable
        - support
      properties:
        code:
          type: string
          description: Error category code for validation errors
          example: validation.failed
        detail:
          type: string
          description: Human-readable validation error message
          example: Validation error for FitRequest
        errors:
          type: array
          description: Array of field-level validation errors
          items:
            type: object
            properties:
              field:
                type: string
                description: Field name where the error occurred
                example: task
              message:
                type: string
                description: Error message for this field
                example: field required
        retryable:
          type: boolean
          description: Indicates whether the request can be retried
          example: false
        support:
          type: string
          description: URL to get support for this error
          example: https://discord.com/invite/VJRuU3bSxt
      example:
        code: validation.failed
        detail: Validation error for FitRequest
        errors:
          - field: task
            message: field required
          - field: systems
            message: >-
              Invalid system: invalid_system. Must be one of: ['preprocessing',
              'text']
        retryable: false
        support: https://discord.com/invite/VJRuU3bSxt
    PredictionTask:
      type: string
      enum:
        - classification
        - regression
      description: >-
        Specifies the type of task to perform — either classification or
        regression.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer token for authentication, obtained after signing up and
        generating an API key.

````