Skip to main content

Download Training Logs

Page Outline

GET/api/v1/models/{model_id}/training-metrics/logs/download

The Download Training Logs endpoint enables authenticated users to stream and export the complete, raw log artifact generated during a specific model training run. This is essential for deep offline debugging, comprehensive auditing, or importing execution traces into external log aggregation platforms (e.g., Datadog, Splunk, ELK stack).

[!TIP] This endpoint forces a file download. If you only need to display a small subset of recent logs in a custom UI, use the paginated Get Logs endpoint instead to reduce bandwidth and latency.

Authentication Requirements

This endpoint requires secure authorization via a Bearer token.

  • Header: Authorization: Bearer <Your-JWT-Token>
  • Permissions Required: The authenticated user must have model:read or organization:viewer access rights for the model.

Path Parameters

ParameterTypeRequiredDescription
model_idstringYesThe unique identifier (mdl-xxx) of the model whose training logs you wish to retrieve.

Query Parameters

ParameterTypeDefaultDescription
run_idstringLatest CompletedThe specific training execution ID (run-xxx). Defaults to the most recent completed run if omitted.
formatstringtxtThe requested output serialization format. Supported options are txt (raw unstructured text stream) and json (an array of structured JSON objects mapped line-by-line).

Operational Behavior

When streaming the log artifact, the backend conforms to the following rules:

  1. Direct Streaming: Unlike the paginated Get Logs endpoint which wraps output in a standard JSON envelope, this endpoint streams the raw payload directly from object storage (e.g., S3 or GCS) chunk by chunk.
  2. HTTP Headers: The response strictly enforces the Content-Disposition header set to attachment, triggering an auto-download prompt in standard HTTP clients. The filename directive is intelligently populated based on the run_id and selected format.
  3. Alias Support: For legacy backward compatibility, the path /api/v1/models/{model_id}/training/metrics/logs/download is a fully supported alias.

Response Headers & Payload

Because this endpoint streams a raw file, it fundamentally differs from standard JSON API responses. There is no JSON wrapper.

HTTP Headers

  • Content-Type: text/plain (if format=txt) OR application/json (if format=json)
  • Content-Disposition: attachment; filename="training-log-run-20260313-a4b9c2.txt"

Body Example (format=txt)

2026-03-13T10:00:00.123Z [INFO] Initializing distributed training cluster.
2026-03-13T10:00:05.456Z [INFO] Successfully loaded dataset: 'churn_data_v2'. Shape: (100000, 45)
2026-03-13T10:01:22.789Z [INFO] Epoch 1/50 - Loss: 0.6543 - Val_Loss: 0.6121
2026-03-13T10:02:45.012Z [WARN] Gradient clipping triggered on layer 'dense_2'.
...

Error Codes

Ensure your download client gracefully handles these standard errors:

CodeReasonResolution
400Bad RequestYou provided an invalid format query parameter.
401UnauthorizedVerify your JWT token format and ensure it has not expired.
403ForbiddenEnsure the user has the required model:read permissions.
404Not FoundThe model_id or run_id cannot be found, or logs were purged/expired per retention policies.