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

# Cancel a fine tuning job

> Cancel a fine tuning job.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/ai/inference.yml post /ai/fine_tuning/jobs/{job_id}/cancel
openapi: 3.1.0
info:
  title: Telnyx AI Inference API
  version: 2.0.0
  description: API for AI inference, including chat completions, fine-tuning, and models.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /ai/fine_tuning/jobs/{job_id}/cancel:
    post:
      tags:
        - Fine Tuning
      summary: Cancel a fine tuning job
      description: Cancel a fine tuning job.
      operationId: cancel_new_finetuningjob_public_finetuning_post
      parameters:
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            title: Job Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FineTuningJob'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const fineTuningJob = await
            client.ai.fineTuning.jobs.cancel('job_id');


            console.log(fineTuningJob.id);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            fine_tuning_job = client.ai.fine_tuning.jobs.cancel(
                "job_id",
            )
            print(fine_tuning_job.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tfineTuningJob, err := client.AI.FineTuning.Jobs.Cancel(context.TODO(), \"job_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", fineTuningJob.ID)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
            import com.telnyx.sdk.models.ai.finetuning.jobs.FineTuningJob;
            import com.telnyx.sdk.models.ai.finetuning.jobs.JobCancelParams;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    FineTuningJob fineTuningJob = client.ai().fineTuning().jobs().cancel("job_id");
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            fine_tuning_job = telnyx.ai.fine_tuning.jobs.cancel("job_id")

            puts(fine_tuning_job)
        - lang: CLI
          source: |-
            telnyx ai:fine-tuning:jobs cancel \
              --api-key 'My API Key' \
              --job-id job_id
components:
  schemas:
    FineTuningJob:
      type: object
      title: FineTuningJob
      description: >-
        The `fine_tuning.job` object represents a fine-tuning job that has been
        created through the API.
      properties:
        id:
          type: string
          description: The name of the fine-tuned model that is being created.
        created_at:
          type: integer
          description: >-
            The Unix timestamp (in seconds) for when the fine-tuning job was
            created.
        finished_at:
          type:
            - integer
            - 'null'
          description: >-
            The Unix timestamp (in seconds) for when the fine-tuning job was
            finished. The value will be null if the fine-tuning job is still
            running.
        hyperparameters:
          type: object
          description: The hyperparameters used for the fine-tuning job.
          properties:
            n_epochs:
              type: integer
              minimum: 1
              maximum: 10
              default: 3
              description: >-
                The number of epochs to train the model for. An epoch refers to
                one full cycle through the training dataset.
          required:
            - n_epochs
        model:
          type: string
          description: The base model that is being fine-tuned.
        organization_id:
          type: string
          description: The organization that owns the fine-tuning job.
        status:
          type: string
          description: The current status of the fine-tuning job.
          enum:
            - queued
            - running
            - succeeded
            - failed
            - cancelled
        trained_tokens:
          type:
            - integer
            - 'null'
          description: >-
            The total number of billable tokens processed by this fine-tuning
            job. The value will be null if the fine-tuning job is still running.
        training_file:
          type: string
          description: The storage bucket or object used for training.
      required:
        - created_at
        - finished_at
        - hyperparameters
        - id
        - model
        - organization_id
        - status
        - trained_tokens
        - training_file
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          title: Detail
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ValidationError:
      title: ValidationError
      required:
        - loc
        - msg
        - type
      type: object
      properties:
        loc:
          title: Location
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````