User provisioning with the Admin API
This guide walks through provisioning users with the Admin API:
- Create or invite users with an Organization role.
- Create a user group and add the users to it.
- Create a Workspace.
- Assign the group to the Workspace with Workspace roles.
It then covers updating users and removing their access.
To provision users and groups automatically from an identity provider instead, see SCIM provisioning.
Enterprise plans only
The Admin API is available only on Enterprise plans, and access isn't self-serve. On other plans, you can't create an Admin API key, and a standard API key doesn't work with admin endpoints. To request access, contact your Mistral account team or our sales team.
Before you start
You need an Admin API key created in the Admin Panel. Every request uses the base URL https://api.mistral.ai/v1/admin and the x-api-key header. See Admin API authentication.
Assign roles by name with role_names:
- Organization roles:
member,billing_manager,organization_admin. - Workspace roles: for example
user,workspace_contributor,workspace_admin.
List every role and its UUID with GET /v1/admin/roles. See Roles and permissions for what each role grants.
Create users in bulk
Send an array of users to create them in a single request. Each entry requires email, first_name, last_name, and Organization roles in role_names. Optionally assign product seats with subscription_types (CHAT, MISTRAL_CODE).
curl -X POST https://api.mistral.ai/v1/admin/users \
-H "Content-Type: application/json" \
-H "x-api-key: $ADMIN_API_KEY" \
-d '[
{"email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace", "role_names": ["organization_admin"]},
{"email": "alan@example.com", "first_name": "Alan", "last_name": "Turing", "role_names": ["member"], "subscription_types": ["CHAT"]}
]'The response maps each email to the created user ID in email_to_user_id, and lists rejected addresses in invalid_emails. Created users sign in by entering their email and completing the account recovery flow.
The singular role and role_name fields, and legacy values such as A and M, are deprecated. Use role_names.
Invite users by email
Instead of creating users directly, you can email invitations. Recipients accept the invite to join the Organization. Pass several addresses separated by commas to invite several people at once.
curl -X POST https://api.mistral.ai/v1/admin/users-invite \
-H "Content-Type: application/json" \
-H "x-api-key: $ADMIN_API_KEY" \
-d '{"email": "grace@example.com,katherine@example.com", "role_names": ["member"]}'Invited users get a user ID only once they accept. Add them to a group after that.
List or delete pending invitations:
# List invitations
curl https://api.mistral.ai/v1/admin/users-invite \
-H "x-api-key: $ADMIN_API_KEY"
# Delete an invitation by its UUID
curl -X DELETE https://api.mistral.ai/v1/admin/users-invite/<INVITATION_UUID> \
-H "x-api-key: $ADMIN_API_KEY"Group users
A user group lets you grant access to many users at once. Create the group:
curl -X POST https://api.mistral.ai/v1/admin/user-groups \
-H "Content-Type: application/json" \
-H "x-api-key: $ADMIN_API_KEY" \
-d '{"name": "Interns", "description": "User group for interns"}'The response includes the group uuid. Add members by their user IDs:
curl -X POST https://api.mistral.ai/v1/admin/user-groups/<GROUP_UUID>/members \
-H "Content-Type: application/json" \
-H "x-api-key: $ADMIN_API_KEY" \
-d '{"user_uuids": ["<USER_UUID_1>", "<USER_UUID_2>"]}'See User groups for the concept and Manage groups and roles for every group endpoint.
Create a Workspace
Create a Workspace. admin_user_id is required: this user becomes the Workspace Admin.
curl -X POST https://api.mistral.ai/v1/admin/workspaces \
-H "Content-Type: application/json" \
-H "x-api-key: $ADMIN_API_KEY" \
-d '{
"name": "MySpace",
"description": "Small workspace",
"add_all_org_members": false,
"admin_user_id": "<USER_UUID>"
}'The response includes the Workspace uuid.
Assign the group to the Workspace
Assign the group to the Workspace with one or more Workspace roles. Every group member gets these roles, including users you add to the group later.
curl -X POST https://api.mistral.ai/v1/admin/user-groups/<GROUP_UUID>/workspaces \
-H "Content-Type: application/json" \
-H "x-api-key: $ADMIN_API_KEY" \
-d '{"workspace_uuid": "<WORKSPACE_UUID>", "role_names": ["workspace_contributor"]}'Change the roles of an existing assignment:
curl -X PATCH https://api.mistral.ai/v1/admin/user-groups/<GROUP_UUID>/workspaces/<WORKSPACE_UUID> \
-H "Content-Type: application/json" \
-H "x-api-key: $ADMIN_API_KEY" \
-d '{"role_names": ["user"]}'POST /v1/admin/user-groups/provision-workspace is deprecated. Use the endpoints above.
Manage the user lifecycle
Update a user's Organization roles or product seats. role_names is required:
curl -X PATCH https://api.mistral.ai/v1/admin/users/<USER_UUID> \
-H "Content-Type: application/json" \
-H "x-api-key: $ADMIN_API_KEY" \
-d '{"role_names": ["member"], "subscription_types": ["CHAT", "MISTRAL_CODE"]}'Remove users from a group, or remove the whole group from a Workspace, with the group endpoints in Manage groups and roles. Members removed from a group lose the Workspace roles it granted them.
Remove users who were added to a Workspace directly. This deletes their direct roles in that Workspace, but not the access they get through a group:
curl -X DELETE https://api.mistral.ai/v1/admin/workspaces/<WORKSPACE_UUID>/remove-users \
-H "Content-Type: application/json" \
-H "x-api-key: $ADMIN_API_KEY" \
-d '{"members": [{"user_uuid": "<USER_UUID_1>"}, {"user_uuid": "<USER_UUID_2>"}]}'