---
title: "Fit (TabPFN JSON API)"
method: POST
path: "/tabpfn/fit"
tags: ["Training"]
---

# Fit (TabPFN JSON API)

`POST /tabpfn/fit`

**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`.

## Request body

- FitRequest
  - `train_set_upload_id` string, uuid, required
  - `task` 'classification' | 'regression', required — Specifies the type of task to perform — either classification or regression.
  - `tabpfn_systems` string[]
  - `tabpfn_config` object, nullable
  - `thinking_effort` 'medium' | 'high', nullable
  - `thinking_timeout_s` number, nullable
  - `thinking_effort_metric` string, nullable
  - `force_refit` boolean — Whether to force the fitting of the train set even if a fittedtrain set and transform states already exist.

## Response `200`

Fitted train set id (JSON; may be streamed with leading whitespace on long fits).

- TabpfnFitResponse
  - `fitted_train_set_id` string, uuid, required

## Other responses

- `401` — 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"}`
- `404` — Model not found — the provided model ID does not exist or has expired.
- `422` — Validation error — one or more fields are incorrectly formatted.
- `429` — Quota exceeded (predict pre-check or thinking-fit monthly limit).

---

[API](https://skmtc.dev/priorlabs/apis/tabpfn-api.md) · [All operations](https://skmtc.dev/priorlabs/apis/tabpfn-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/priorlabs/tabpfn-api/revisions/c893364bdb13/schema)
