Skip to main content

Download Model

Page Outline

Generates a time-limited signed download URL for the serialized model artifact of a specific version, allowing the caller to retrieve the model file directly from object storage.

Base Path: /api/v1/models

Method: GET

Path: /{model_id}/download

Auth: Requires a valid Bearer token (Authorization: Bearer <JWT>)

Path Parameters

ParameterTypeDescription
model_idstringUnique identifier of the model

Query Parameters

ParameterTypeDefaultDescription
version_idstringVersion to download. Defaults to the currently promoted version
formatstringpklArtifact format: pkl (Python pickle), onnx, joblib
expires_ininteger3600Signed URL expiry in seconds (max: 86400)

Behavior

  • Does not stream the file directly — returns a signed URL that expires after expires_in seconds.
  • Not all format options are available for every model or algorithm. Returns HTTP 422 if the requested format was not generated during training (e.g., onnx requires opt-in during training config).
  • An audit log entry is written with action model.artifact_downloaded, recording the version and format downloaded.
  • Returns HTTP 404 if the model or version is not found.
  • Returns HTTP 403 if the caller does not have download permissions on the model.

Response

Returns a DownloadLink object.

{
"model_id": "mdl-7f3a19bc",
"version_id": "ver-001",
"format": "pkl",
"download_url": "https://s3.amazonaws.com/rivergen-models/mdl-7f3a19bc/v3/model.pkl?X-Amz-Signature=...",
"expires_at": "2026-03-13T17:10:00Z",
"file_size_bytes": 4829340
}