Skip to main content
POST
/
v1
/
preview
/
sft-training-jobs
Create Sft Training Job
curl --request POST \
  --url https://api.training.wandb.ai/v1/preview/sft-training-jobs \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "training_data_url": "<string>",
  "config": {
    "batch_size": 123,
    "learning_rate": 123,
    "metric_logging": {}
  },
  "experimental_config": {}
}
'
import requests

url = "https://api.training.wandb.ai/v1/preview/sft-training-jobs"

payload = {
"model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"training_data_url": "<string>",
"config": {
"batch_size": 123,
"learning_rate": 123,
"metric_logging": {}
},
"experimental_config": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
training_data_url: '<string>',
config: {batch_size: 123, learning_rate: 123, metric_logging: {}},
experimental_config: {}
})
};

fetch('https://api.training.wandb.ai/v1/preview/sft-training-jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.training.wandb.ai/v1/preview/sft-training-jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'training_data_url' => '<string>',
'config' => [
'batch_size' => 123,
'learning_rate' => 123,
'metric_logging' => [

]
],
'experimental_config' => [

]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.training.wandb.ai/v1/preview/sft-training-jobs"

payload := strings.NewReader("{\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"training_data_url\": \"<string>\",\n \"config\": {\n \"batch_size\": 123,\n \"learning_rate\": 123,\n \"metric_logging\": {}\n },\n \"experimental_config\": {}\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.training.wandb.ai/v1/preview/sft-training-jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"training_data_url\": \"<string>\",\n \"config\": {\n \"batch_size\": 123,\n \"learning_rate\": 123,\n \"metric_logging\": {}\n },\n \"experimental_config\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.training.wandb.ai/v1/preview/sft-training-jobs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"training_data_url\": \"<string>\",\n \"config\": {\n \"batch_size\": 123,\n \"learning_rate\": 123,\n \"metric_logging\": {}\n },\n \"experimental_config\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Schema for creating a new SFT (Supervised Fine-Tuning) TrainingJob.

The client should upload the training data (trajectories.jsonl and metadata.json) to W&B Artifacts and provide the artifact URL.

model_id
string<uuid>
required
training_data_url
string
required

W&B artifact path for training data (e.g., 'wandb-artifact:///entity/project/artifact-name:version')

config
SFTTrainingConfig · object | null

Schema for SFT training config.

experimental_config
Experimental Config · object | null

Response

Successful Response

Schema for TrainingJob response.

id
string<uuid>
required