Use this API to track machine learning experiments, runs, and metrics, and to manage the model registry. These endpoints implement the MLflow REST API, so you can point an MLflow client at GitLab.

MLflow artifact API

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow-artifacts/artifacts

MLflow artifacts mapping to GitLab artifacts

Parameters

NameTypeDescription
path
Query
StringPath to the artifact, model version id, optionally followed by path. E.g. 15/MLmodel
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
404Not Found—

Get MLflow artifact file

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow-artifacts/artifacts/{model_version}/{file_path}

Retrieves an MLflow artifact file

Parameters

NameTypeDescription
model_version
Path, required
StringThe model version
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11
file_path
Path, required
——

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
404Not Found—

Create experiment

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/experiments/create

https://www.mlflow.org/docs/2.19.0/rest-api.html#create-experiment

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
artifact_locationStringThis will be ignored
name
Required
StringExperiment name
tagsArrayTags with information about the experiment

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMlMlflowNewExperiment
400Bad Request—
404Not Found—

Delete an experiment

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/experiments/delete

https://mlflow.org/docs/2.19.0/rest-api.html#delete-experiment

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
experiment_id
Required
StringID of the experiment

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
404Not Found—

Fetch experiment by experiment_id

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/experiments/get

https://www.mlflow.org/docs/2.19.0/rest-api.html#get-experiment

Parameters

NameTypeDescription
experiment_id
Query
StringExperiment ID, in reference to the project
Default: ``
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowGetExperiment
400Bad Request—
404Not Found—

Fetch experiment by experiment_name

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/experiments/get-by-name

https://www.mlflow.org/docs/2.19.0/rest-api.html#get-experiment-by-name

Parameters

NameTypeDescription
experiment_name
Query
StringExperiment name
Default: ``
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowGetExperiment
400Bad Request—
404Not Found—

List experiments

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/experiments/list

https://www.mlflow.org/docs/2.19.0/rest-api.html#search-experiments

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowListExperiment
404Not Found—

Search experiments

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/experiments/search

https://www.mlflow.org/docs/2.19.0/rest-api.html#search-experiments

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
filterStringThis parameter is ignored
max_resultsIntegerMaximum number of experiments to fetch in a page. Default is 200, maximum is 1000
Default: 200
order_byStringOrder criteria. Can be by a column of the experiment (created_at, name)
Default: created_at DESC
page_tokenStringToken for pagination

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMlMlflowListExperiment
400Bad Request—
404Not Found—

Sets a tag for an experiment

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/experiments/set-experiment-tag

https://www.mlflow.org/docs/2.19.0/rest-api.html#set-experiment-tag

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
experiment_id
Required
StringID of the experiment
key
Required
StringName for the tag
value
Required
StringValue for the tag

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
404Not Found—

Gets metric history for a run

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/metrics/get-history

https://www.mlflow.org/docs/2.19.0/rest-api.html#get-metric-history

Parameters

NameTypeDescription
run_id
Query, required
StringUUID of the run
metric_key
Query, required
StringName of the metric
max_results
Query
IntegerMaximum number of metrics to return. Default is 1000
Default: 1000
page_token
Query
StringToken for pagination
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowGetMetricHistory
400Bad Request—
404Not Found—

Creates a Model Version

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/model-versions/create

MLFlow Model Versions map to GitLab Model Versions. https://mlflow.org/docs/2.19.0/rest-api.html#create-modelversion

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
descriptionStringOptional description for model version
nameStringRegister model under this name This field is required
run_idStringRun ID of the candidate to be promoted to a model version
tagsArrayAdditional metadata for a model version

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMlMlflowModelVersion
400Bad Request—
404Not Found—

Fetch model version by name and version

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/model-versions/get

https://mlflow.org/docs/2.19.0/rest-api.html#get-modelversion

Parameters

NameTypeDescription
name
Query, required
StringModel version name
version
Query, required
StringModel version number
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowModelVersion
400Bad Request—
404Not Found—

Fetch the download URI for the model version

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/model-versions/get-download-uri

Returns version in MLflow format “mlflow-artifacts:<version>” https://mlflow.org/docs/2.19.0/rest-api.html#get-download-uri-for-modelversion-artifacts

Parameters

NameTypeDescription
name
Query, required
StringModel version name
version
Query, required
IntegerModel version ID
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowGetDownload
400Bad Request—
404Not Found—

Updates a Model Version

PATCH /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/model-versions/update

https://mlflow.org/docs/2.19.0/rest-api.html#update-modelversion

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
descriptionStringModel version description
nameStringModel version name

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowModelVersion
400Bad Request—
404Not Found—

Gets a Model Version by alias

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/registered-models/alias

https://mlflow.org/docs/2.19.0/rest-api.html#get-model-version-by-alias

Parameters

NameTypeDescription
name
Query
StringThe name of the model
alias
Query
StringThe alias of the model, e.g. the Semantic Version 1.0.0
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
404Not Found—

Creates a Registered Model

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/registered-models/create

MLFlow Registered Models map to GitLab Models. https://mlflow.org/docs/2.19.0/rest-api.html#create-registeredmodel

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
descriptionStringOptional description for registered model
name
Required
StringRegister models under this name
tagsArrayAdditional metadata for registered model

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMlMlflowRegisteredModel
400Bad Request—
404Not Found—

Delete a Registered Model by Name

DELETE /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/registered-models/delete

https://mlflow.org/docs/2.19.0/rest-api.html#delete-registeredmodel

Parameters

NameTypeDescription
name
Query
StringRegistered model unique name identifier, in reference to the project
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowRegisteredModel
400Bad Request—
404Not Found—

Fetch a Registered Model by Name

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/registered-models/get

https://www.mlflow.org/docs/2.19.0/rest-api.html#get-registeredmodel

Parameters

NameTypeDescription
name
Query
StringRegistered model unique name identifier, in reference to the project
Default: ``
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowRegisteredModel
400Bad Request—
404Not Found—

Fetch the latest Model Version for the given Registered Model Name

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/registered-models/get-latest-versions

https://mlflow.org/docs/2.19.0/rest-api.html#get-latest-modelversions

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
nameStringRegistered model unique name identifier, in reference to the project

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMlMlflowModelVersion
400Bad Request—
404Not Found—

Search Registered Models within a project

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/registered-models/search

https://mlflow.org/docs/2.19.0/rest-api.html#search-registeredmodels

Parameters

NameTypeDescription
filter
Query
StringFilter to search models. must be in the format name='value'. Only filtering by name is supported
max_results
Query
IntegerMaximum number of models desired. Default is 200. Max threshold is 1000
Default: 200
order_by
Query
StringOrder criteria. Can be by name or last_updated_timestamp, with optional DESC or ASC (default)Valid examples: name, name DESC, last_updated_timestamp DESCSorting by model metadata is not supported
Default: name ASC
page_token
Query
StringToken for pagination
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowRegisteredModel
400Bad Request—
404Not Found—

Update a Registered Model by Name

PATCH /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/registered-models/update

https://mlflow.org/docs/2.19.0/rest-api.html#update-registeredmodel

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
descriptionStringOptional description for registered model
nameStringRegistered model unique name identifier, in reference to the project

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowRegisteredModel
400Bad Request—
404Not Found—

Creates a Run

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/runs/create

MLFlow Runs map to GitLab Candidates. https://www.mlflow.org/docs/2.19.0/rest-api.html#create-run

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
experiment_id
Required
IntegerId for the experiment, relative to the project
run_nameStringA name for this run
start_timeIntegerUnix timestamp in milliseconds of when the run started
Default: 0
tagsArrayTags are stored, but not displayed
user_idStringThis will be ignored

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMlMlflowRun
400Bad Request—
404Not Found—

Delete a run

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/runs/delete

https://mlflow.org/docs/2.19.0/rest-api.html#delete-run

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
run_id
Required
StringUUID of the run

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
404Not Found—

Gets an MLFlow Run, which maps to GitLab Candidates

GET /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/runs/get

https://www.mlflow.org/docs/1.28.0/rest-api.html#get-run

Parameters

NameTypeDescription
run_id
Query, required
StringUUID of the candidate
run_uuid
Query
StringThis parameter is ignored
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Responses

CodeDescriptionSchema
200OKAPIEntitiesMlMlflowRun
400Bad Request—
404Not Found—

Logs multiple parameters and metrics

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/runs/log-batch

https://www.mlflow.org/docs/2.19.0/rest-api.html#log-param

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
metricsArray of objectsArray that contains metric information
Default: []
metrics[].key
Required
StringName for the metric
metrics[].stepIntegerStep at which the metric was recorded
metrics[].timestamp
Required
IntegerUnix timestamp in milliseconds when metric was recorded
metrics[].value
Required
NumberValue of the metric
paramsArray of objectsArray that contains parameter information
Default: []
params[].key
Required
StringName for the metric
params[].value
Required
StringValue of the metric
run_id
Required
StringUUID of the run

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
404Not Found—

Logs a metric to a run

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/runs/log-metric

https://www.mlflow.org/docs/1.28.0/rest-api.html#log-metric

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
key
Required
StringName for the metric
run_id
Required
StringUUID of the run
stepIntegerStep at which the metric was recorded
timestamp
Required
IntegerUnix timestamp in milliseconds when metric was recorded
value
Required
NumberValue of the metric

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
404Not Found—

Logs a parameter to a run

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/runs/log-parameter

https://www.mlflow.org/docs/2.19.0/rest-api.html#log-param

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
key
Required
StringName for the parameter
run_id
Required
StringUUID of the run
value
Required
StringValue for the parameter

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
404Not Found—

Searches runs/candidates within a project

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/runs/search

https://www.mlflow.org/docs/2.19.0/rest-api.html#search-runsexperiment_ids supports only a single experiment ID.Introduced in GitLab 16.4

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
experiment_ids
Required
ArrayIDs of the experiments to get searches from, relative to the project
max_resultsIntegerMaximum number of runs/candidates to fetch in a page. Default is 200, maximum in 1000
Default: 200
order_byStringOrder criteria. Can be by a column of the run/candidate (created_at, name) or by a metric ifprefixed by metrics. Valid examples: created_at, created_at DESC, metrics.my_metric DESCSorting by candidate parameter or metadata is not supported
Default: created_at DESC
page_tokenStringToken for pagination

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMlMlflowRun
400Bad Request—
404Not Found—

Sets a tag for a run

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/runs/set-tag

https://www.mlflow.org/docs/2.19.0/rest-api.html#set-tag

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
key
Required
StringName for the tag
run_id
Required
StringUUID of the run
value
Required
StringValue for the tag

Responses

CodeDescriptionSchema
201Created—
400Bad Request—
404Not Found—

Updates a Run

POST /api/v4/projects/{id}/ml/mlflow/api/2.0/mlflow/runs/update

MLFlow Runs map to GitLab Candidates. https://www.mlflow.org/docs/2.19.0/rest-api.html#update-run

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
Example: 11

Request body (application/json)

PropertyTypeDescription
end_timeIntegerEnding time of the run
run_id
Required
StringUUID of the candidate
statusStringStatus of the run. Accepts: [“RUNNING”, “SCHEDULED”, “FINISHED”, “FAILED”, “KILLED”]
Allowed values: RUNNING, SCHEDULED, FINISHED, FAILED, KILLED

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMlMlflowUpdateRun
400Bad Request—
404Not Found—

Schemas

Objects returned by the operations above and objects nested in their request bodies.

APIEntitiesMlMlflowExperiment

PropertyTypeDescription
artifact_locationString—
experiment_idStringExample: 1
lifecycle_stageStringExample: active
nameStringExample: my_experiment
tagsArray of APIEntitiesMlMlflowKeyValue—

APIEntitiesMlMlflowGetDownload

PropertyTypeDescription
artifact_uriStringDownload URI for MLflow artifact

APIEntitiesMlMlflowGetExperiment

PropertyTypeDescription
experimentAPIEntitiesMlMlflowExperiment—

APIEntitiesMlMlflowGetMetricHistory

PropertyTypeDescription
metricsArray of APIEntitiesMlMlflowMetric—
next_page_tokenString—

APIEntitiesMlMlflowKeyValue

PropertyTypeDescription
keyString—
valueString—

APIEntitiesMlMlflowListExperiment

PropertyTypeDescription
experimentsArray of APIEntitiesMlMlflowExperiment—

APIEntitiesMlMlflowMetric

PropertyTypeDescription
keyString—
stepInteger—
timestampIntegerUnix timestamp in milliseconds
valueNumber—

APIEntitiesMlMlflowModelVersion

PropertyTypeDescription
aliasesArray of strings—
creation_timestampInteger—
current_stageStringExample: development
descriptionString—
last_updated_timestampInteger—
nameString—
run_idString—
run_linkString—
sourceString—
statusStringExample: READY
status_messageString—
tagsArray of APIEntitiesMlMlflowKeyValue—
user_idString—
versionString—

APIEntitiesMlMlflowNewExperiment

PropertyTypeDescription
experiment_idStringExample: 1

APIEntitiesMlMlflowRegisteredModel

PropertyTypeDescription
creation_timestampInteger—
descriptionString—
last_updated_timestampInteger—
latest_versionsArray of APIEntitiesMlMlflowModelVersion—
nameString—
tagsArray of APIEntitiesMlMlflowKeyValue—
user_idString—

APIEntitiesMlMlflowRun

PropertyTypeDescription
dataObject—
data.metricsArray of APIEntitiesMlMlflowMetric—
data.paramsArray of APIEntitiesMlMlflowKeyValue—
data.tagsArray of APIEntitiesMlMlflowKeyValue—
infoAPIEntitiesMlMlflowRunInfo—

APIEntitiesMlMlflowRunInfo

PropertyTypeDescription
artifact_uriString—
end_timeIntegerUnix timestamp in milliseconds
experiment_idString—
lifecycle_stageStringExample: active
run_idString—
run_nameString—
run_uuidString—
start_timeIntegerUnix timestamp in milliseconds
statusStringExample: FINISHED
user_idString—

APIEntitiesMlMlflowUpdateRun

PropertyTypeDescription
run_infoAPIEntitiesMlMlflowRunInfo—