docs/api_reference/source/auth/rest-api.rst
.. _auth-rest-api:
The MLflow Authentication REST API allows you to create, get, update, and delete users,
manage user permissions, and manage roles and role-based access control (RBAC).
The API supports both legacy 2.0 endpoints for user management and new 3.0
endpoints for unified permission and role management introduced in MLflow 3.13.0.
The API is hosted under the /api route on the MLflow tracking server. For example, to create
a user on a tracking server hosted at http://localhost:5000, access
http://localhost:5000/api/2.0/mlflow/users/create.
.. important::
The MLflow REST API requires content type application/json for all POST requests.
.. contents:: Table of Contents :local: :depth: 1
===========================
.. _mlflowAuthServiceCreateUser:
+-----------------------------+-------------+
| Endpoint | HTTP Method |
+=============================+=============+
| 2.0/mlflow/users/create | POST |
+-----------------------------+-------------+
.. _mlflowCreateUser:
+------------+------------+-------------+
| Field Name | Type | Description |
+============+============+=============+
| username | STRING | Username. |
+------------+------------+-------------+
| password | STRING | Password. |
+------------+------------+-------------+
.. _mlflowCreateUserResponse:
+------------+-------------------+----------------+
| Field Name | Type | Description |
+============+===================+================+
| user | :ref:mlflowUser | A user object. |
+------------+-------------------+----------------+
===========================
.. _mlflowAuthServiceGetUser:
+--------------------------+-------------+
| Endpoint | HTTP Method |
+==========================+=============+
| 2.0/mlflow/users/get | GET |
+--------------------------+-------------+
.. _mlflowGetUser:
+------------+------------+-------------+
| Field Name | Type | Description |
+============+============+=============+
| username | STRING | Username. |
+------------+------------+-------------+
.. _mlflowGetUserResponse:
+------------+-------------------+----------------+
| Field Name | Type | Description |
+============+===================+================+
| user | :ref:mlflowUser | A user object. |
+------------+-------------------+----------------+
===========================
.. _mlflowAuthServiceUpdateUserPassword:
+--------------------------------------+-------------+
| Endpoint | HTTP Method |
+======================================+=============+
| 2.0/mlflow/users/update-password | PATCH |
+--------------------------------------+-------------+
.. _mlflowUpdateUserPassword:
+------------+------------+---------------+
| Field Name | Type | Description |
+============+============+===============+
| username | STRING | Username. |
+------------+------------+---------------+
| password | STRING | New password. |
+------------+------------+---------------+
===========================
.. _mlflowAuthServiceUpdateUserAdmin:
+-----------------------------------+-------------+
| Endpoint | HTTP Method |
+===================================+=============+
| 2.0/mlflow/users/update-admin | PATCH |
+-----------------------------------+-------------+
.. _mlflowUpdateUserAdmin:
+------------+-------------+-------------------+
| Field Name | Type | Description |
+============+=============+===================+
| username | STRING | Username. |
+------------+-------------+-------------------+
| is_admin | BOOLEAN | New admin status. |
+------------+-------------+-------------------+
===========================
.. _mlflowAuthServiceDeleteUser:
+-----------------------------+-------------+
| Endpoint | HTTP Method |
+=============================+=============+
| 2.0/mlflow/users/delete | DELETE |
+-----------------------------+-------------+
.. _mlflowDeleteUser:
+------------+------------+-------------+
| Field Name | Type | Description |
+============+============+=============+
| username | STRING | Username. |
+------------+------------+-------------+
===========================
.. _mlflowAuthServiceListUsers:
+-----------------------------+-------------+
| Endpoint | HTTP Method |
+=============================+=============+
| 2.0/mlflow/users/list | GET |
+-----------------------------+-------------+
.. _mlflowListUsersResponse:
+------------+---------------------------+------------------+
| Field Name | Type | Description |
+============+===========================+==================+
| users | An array of | A list of all |
| | :ref:mlflowUser | user objects. |
+------------+---------------------------+------------------+
===========================
.. _mlflowAuthServiceGetCurrentUser:
+--------------------------------+-------------+
| Endpoint | HTTP Method |
+================================+=============+
| 2.0/mlflow/users/current | GET |
+--------------------------------+-------------+
.. _mlflowGetCurrentUserResponse:
+------------+-------------------+------------------------------+
| Field Name | Type | Description |
+============+===================+==============================+
| user | :ref:mlflowUser | The current user object. |
+------------+-------------------+------------------------------+
===========================
.. _mlflowAuthServiceGrantUserPermission:
+------------------------------------------+-------------+
| Endpoint | HTTP Method |
+==========================================+=============+
| 3.0/mlflow/users/permissions/grant | POST |
+------------------------------------------+-------------+
.. _mlflowGrantUserPermission:
+---------------+------------+---------------------------+
| Field Name | Type | Description |
+===============+============+===========================+
| username | STRING | Username. |
+---------------+------------+---------------------------+
| resource_type | STRING | Resource type |
| | | (experiment or |
| | | registered_model). |
+---------------+------------+---------------------------+
| resource_id | STRING | Resource ID or name. |
+---------------+------------+---------------------------+
| permission | STRING | Permission to grant |
| | | (READ, EDIT, |
| | | MANAGE, |
| | | USE). |
+---------------+------------+---------------------------+
===========================
.. _mlflowAuthServiceRevokeUserPermission:
+------------------------------------------+-------------+
| Endpoint | HTTP Method |
+==========================================+=============+
| 3.0/mlflow/users/permissions/revoke | POST |
+------------------------------------------+-------------+
.. _mlflowRevokeUserPermission:
+---------------+------------+---------------------------+
| Field Name | Type | Description |
+===============+============+===========================+
| username | STRING | Username. |
+---------------+------------+---------------------------+
| resource_type | STRING | Resource type |
| | | (experiment or |
| | | registered_model). |
+---------------+------------+---------------------------+
| resource_id | STRING | Resource ID or name. |
+---------------+------------+---------------------------+
===========================
.. _mlflowAuthServiceGetUserPermission:
+------------------------------------------+-------------+
| Endpoint | HTTP Method |
+==========================================+=============+
| 3.0/mlflow/users/permissions/get | GET |
+------------------------------------------+-------------+
.. _mlflowGetUserPermission:
+---------------+------------+---------------------------+
| Field Name | Type | Description |
+===============+============+===========================+
| username | STRING | Username. |
+---------------+------------+---------------------------+
| resource_type | STRING | Resource type |
| | | (experiment or |
| | | registered_model). |
+---------------+------------+---------------------------+
| resource_id | STRING | Resource ID or name. |
+---------------+------------+---------------------------+
.. _mlflowGetUserPermissionResponse:
+------------+-------------+------------------------------+
| Field Name | Type | Description |
+============+=============+==============================+
| allowed | BOOLEAN | Whether the user is allowed |
| | | to access the resource. |
+------------+-------------+------------------------------+
| permission | STRING | The effective permission |
| | | for the user on the |
| | | specified resource. |
+------------+-------------+------------------------------+
===========================
.. _mlflowAuthServiceListUserPermissions:
+------------------------------------------+-------------+
| Endpoint | HTTP Method |
+==========================================+=============+
| 3.0/mlflow/users/permissions/list | GET |
+------------------------------------------+-------------+
.. _mlflowListUserPermissions:
+------------+------------+-------------+
| Field Name | Type | Description |
+============+============+=============+
| username | STRING | Username. |
+------------+------------+-------------+
.. _mlflowListUserPermissionsResponse:
+-------------+------------+--------------------------------+
| Field Name | Type | Description |
+=============+============+================================+
| permissions | ARRAY | List of permissions for |
| | | the user across all resources. |
+-------------+------------+--------------------------------+
===========================
.. _mlflowAuthServiceListCurrentUserPermissions:
+--------------------------------------------------+-------------+
| Endpoint | HTTP Method |
+==================================================+=============+
| 3.0/mlflow/users/current/permissions | GET |
+--------------------------------------------------+-------------+
.. _mlflowListCurrentUserPermissionsResponse:
+-------------+------------+----------------------------------------+
| Field Name | Type | Description |
+=============+============+========================================+
| permissions | ARRAY | List of permissions for the |
| | | currently authenticated user. |
+-------------+------------+----------------------------------------+
===========================
.. _mlflowAuthServiceCreateRole:
+--------------------------------+-------------+
| Endpoint | HTTP Method |
+================================+=============+
| 3.0/mlflow/roles/create | POST |
+--------------------------------+-------------+
.. _mlflowCreateRole:
+-------------+------------+----------------------+
| Field Name | Type | Description |
+=============+============+======================+
| name | STRING | Role name. |
+-------------+------------+----------------------+
| description | STRING | Role description. |
+-------------+------------+----------------------+
| workspace | STRING | Workspace the role |
| | | belongs to. |
+-------------+------------+----------------------+
.. _mlflowCreateRoleResponse:
+------------+--------------------+----------------+
| Field Name | Type | Description |
+============+====================+================+
| role | :ref:mlflowRole | A role object. |
+------------+--------------------+----------------+
===========================
.. _mlflowAuthServiceGetRole:
+-----------------------------+-------------+
| Endpoint | HTTP Method |
+=============================+=============+
| 3.0/mlflow/roles/get | GET |
+-----------------------------+-------------+
.. _mlflowGetRole:
+------------+-------------+-------------+
| Field Name | Type | Description |
+============+=============+=============+
| role_id | INTEGER | Role ID. |
+------------+-------------+-------------+
.. _mlflowGetRoleResponse:
+------------+--------------------+----------------+
| Field Name | Type | Description |
+============+====================+================+
| role | :ref:mlflowRole | A role object. |
+------------+--------------------+----------------+
===========================
.. _mlflowAuthServiceListRoles:
+-----------------------------+-------------+
| Endpoint | HTTP Method |
+=============================+=============+
| 3.0/mlflow/roles/list | GET |
+-----------------------------+-------------+
.. _mlflowListRolesResponse:
+------------+---------------------------+------------------+
| Field Name | Type | Description |
+============+===========================+==================+
| roles | An array of | A list of all |
| | :ref:mlflowRole | role objects. |
+------------+---------------------------+------------------+
===========================
.. _mlflowAuthServiceUpdateRole:
+------------------------------+-------------+
| Endpoint | HTTP Method |
+==============================+=============+
| 3.0/mlflow/roles/update | PATCH |
+------------------------------+-------------+
.. _mlflowUpdateRole:
+-------------+-------------+----------------------+
| Field Name | Type | Description |
+=============+=============+======================+
| role_id | INTEGER | Role ID. |
+-------------+-------------+----------------------+
| description | STRING | New role description.|
+-------------+-------------+----------------------+
.. _mlflowUpdateRoleResponse:
+------------+--------------------+----------------+
| Field Name | Type | Description |
+============+====================+================+
| role | :ref:mlflowRole | The updated |
| | | role object. |
+------------+--------------------+----------------+
===========================
.. _mlflowAuthServiceDeleteRole:
+------------------------------+-------------+
| Endpoint | HTTP Method |
+==============================+=============+
| 3.0/mlflow/roles/delete | DELETE |
+------------------------------+-------------+
.. _mlflowDeleteRole:
+------------+-------------+-------------+
| Field Name | Type | Description |
+============+=============+=============+
| role_id | INTEGER | Role ID. |
+------------+-------------+-------------+
===========================
.. _mlflowAuthServiceAssignRole:
+------------------------------+-------------+
| Endpoint | HTTP Method |
+==============================+=============+
| 3.0/mlflow/roles/assign | POST |
+------------------------------+-------------+
.. _mlflowAssignRole:
+------------+-------------+-------------------+
| Field Name | Type | Description |
+============+=============+===================+
| username | STRING | Username. |
+------------+-------------+-------------------+
| role_id | INTEGER | Role ID to assign.|
+------------+-------------+-------------------+
| workspace | STRING | Workspace context.|
+------------+-------------+-------------------+
.. _mlflowAssignRoleResponse:
+------------+-------------+--------------------------+
| Field Name | Type | Description |
+============+=============+==========================+
| assignment | OBJECT | The assignment object, |
| | | containing id, role_id, |
| | | and user_id. |
+------------+-------------+--------------------------+
===========================
.. _mlflowAuthServiceUnassignRole:
+--------------------------------+-------------+
| Endpoint | HTTP Method |
+================================+=============+
| 3.0/mlflow/roles/unassign | DELETE |
+--------------------------------+-------------+
.. _mlflowUnassignRole:
+------------+-------------+--------------------+
| Field Name | Type | Description |
+============+=============+====================+
| username | STRING | Username. |
+------------+-------------+--------------------+
| role_id | INTEGER | Role ID to |
| | | unassign. |
+------------+-------------+--------------------+
===========================
.. _mlflowAuthServiceAddRolePermission:
+------------------------------------------+-------------+
| Endpoint | HTTP Method |
+==========================================+=============+
| 3.0/mlflow/roles/permissions/add | POST |
+------------------------------------------+-------------+
.. _mlflowAddRolePermission:
+------------------+-------------+---------------------------+
| Field Name | Type | Description |
+==================+=============+===========================+
| role_id | INTEGER | Role ID. |
+------------------+-------------+---------------------------+
| resource_type | STRING | Resource type |
| | | (experiment or |
| | | registered_model). |
+------------------+-------------+---------------------------+
| resource_pattern | STRING | Resource pattern. Use |
| | | * to match all |
| | | resources of this type. |
+------------------+-------------+---------------------------+
| permission | STRING | Permission to add. |
+------------------+-------------+---------------------------+
.. _mlflowAddRolePermissionResponse:
+----------------+--------------------------+-------------------------+
| Field Name | Type | Description |
+================+==========================+=========================+
| role_permission| OBJECT | The created permission, |
| | | containing id, role_id, |
| | | resource_type, |
| | | resource_pattern, and |
| | | permission. |
+----------------+--------------------------+-------------------------+
===========================
.. _mlflowAuthServiceRemoveRolePermission:
+------------------------------------------+-------------+
| Endpoint | HTTP Method |
+==========================================+=============+
| 3.0/mlflow/roles/permissions/remove | DELETE |
+------------------------------------------+-------------+
.. _mlflowRemoveRolePermission:
+---------------------+-------------+----------------------+
| Field Name | Type | Description |
+=====================+=============+======================+
| role_permission_id | INTEGER | Role permission ID. |
+---------------------+-------------+----------------------+
===========================
.. _mlflowAuthServiceListRolePermissions:
+------------------------------------------+-------------+
| Endpoint | HTTP Method |
+==========================================+=============+
| 3.0/mlflow/roles/permissions/list | GET |
+------------------------------------------+-------------+
.. _mlflowListRolePermissions:
+------------+-------------+-------------+
| Field Name | Type | Description |
+============+=============+=============+
| role_id | INTEGER | Role ID. |
+------------+-------------+-------------+
.. _mlflowListRolePermissionsResponse:
+-------------------+-----------+----------------------------------+
| Field Name | Type | Description |
+===================+===========+==================================+
| role_permissions | ARRAY | List of permissions for the |
| | | role across all resources. |
+-------------------+-----------+----------------------------------+
===========================
.. _mlflowAuthServiceUpdateRolePermission:
+------------------------------------------+-------------+
| Endpoint | HTTP Method |
+==========================================+=============+
| 3.0/mlflow/roles/permissions/update | PATCH |
+------------------------------------------+-------------+
.. _mlflowUpdateRolePermission:
+---------------------+-------------+---------------------+
| Field Name | Type | Description |
+=====================+=============+=====================+
| role_permission_id | INTEGER | Role permission ID. |
+---------------------+-------------+---------------------+
| permission | STRING | New permission. |
+---------------------+-------------+---------------------+
.. _mlflowUpdateRolePermissionResponse:
+-----------------+------------+-------------------------+
| Field Name | Type | Description |
+=================+============+=========================+
| role_permission | OBJECT | The updated permission, |
| | | containing id, role_id, |
| | | resource_type, |
| | | resource_pattern, and |
| | | permission. |
+-----------------+------------+-------------------------+
===========================
.. _mlflowAuthServiceListUserRoles:
+----------------------------------+-------------+
| Endpoint | HTTP Method |
+==================================+=============+
| 3.0/mlflow/users/roles/list | GET |
+----------------------------------+-------------+
.. _mlflowListUserRoles:
+------------+------------+-------------+
| Field Name | Type | Description |
+============+============+=============+
| username | STRING | Username. |
+------------+------------+-------------+
.. _mlflowListUserRolesResponse:
+------------+---------------------------+----------------------+
| Field Name | Type | Description |
+============+===========================+======================+
| roles | An array of | List of roles |
| | :ref:mlflowRole | assigned to user. |
+------------+---------------------------+----------------------+
===========================
.. _mlflowAuthServiceListRoleUsers:
+----------------------------------+-------------+
| Endpoint | HTTP Method |
+==================================+=============+
| 3.0/mlflow/roles/users/list | GET |
+----------------------------------+-------------+
.. _mlflowListRoleUsers:
+------------+-------------+-------------+
| Field Name | Type | Description |
+============+=============+=============+
| role_id | INTEGER | Role ID. |
+------------+-------------+-------------+
.. _mlflowListRoleUsersResponse:
+-------------+-----------+----------------------------------+
| Field Name | Type | Description |
+=============+===========+==================================+
| assignments | ARRAY | List of role assignments, |
| | | each containing id, role_id, |
| | | and user_id. |
+-------------+-----------+----------------------------------+
===========================
.. _auth-rest-struct:
.. _mlflowUser:
+------------------------------+----------------------------------------------------+------------------------------------------------------------------+
| Field Name | Type | Description |
+==============================+====================================================+==================================================================+
| id | STRING | User ID. |
+------------------------------+----------------------------------------------------+------------------------------------------------------------------+
| username | STRING | Username. |
+------------------------------+----------------------------------------------------+------------------------------------------------------------------+
| is_admin | BOOLEAN | Whether the user is an admin. |
+------------------------------+----------------------------------------------------+------------------------------------------------------------------+
| roles | An array of :ref:mlflowRole | Roles assigned to the user. |
+------------------------------+----------------------------------------------------+------------------------------------------------------------------+
.. note::
The roles field is only included in the response from
users/list. It is not present when calling users/get
or users/current. The users/current endpoint also
includes an additional is_basic_auth boolean field.
.. _mlflowPermission:
Permission level for a user on a resource.
+----------------+--------------------------------------+ | Name | Description | +================+======================================+ | READ | Can read. | +----------------+--------------------------------------+ | EDIT | Can read and update. | +----------------+--------------------------------------+ | MANAGE | Can read, update, delete and manage. | +----------------+--------------------------------------+ | NO_PERMISSIONS | No permissions. | +----------------+--------------------------------------+
.. _mlflowRole:
+-------------+-------------+---------------------------+
| Field Name | Type | Description |
+=============+=============+===========================+
| id | INTEGER | Role ID. |
+-------------+-------------+---------------------------+
| name | STRING | Role name. |
+-------------+-------------+---------------------------+
| description | STRING | Role description. |
+-------------+-------------+---------------------------+
| workspace | STRING | Workspace the role |
| | | belongs to. |
+-------------+-------------+---------------------------+
| permissions | ARRAY | List of permissions |
| | | associated with the role. |
+-------------+-------------+---------------------------+