Fetch Job Details
curl --request GET \
--url https://api.sutro.sh/jobs/{job_id} \
--header 'Authorization: <authorization>'import requests
url = "https://api.sutro.sh/jobs/{job_id}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.sutro.sh/jobs/{job_id}', 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.sutro.sh/jobs/{job_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sutro.sh/jobs/{job_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sutro.sh/jobs/{job_id}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sutro.sh/jobs/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"job": {
"model": "llama-3.1-8b",
"system_prompt": "You are a helpful assistant.",
"job_priority": 1,
"status": "succeeded",
"datetime_created": "2024-01-15T10:30:00Z",
"datetime_started": "2024-01-15T10:30:15Z",
"datetime_completed": "2024-01-15T10:32:15Z",
"json_schema": null,
"sampling_params": {
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 2048
},
"name": "Customer Support Batch",
"description": "Processing customer inquiries",
"dataset_id": "dataset-12345",
"input_tokens": 15420,
"output_tokens": 8230,
"job_cost": 0.0234,
"num_rows": 50,
"failure_reason": null,
"cost_estimate": 0.025,
"job_id": "job-12345"
}
}
{
"message": "No job found with ID batch_job_99999"
}
Batch API
Fetch Job Details
Retrieve details for a specific job by its ID
GET
/
jobs
/
{job_id}
Fetch Job Details
curl --request GET \
--url https://api.sutro.sh/jobs/{job_id} \
--header 'Authorization: <authorization>'import requests
url = "https://api.sutro.sh/jobs/{job_id}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.sutro.sh/jobs/{job_id}', 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.sutro.sh/jobs/{job_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sutro.sh/jobs/{job_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sutro.sh/jobs/{job_id}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sutro.sh/jobs/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"job": {
"model": "llama-3.1-8b",
"system_prompt": "You are a helpful assistant.",
"job_priority": 1,
"status": "succeeded",
"datetime_created": "2024-01-15T10:30:00Z",
"datetime_started": "2024-01-15T10:30:15Z",
"datetime_completed": "2024-01-15T10:32:15Z",
"json_schema": null,
"sampling_params": {
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 2048
},
"name": "Customer Support Batch",
"description": "Processing customer inquiries",
"dataset_id": "dataset-12345",
"input_tokens": 15420,
"output_tokens": 8230,
"job_cost": 0.0234,
"num_rows": 50,
"failure_reason": null,
"cost_estimate": 0.025,
"job_id": "job-12345"
}
}
{
"message": "No job found with ID batch_job_99999"
}
Using the API directly is not recommended for most users. Instead, we recommend using the Python SDK.
Path Parameters
string
required
The unique identifier of the job to retrieve.Example:
job-xyz123...Headers
string
required
Your Sutro API key using Key authentication scheme.Format:
Key YOUR_API_KEYExample: Authorization: Key sk_abc123...Response
object
The job object containing all metadata and status information for the requested job. See the job object fields section for detailed field descriptions.
Error Response
Returns a 404 status code if the job is not found.string
Error message indicating the job was not found
{
"job": {
"model": "llama-3.1-8b",
"system_prompt": "You are a helpful assistant.",
"job_priority": 1,
"status": "succeeded",
"datetime_created": "2024-01-15T10:30:00Z",
"datetime_started": "2024-01-15T10:30:15Z",
"datetime_completed": "2024-01-15T10:32:15Z",
"json_schema": null,
"sampling_params": {
"temperature": 0.7,
"top_p": 0.95,
"max_tokens": 2048
},
"name": "Customer Support Batch",
"description": "Processing customer inquiries",
"dataset_id": "dataset-12345",
"input_tokens": 15420,
"output_tokens": 8230,
"job_cost": 0.0234,
"num_rows": 50,
"failure_reason": null,
"cost_estimate": 0.025,
"job_id": "job-12345"
}
}
{
"message": "No job found with ID batch_job_99999"
}
Code Examples
import requests
job_id = "job-12345"
response = requests.get(
f'https://api.sutro.sh/jobs/{job_id}',
headers={'Authorization': 'Key YOUR_SUTRO_API_KEY'}
)
if response.status_code == 200:
job = response.json()['job']
print(f"Job ID: {job['job_id']}")
print(f"Status: {job['status']}")
print(f"Model: {job['model']}")
print(f"Created: {job['datetime_created']}")
if job['status'] == 'succeeded':
print(f"Rows processed: {job['num_rows']}")
print(f"Cost: ${job['job_cost']:.4f}")
print(f"Tokens: {job['input_tokens']} in, {job['output_tokens']} out")
elif job['status'] == 'failed':
print(f"Failure reason: {job['failure_reason']}")
elif response.status_code == 404:
print(f"Job not found: {job_id}")
else:
print(f"Error: {response.status_code}")
const jobId = 'batch_job_12345';
const response = await fetch(`https://api.sutro.sh/jobs/${jobId}`, {
headers: {
'Authorization': 'Key YOUR_SUTRO_API_KEY'
}
});
if (response.ok) {
const data = await response.json();
const job = data.job;
console.log(`Job ID: ${job.job_id}`);
console.log(`Status: ${job.status}`);
console.log(`Model: ${job.model}`);
if (job.status === 'succeeded') {
console.log(`Rows processed: ${job.num_rows}`);
console.log(`Cost: $${job.job_cost.toFixed(4)}`);
console.log(`Tokens: ${job.input_tokens} in, ${job.output_tokens} out`);
} else if (job.status === 'failed') {
console.log(`Failure reason:`, job.failure_reason);
}
} else if (response.status === 404) {
console.log(`Job not found: ${jobId}`);
}
# Get job details
curl -X GET "https://api.sutro.sh/jobs/batch_job_12345" \
-H "Authorization: Key YOUR_SUTRO_API_KEY"
# Pretty print with jq
curl -s -X GET "https://api.sutro.sh/jobs/batch_job_12345" \
-H "Authorization: Key YOUR_SUTRO_API_KEY" | jq '.job'
# Check job status only
curl -s -X GET "https://api.sutro.sh/jobs/batch_job_12345" \
-H "Authorization: Key YOUR_SUTRO_API_KEY" | jq -r '.job.status'
Job Object Fields
The job object returned contains the same fields as documented in the List Jobs endpoint:| Field | Type | Description |
|---|---|---|
job_id | string | Public identifier for the job |
status | string | Current status of the job (SUCCEEDED, FAILED, RUNNING, PENDING, etc.) |
model | string | The model used for the job |
system_prompt | string | null | System prompt used for the job |
job_priority | integer | Priority level of the job (0 or 1) |
datetime_created | string | ISO timestamp of when the job was created |
datetime_started | string | null | ISO timestamp of when processing began |
datetime_completed | string | null | ISO timestamp of when the job completed |
json_schema | object | null | JSON schema for structured output (if used) |
sampling_params | object | Sampling parameters used for generation |
name | string | null | Optional name for the job |
description | string | null | Optional description of the job |
dataset_id | string | null | Associated dataset identifier |
input_tokens | integer | null | Total input tokens processed |
output_tokens | integer | null | Total output tokens generated |
job_cost | number | null | Actual cost of the job in USD |
num_rows | integer | null | Number of rows processed |
failure_reason | object | null | Details if the job failed |
cost_estimate | number | null | Estimated cost before processing |
Notes
- This endpoint retrieves a single job’s complete metadata
- The
job_costfield represents the actual cost incurred after processing completes - For jobs still in progress, completion-related fields will be
null
⌘I