# Create a run

Launch stage: GA

`POST /api/2.0/mlflow/runs/create`

`POST /api/2.0/preview/mlflow/runs/create`

Creates a new run within an experiment. A run is usually a single execution of a
 machine learning or data ETL pipeline. MLflow uses runs to track the params, metrics,
 and tags associated with a single execution.

API scopes: mlflow

## Request body

- `experiment_id` (string, optional)
  ID of the associated experiment.
- `user_id` (string, optional, Deprecated)
  ID of the user executing the run.
   This field is deprecated as of MLflow 1.0, and will be removed in a future
   MLflow release. Use 'mlflow.user' tag instead.
- `run_name` (string, optional)
  The name of the run.
- `start_time` (int64, optional)
  Unix timestamp in milliseconds of when the run started.
- `tags` (array of object, optional)
  Additional metadata for run.
  - `key` (string, optional)
    The tag key.
  - `value` (string, optional)
    The tag value.

## Returns

- `run` (object, optional)
  The newly created run.
  - `info` (object, optional)
    Run metadata.
    - `run_id` (string, optional)
      Unique identifier for the run.
    - `run_uuid` (string, optional, Deprecated)
      [Deprecated, use run_id instead] Unique identifier for the run. This field will
       be removed in a future MLflow version.
    - `experiment_id` (string, optional)
      ID of the experiment that the run belongs to.
    - `run_name` (string, optional)
      The name of the run.
    - `user_id` (string, optional, Deprecated)
      User who initiated the run.
       This field is deprecated as of MLflow 1.0, and will be removed in a future
       MLflow release. Use 'mlflow.user' tag instead.
    - `status` (string, optional)
      Current status of the run.
      Possible values:
      - `RUNNING`
      - `SCHEDULED`
      - `FINISHED`
      - `FAILED`
      - `KILLED`
    - `start_time` (int64, optional)
      Unix timestamp of when the run started in milliseconds.
    - `end_time` (int64, optional)
      Unix timestamp of when the run ended in milliseconds.
    - `artifact_uri` (string, optional)
      URI of the directory where the run's artifacts are stored. MLflow sets it when the run is
       created, as the `artifact_location` of the run's experiment followed by `/<run_id>/artifacts`.
    - `lifecycle_stage` (string, optional)
      Current life cycle stage of the run: `active` or `deleted`.
  - `data` (object, optional)
    Run data.
    - `metrics` (array of object, optional)
      Run metrics.
      - `key` (string, optional)
        The key identifying the metric.
      - `value` (double, optional)
        The value of the metric.
      - `timestamp` (int64, optional)
        Time at which the metric was recorded, as a Unix timestamp in milliseconds.
      - `step` (int64, optional)
        The step at which the metric was logged.
        Default: `0`
      - `dataset_name` (string, optional)
        The name of the dataset associated with the metric.
         E.g. “my.uc.table@2” “nyc-taxi-dataset”, “fantastic-elk-3”
      - `dataset_digest` (string, optional)
        The dataset digest of the dataset associated with the metric,
         e.g. an md5 hash of the dataset that uniquely identifies it
         within datasets of the same name.
      - `model_id` (string, optional)
        The ID of the logged model or registered model version associated with
         the metric, if applicable.
      - `run_id` (string, optional)
        The ID of the run containing the metric.
    - `params` (array of object, optional)
      Run parameters.
      - `key` (string, optional)
        Key identifying this param.
      - `value` (string, optional)
        Value associated with this param.
    - `tags` (array of object, optional)
      Additional metadata key-value pairs.
      - `key` (string, optional)
        The tag key.
      - `value` (string, optional)
        The tag value.
  - `inputs` (object, optional)
    Run inputs.
    - `dataset_inputs` (array of object, optional)
      Datasets used as inputs to the run.
      - `tags` (array of object, optional)
        A list of tags for the dataset input, e.g. a “context” tag with value “training”
        - `key` (string, required)
          The tag key.
        - `value` (string, required)
          The tag value.
      - `dataset` (object, required)
        The dataset being used as a Run input.
        - `name` (string, required)
          The name of the dataset. E.g. “my.uc.table@2” “nyc-taxi-dataset”, “fantastic-elk-3”
        - `digest` (string, required)
          Dataset digest, e.g. an md5 hash of the dataset that uniquely identifies it within datasets of the same name.
        - `source_type` (string, required)
          The type of the dataset source, e.g. ‘databricks-uc-table’, ‘DBFS’, ‘S3’, ...
        - `source` (string, required)
          Source information for the dataset. Note that the source may not exactly reproduce the
           dataset if it was transformed / modified before use with MLflow.
        - `schema` (string, optional)
          The schema of the dataset. E.g., MLflow ColSpec JSON for a dataframe, MLflow TensorSpec JSON
           for an ndarray, or another schema format.
        - `profile` (string, optional)
          The profile of the dataset. Summary statistics for the dataset, such as the number of rows
           in a table, the mean / std / mode of each column in a table, or the number of elements
           in an array.
    - `model_inputs` (array of object, optional)
      Model inputs to the Run.
      - `model_id` (string, required)
        The unique identifier of the model.

## Request

```json
{
  "experiment_id": "4150739527164012",
  "run_name": "xgboost-baseline",
  "start_time": 1762868400000,
  "tags": [
    {
      "key": "mlflow.user",
      "value": "jane.doe@example.com"
    },
    {
      "key": "model_family",
      "value": "xgboost"
    }
  ]
}
```

## Response

```json
{
  "run": {
    "info": {
      "run_id": "2a14ed5c6a87499199e0106c3501eab8",
      "run_uuid": "2a14ed5c6a87499199e0106c3501eab8",
      "experiment_id": "4150739527164012",
      "run_name": "xgboost-baseline",
      "status": "RUNNING",
      "start_time": 1762868400000,
      "artifact_uri": "dbfs:/Volumes/main/ml/experiment_artifacts/churn-prediction/2a14ed5c6a87499199e0106c3501eab8/artifacts",
      "lifecycle_stage": "active"
    },
    "data": {
      "tags": [
        {
          "key": "mlflow.user",
          "value": "jane.doe@example.com"
        },
        {
          "key": "model_family",
          "value": "xgboost"
        }
      ]
    },
    "inputs": {}
  }
}
```

