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

# Create Sft Training Run Route

> Create and launch a supervised fine-tuning run on a finalized dataset version: it trains on the version's train trajectories and reports held-out loss on its heldout trajectories.



## OpenAPI

````yaml /openapi.json post /api/v1/train_sft
openapi: 3.1.0
info:
  title: Trajectory API
  version: 0.1.0
  x-trajectory-api-version: '2026-10-14'
  description: >-
    This contract is API version 2026-10-14. The optional Trajectory-API-Version
    header pins it, and tmp-contract is accepted as an alias. Requests without
    the header get this version. Version 2026-10-07 and the pre-launch legacy
    response formats are retired.
servers:
  - url: https://api.trajectory.ai
security: []
tags:
  - name: projects
    x-group: Projects
  - name: specs
    x-group: Specs
  - name: diagnostics
    x-group: Diagnostics
  - name: spec-ingestion
    x-group: Spec submissions
  - name: spec-findings
    x-group: Spec findings
  - name: eval
    x-group: Evaluations
  - name: training
    x-group: Training
  - name: deployments
    x-group: Deployments
  - name: model-endpoints
    x-group: Model endpoints
  - name: inference
    x-group: Inference
  - name: trajectories
    x-group: Trajectories
  - name: artifacts
    x-group: Artifacts
  - name: telemetry
    x-group: Telemetry
  - name: supported-models
    x-group: Supported models
  - name: organizations
    x-group: Organizations
  - name: secrets
    x-group: Secrets
  - name: datasets
    x-group: Datasets
paths:
  /api/v1/train_sft:
    post:
      tags:
        - training
      summary: Create Sft Training Run Route
      description: >-
        Create and launch a supervised fine-tuning run on a finalized dataset
        version: it trains on the version's train trajectories and reports
        held-out loss on its heldout trajectories.
      operationId: createSFTTrainingRun
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            minLength: 1
            maxLength: 256
            title: Idempotency-Key
          description: >-
            Optional. Without a key, repeated submissions are treated as
            separate actions. A blank or over-long key is rejected. Reuse this
            key when retrying a submission; the SDK generates one per call and
            reuses it across automatic retries.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSftTrainingRunRequest'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTrainingRunResponse'
        '400':
          description: The request is malformed or cannot be processed.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/RequestId'
            Trajectory-Should-Retry:
              $ref: '#/components/headers/TrajectoryShouldRetry'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidRequestErrorResponse'
        '402':
          description: >-
            The organization's credit balance cannot cover new work; add credits
            and retry.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/RequestId'
            Trajectory-Should-Retry:
              $ref: '#/components/headers/TrajectoryShouldRetry'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditsRequiredErrorResponse'
        '404':
          description: >-
            The requested resource does not exist or is not visible to the
            caller.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/RequestId'
            Trajectory-Should-Retry:
              $ref: '#/components/headers/TrajectoryShouldRetry'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceNotFoundErrorResponse'
        '409':
          description: >-
            The operation conflicts with the current state or an idempotent
            request.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/RequestId'
            Trajectory-Should-Retry:
              $ref: '#/components/headers/TrajectoryShouldRetry'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictErrorResponse'
        '429':
          description: >-
            The organization reached its concurrent evaluation or training run
            limit; retry after an active run finishes.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/RequestId'
            Trajectory-Should-Retry:
              $ref: '#/components/headers/TrajectoryShouldRetry'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConcurrencyLimitExceededErrorResponse'
        default:
          $ref: '#/components/responses/ApiErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CreateSftTrainingRunRequest:
      properties:
        base_model_slug:
          $ref: '#/components/schemas/BaseModelSlug'
          description: Registered base model to fine-tune.
        dataset_id:
          type: string
          maxLength: 64
          pattern: ^dset_[A-Za-z0-9]+$
          title: Dataset Id
          description: >-
            Saved dataset version (`dset_...`) whose trajectories are the
            training examples.
        options:
          anyOf:
            - $ref: '#/components/schemas/SftTrainingOptions'
            - type: 'null'
          description: SFT settings; omission, null, and an empty object preserve defaults.
        parent_checkpoint_id:
          anyOf:
            - type: string
              maxLength: 64
              minLength: 1
            - type: 'null'
          title: Parent Checkpoint Id
          description: >-
            Checkpoint to fine-tune from instead of the base weights; must match
            base_model_slug.
        display_name:
          anyOf:
            - type: string
              maxLength: 256
              minLength: 1
            - type: 'null'
          title: Display Name
      additionalProperties: false
      type: object
      required:
        - base_model_slug
        - dataset_id
      title: CreateSftTrainingRunRequest
      description: Fine-tune a base model on a saved dataset.
    CreateTrainingRunResponse:
      properties:
        bench_id:
          type: string
          title: Bench Id
        training_run_id:
          type: string
          title: Training Run Id
        display_name:
          type: string
          title: Display Name
          description: User-facing name for the training run.
        resolved_trajectory_options:
          anyOf:
            - $ref: '#/components/schemas/ResolvedTrajectoryTrainingOptions'
            - type: 'null'
      type: object
      required:
        - bench_id
        - training_run_id
        - display_name
        - resolved_trajectory_options
      title: CreateTrainingRunResponse
    InvalidRequestErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/InvalidRequestErrorBody'
      type: object
      required:
        - error
      title: InvalidRequestErrorResponse
    CreditsRequiredErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/CreditsRequiredErrorBody'
      type: object
      required:
        - error
      title: CreditsRequiredErrorResponse
    ResourceNotFoundErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ResourceNotFoundErrorBody'
      type: object
      required:
        - error
      title: ResourceNotFoundErrorResponse
    ConflictErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ConflictErrorBody'
      type: object
      required:
        - error
      title: ConflictErrorResponse
    ConcurrencyLimitExceededErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ConcurrencyLimitExceededErrorBody'
      type: object
      required:
        - error
      title: ConcurrencyLimitExceededErrorResponse
    BaseModelSlug:
      type: string
      enum:
        - typesafe/jev-1.14
        - thinkingmachines/Inkling-2-Small
        - thinkingmachines/Inkling-2-Mini
        - deepseek-ai/DeepSeek-V4.1-Flash
        - thinkingmachines/Inkling-Small
        - Qwen/Qwen3.5-4B
        - Qwen/Qwen3.5-397B-A17B
        - Qwen/Qwen3.6-35B-A3B
        - Qwen/Qwen3.8-27B
        - nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-BF16
        - nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16
        - nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-BF16
        - nvidia/NVIDIA-Nemotron-3.5-Super-120B-A12B-BF16
        - openai/gpt-6.1-sol
        - openai/gpt-6-luna
        - openai/gpt-6-sol
        - openai/gpt-6-astra
        - openai/gpt-5.6-sol
        - openai/gpt-5.6-luna
        - anthropic/claude-opus-5.5
        - anthropic/claude-sonnet-5.5
        - openai/gpt-5-mini
        - openai/gpt-5.4-mini
        - openai/gpt-5.5
        - anthropic/claude-sonnet-4.6
        - google/gemini-3.1-pro-preview
        - z-ai/glm-5.3
        - z-ai/glm-5.3-flash
        - moonshotai/kimi-k3
      title: BaseModelSlug
    SftTrainingOptions:
      properties:
        val_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Val Enabled
          description: Enable validation during training.
        val_interval_steps:
          anyOf:
            - type: integer
              maximum: 100
              minimum: 0
            - type: 'null'
          title: Val Interval Steps
          description: Training steps between validations; 0 disables validation.
        learning_rate:
          anyOf:
            - type: number
              maximum: 0.01
              minimum: 1.e-8
            - type: 'null'
          title: Learning Rate
          description: Base optimizer learning rate.
        num_steps:
          anyOf:
            - type: integer
              maximum: 100000
              minimum: 0
            - type: 'null'
          title: Num Steps
          description: >-
            Number of optimizer steps to run. Training cycles through the
            dataset, reshuffling it after each full pass. 0 only scores the
            held-out split at the starting weights.
        batch_size:
          anyOf:
            - type: integer
              maximum: 256
              minimum: 1
            - type: 'null'
          title: Batch Size
          description: Max Context window x Batch size tokens are used per optimizer update
        max_tokens_per_turn:
          anyOf:
            - type: integer
              maximum: 262144
              minimum: 2
            - type: 'null'
          title: Max Tokens Per Turn
          description: >-
            Maximum prompt and completion tokens in each trained turn; a
            trajectory with a longer turn is dropped. Defaults to the model's
            context length.
      additionalProperties: false
      type: object
      title: SftTrainingOptions
      description: >-
        SFT settings; RL options such as samplers, group_size and rollout limits
        are rejected.
    ResolvedTrajectoryTrainingOptions:
      properties:
        max_output_tokens_per_step:
          type: integer
          title: Max Output Tokens Per Step
        max_total_tokens_per_trajectory:
          type: integer
          title: Max Total Tokens Per Trajectory
        max_turns_per_trajectory:
          type: integer
          title: Max Turns Per Trajectory
        max_tool_calls_per_step:
          type: integer
          title: Max Tool Calls Per Step
        max_response_chars_per_tool_call:
          type: integer
          title: Max Response Chars Per Tool Call
        timeout_seconds:
          type: integer
          title: Timeout Seconds
      type: object
      required:
        - max_output_tokens_per_step
        - max_total_tokens_per_trajectory
        - max_turns_per_trajectory
        - max_tool_calls_per_step
        - max_response_chars_per_tool_call
        - timeout_seconds
      title: ResolvedTrajectoryTrainingOptions
    InvalidRequestErrorBody:
      properties:
        type:
          type: string
          const: invalid_request_error
          title: Type
        code:
          type: string
          const: invalid_request
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          $ref: '#/components/schemas/EmptyErrorContext'
      type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: InvalidRequestErrorBody
    CreditsRequiredErrorBody:
      properties:
        type:
          type: string
          const: billing_error
          title: Type
        code:
          type: string
          const: credits_required
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          $ref: '#/components/schemas/EmptyErrorContext'
      type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: CreditsRequiredErrorBody
    ResourceNotFoundErrorBody:
      properties:
        type:
          type: string
          const: invalid_request_error
          title: Type
        code:
          type: string
          const: resource_not_found
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          $ref: '#/components/schemas/EmptyErrorContext'
      type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: ResourceNotFoundErrorBody
    ConflictErrorBody:
      properties:
        type:
          type: string
          const: conflict_error
          title: Type
        code:
          type: string
          const: conflict
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          $ref: '#/components/schemas/EmptyErrorContext'
      type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: ConflictErrorBody
    ConcurrencyLimitExceededErrorBody:
      properties:
        type:
          type: string
          const: rate_limit_error
          title: Type
        code:
          type: string
          const: concurrency_limit_exceeded
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          $ref: '#/components/schemas/ConcurrencyLimitContext'
      type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: ConcurrencyLimitExceededErrorBody
    ApiErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ApiErrorBody'
      required:
        - error
      title: ApiErrorEnvelope
      type: object
    EmptyErrorContext:
      properties: {}
      additionalProperties: false
      type: object
      title: EmptyErrorContext
    ConcurrencyLimitContext:
      properties:
        resource:
          $ref: '#/components/schemas/ConcurrencyResource'
        limit:
          type: integer
          title: Limit
        usage:
          type: integer
          title: Usage
      additionalProperties: false
      type: object
      required:
        - resource
        - limit
        - usage
      title: ConcurrencyLimitContext
    ApiErrorBody:
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          additionalProperties: true
          title: Context
          type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: ApiErrorBody
      type: object
    ConcurrencyResource:
      type: string
      enum:
        - evaluation
        - training
      title: ConcurrencyResource
    ErrorType:
      enum:
        - invalid_request_error
        - authentication_error
        - permission_error
        - conflict_error
        - billing_error
        - rate_limit_error
        - dependency_error
        - api_error
      title: ErrorType
      type: string
  headers:
    RequestId:
      schema:
        type: string
    TrajectoryShouldRetry:
      schema:
        type: boolean
    RetryAfter:
      schema:
        type: string
  responses:
    ApiErrorResponse:
      description: >-
        Common API error. Possible codes: `authentication_required`,
        `permission_denied`, `validation_error`, `rate_limited`,
        `internal_error`, `service_unavailable`.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/RequestId'
        Trajectory-Should-Retry:
          $ref: '#/components/headers/TrajectoryShouldRetry'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorEnvelope'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Organization API key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.