Use this API to upload and download the files attached to a version of a machine learning model in the model registry. To create models and model versions, use an MLflow client.

Download an ml_model package file

GET /api/v4/projects/{id}/packages/ml_models/{model_version_id}/files/{file_name}

This feature was introduced in GitLab 16.8

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
file_name
Path, required
StringFile name
status
Query
StringPackage status
Allowed values: default, hidden
model_version_id
Path, required
StringModel version id

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Workhorse upload model package file

PUT /api/v4/projects/{id}/packages/ml_models/{model_version_id}/files/{file_name}

Introduced in GitLab 16.8

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
file_name
Path, required
StringFile name
model_version_id
Path, required
StringModel version id

Request body (multipart/form-data)

PropertyTypeDescription
file
Required
String (binary)The package file to be published (generated by Multipart middleware)
statusStringPackage status
Allowed values: default, hidden

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Workhorse authorize model package file

PUT /api/v4/projects/{id}/packages/ml_models/{model_version_id}/files/{file_name}/authorize

Introduced in GitLab 16.8

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
file_name
Path, required
StringFile name
model_version_id
Path, required
StringModel version id

Request body (application/json)

PropertyTypeDescription
statusStringPackage status
Allowed values: default, hidden

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Download an ml_model package file

GET /api/v4/projects/{id}/packages/ml_models/{model_version_id}/files/{path}/{file_name}

This feature was introduced in GitLab 16.8

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
file_name
Path, required
StringFile name
path
Path, required
StringFile directory path
status
Query
StringPackage status
Allowed values: default, hidden
model_version_id
Path, required
StringModel version id

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Workhorse upload model package file

PUT /api/v4/projects/{id}/packages/ml_models/{model_version_id}/files/{path}/{file_name}

Introduced in GitLab 16.8

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
file_name
Path, required
StringFile name
path
Path, required
StringFile directory path
model_version_id
Path, required
StringModel version id

Request body (multipart/form-data)

PropertyTypeDescription
file
Required
String (binary)The package file to be published (generated by Multipart middleware)
statusStringPackage status
Allowed values: default, hidden

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Workhorse authorize model package file

PUT /api/v4/projects/{id}/packages/ml_models/{model_version_id}/files/{path}/{file_name}/authorize

Introduced in GitLab 16.8

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
file_name
Path, required
StringFile name
path
Path, required
StringFile directory path
model_version_id
Path, required
StringModel version id

Request body (application/json)

PropertyTypeDescription
statusStringPackage status
Allowed values: default, hidden

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—