Download Training Logs
Page Outline
/api/v1/models/{model_id}/training-metrics/logs/downloadThe 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:readororganization:vieweraccess rights for the model.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | The unique identifier (mdl-xxx) of the model whose training logs you wish to retrieve. |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
run_id | string | Latest Completed | The specific training execution ID (run-xxx). Defaults to the most recent completed run if omitted. |
format | string | txt | The 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:
- Direct Streaming: Unlike the paginated
Get Logsendpoint 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. - HTTP Headers: The response strictly enforces the
Content-Dispositionheader set toattachment, triggering an auto-download prompt in standard HTTP clients. Thefilenamedirective is intelligently populated based on therun_idand selectedformat. - Alias Support: For legacy backward compatibility, the path
/api/v1/models/{model_id}/training/metrics/logs/downloadis 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(ifformat=txt) ORapplication/json(ifformat=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:
| Code | Reason | Resolution |
|---|---|---|
400 | Bad Request | You provided an invalid format query parameter. |
401 | Unauthorized | Verify your JWT token format and ensure it has not expired. |
403 | Forbidden | Ensure the user has the required model:read permissions. |
404 | Not Found | The model_id or run_id cannot be found, or logs were purged/expired per retention policies. |