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

# Prepare train set upload

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

First step for TabPFN v2 flow: pass `x_train_info` / `y_train_info` metadata (name, size, hash); receive `train_set_upload_id` and signed upload URLs.



## OpenAPI

````yaml /api-reference/openapi.json post /tabpfn/prepare_train_set_upload
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/prepare_train_set_upload:
    post:
      tags:
        - Training
      summary: Prepare train set upload
      description: >-
        **Recommended:** Use
        [tabpfn-client](https://github.com/PriorLabs/tabpfn-client)
        (`TabPFNClassifier` / `TabPFNRegressor`). It calls these routes for you.


        First step for TabPFN v2 flow: pass `x_train_info` / `y_train_info`
        metadata (name, size, hash); receive `train_set_upload_id` and signed
        upload URLs.
      operationId: tabpfn_prepare_train_set_upload
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrepareTrainSetUploadRequest'
            example:
              x_train_info:
                filename: X_train.csv
                size_bytes: 1024
                content_hash: abc
              y_train_info:
                filename: y_train.csv
                size_bytes: 64
                content_hash: def
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrepareTrainSetUploadResponse'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DuplicateTrainSetErrorResponse'
          description: Conflict
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Default Response
      security:
        - BearerAuth: []
components:
  schemas:
    PrepareTrainSetUploadRequest:
      properties:
        x_train_info:
          $ref: '#/components/schemas/FileInfo'
        y_train_info:
          $ref: '#/components/schemas/FileInfo'
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        force_reupload:
          type: boolean
          title: Force Reupload
          description: >-
            Whether to force the upload of the file even if a file with the same
            hash already exists.
          default: false
      additionalProperties: false
      type: object
      required:
        - x_train_info
        - y_train_info
      title: PrepareTrainSetUploadRequest
    PrepareTrainSetUploadResponse:
      properties:
        train_set_upload_id:
          type: string
          format: uuid
          title: Train Set Upload Id
        x_train_info:
          $ref: '#/components/schemas/FileUploadInfo'
        y_train_info:
          $ref: '#/components/schemas/FileUploadInfo'
      additionalProperties: false
      type: object
      required:
        - train_set_upload_id
        - x_train_info
        - y_train_info
      title: PrepareTrainSetUploadResponse
    DuplicateTrainSetErrorResponse:
      properties:
        message:
          type: string
          title: Message
        error_code:
          type: string
          title: Error Code
          default: DUPLICATE_TRAIN_SET_UPLOAD
        trace_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Trace Id
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
        train_set_upload_id:
          type: string
          format: uuid
          title: Train Set Upload Id
      additionalProperties: false
      type: object
      required:
        - message
        - train_set_upload_id
      title: DuplicateTrainSetErrorResponse
    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
    FileInfo:
      properties:
        format:
          type: string
          enum:
            - csv
            - parquet
          title: Format
        hash:
          anyOf:
            - type: string
            - type: 'null'
          title: Hash
          description: The crc32c hash of the file, used to deduplicate the file.
        size_bytes:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size Bytes
          description: >-
            The size of the file in bytes, used to compute the optimal number of
            chunks when chunking is enabled.
        use_chunks:
          type: boolean
          title: Use Chunks
          description: >-
            Whether to split the the file into chunks and upload them in
            parallel.
          default: false
      additionalProperties: false
      type: object
      required:
        - format
      title: FileInfo
    FileUploadInfo:
      properties:
        signed_urls:
          items:
            type: string
          type: array
          minItems: 1
          title: Signed Urls
        expires_at:
          type: number
          title: Expires At
        required_headers:
          additionalProperties:
            type: string
          type: object
          title: Required Headers
      additionalProperties: false
      type: object
      required:
        - signed_urls
        - expires_at
        - required_headers
      title: FileUploadInfo
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer token for authentication, obtained after signing up and
        generating an API key.

````