---
title: "Enqueue Job"
method: POST
path: "/api/training/jobs"
tags: ["training"]
---

# Enqueue Job

`POST /api/training/jobs`

## Request body

- union
  - TrainingTracerRequest — The request that opens a training task. Tracing leads the pipeline, so this is the only action that names the source repo and the user's prompt. Both are persisted onto the task, and every later stage reads them back from there rather than restating them.
    - `orgId` string, nullable
    - `action` 'tracer', required
    - `sourceRepoUrl` string, required
    - `projectId` string, required
    - `prompt` string, required
    - `name` string, nullable
    - `environmentVariables` object
  - TrainingDraftRequest
    - `orgId` string, nullable
    - `action` 'draft', required
    - `projectId` string, required
    - `trainingTaskId` string, required
  - TrainingOptimizeRequest
    - `orgId` string, nullable
    - `action` 'optimize', required
    - `projectId` string, required
    - `trainingTaskId` string, required
  - TrainingRunRequest
    - `orgId` string, nullable
    - `action` 'training', required
    - `projectId` string, required
    - `trainingTaskId` string, required
    - `platformRunId` string, required

## Response `202`

Successful Response

- TrainingAgentQueuedResponse
  - `ok` true
  - `job` TrainingAgentJobResponse, required
    - `jobId` string, required
    - `projectId` string, required
    - `trainingTaskId` string, required
    - `action` 'draft' | 'tracer' | 'optimize' | 'training', required
    - `status` 'queued' | 'running' | 'succeeded' | 'failed' | 'blocked' | 'user_stopped' | 'cancelled', required
    - `contractApprovedAt` string, nullable
    - `contractReviewRequestedAt` string, nullable
    - `contractReviewNote` string, nullable
    - `createdAt` string, nullable, required
    - `startedAt` string, nullable
    - `finishedAt` string, nullable
    - `repoUrl` string, nullable
    - `bestModelLabel` string, nullable
    - `name` string, nullable
    - `prompt` string, nullable
    - `result` object, nullable
    - `error` string, nullable
    - `message` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/freesolo/apis/platform-backend.md) · [All operations](https://skmtc.dev/freesolo/apis/platform-backend/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/freesolo/platform-backend/revisions/5626e92675af/schema)
