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

# Cancel Training Run Route

> Cancel a pending or running training run.



## OpenAPI

````yaml /openapi.json post /api/v1/train/{training_run_id}/cancel
openapi: 3.1.0
info:
  title: Trajectory API
  version: 0.1.0
servers:
  - url: https://api.trajectory.ai
security: []
paths:
  /api/v1/train/{training_run_id}/cancel:
    post:
      tags:
        - training
      summary: Cancel Training Run Route
      description: Cancel a pending or running training run.
      operationId: cancelTrainingRun
      parameters:
        - name: training_run_id
          in: path
          required: true
          schema:
            type: string
            title: Training Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrainingRunResponse'
        default:
          $ref: '#/components/responses/ApiErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    TrainingRunResponse:
      properties:
        training_run_id:
          type: string
          title: Training Run Id
        pipeline_run_id:
          type: string
          title: Pipeline Run Id
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: User-facing training run name; null for legacy rows.
        xid:
          anyOf:
            - type: string
            - type: 'null'
          title: Xid
        status:
          $ref: '#/components/schemas/TrainingRunLifecycleStatus'
        bench_id:
          type: string
          title: Bench Id
        base_model_id:
          type: string
          title: Base Model Id
        training_options:
          additionalProperties: true
          type: object
          title: Training Options
        created_by:
          type: string
          title: Created By
        created_at:
          type: string
          format: date-time
          title: Created At
        failure:
          anyOf:
            - $ref: '#/components/schemas/AsyncFailure'
            - type: 'null'
          description: Structured failure when status is failed.
      type: object
      required:
        - training_run_id
        - pipeline_run_id
        - display_name
        - xid
        - status
        - bench_id
        - base_model_id
        - training_options
        - created_by
        - created_at
      title: TrainingRunResponse
    TrainingRunLifecycleStatus:
      type: string
      enum:
        - pending
        - running
        - cancelling
        - succeeded
        - failed
        - cancelled
      title: TrainingRunLifecycleStatus
    AsyncFailure:
      properties:
        type:
          type: string
          title: Type
          description: Stable category used for exception mapping.
        code:
          type: string
          title: Code
          description: Stable programmatic reason for the asynchronous failure.
        message:
          type: string
          title: Message
          description: Human-readable explanation for this failure occurrence.
        context:
          additionalProperties: true
          type: object
          title: Context
          description: Machine-readable values specific to this failure code.
      type: object
      required:
        - type
        - code
        - message
      title: AsyncFailure
    ApiErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ApiErrorBody'
      required:
        - error
      title: ApiErrorEnvelope
      type: object
    ApiErrorBody:
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
        code:
          title: Code
          type: string
        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
    ErrorType:
      enum:
        - invalid_request_error
        - authentication_error
        - permission_error
        - conflict_error
        - rate_limit_error
        - dependency_error
        - api_error
      title: ErrorType
      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'
  headers:
    RequestId:
      schema:
        type: string
    TrajectoryShouldRetry:
      schema:
        type: boolean
    RetryAfter:
      schema:
        type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Organization API key

````