GET
/
jobs
/
{job_id}
Fetch Job Details
curl --request GET \
  --url https://api.sutro.sh/jobs/{job_id} \
  --header 'Authorization: <authorization>'
{
  "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"
  }
}
Using the API directly is not recommended for most users. Instead, we recommend using the Python SDK.
Retrieve detailed information about a specific job using its job ID.

Path Parameters

job_id
string
required
The unique identifier of the job to retrieve.Example: job-xyz123...

Headers

Authorization
string
required
Your Sutro API key using Key authentication scheme.Format: Key YOUR_API_KEYExample: Authorization: Key sk_abc123...

Response

job
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.
message
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"
  }
}

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}")

Job Object Fields

The job object returned contains the same fields as documented in the List Jobs endpoint:
FieldTypeDescription
job_idstringPublic identifier for the job
statusstringCurrent status of the job (SUCCEEDED, FAILED, RUNNING, PENDING, etc.)
modelstringThe model used for the job
system_promptstring | nullSystem prompt used for the job
job_priorityintegerPriority level of the job (0 or 1)
datetime_createdstringISO timestamp of when the job was created
datetime_startedstring | nullISO timestamp of when processing began
datetime_completedstring | nullISO timestamp of when the job completed
json_schemaobject | nullJSON schema for structured output (if used)
sampling_paramsobjectSampling parameters used for generation
namestring | nullOptional name for the job
descriptionstring | nullOptional description of the job
dataset_idstring | nullAssociated dataset identifier
input_tokensinteger | nullTotal input tokens processed
output_tokensinteger | nullTotal output tokens generated
job_costnumber | nullActual cost of the job in USD
num_rowsinteger | nullNumber of rows processed
failure_reasonobject | nullDetails if the job failed
cost_estimatenumber | nullEstimated cost before processing

Notes

  • This endpoint retrieves a single job’s complete metadata
  • The job_cost field represents the actual cost incurred after processing completes
  • For jobs still in progress, completion-related fields will be null