> ## Documentation Index
> Fetch the complete documentation index at: https://developers.partoo.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Automatic user provisioning

> Create and update Partoo users on the fly from your Identity Provider, with a custom field mapping

By default, SSO only signs in users who already have a Partoo account. With **automatic provisioning**, Partoo also creates the user on their first SSO sign-in, and keeps their profile up to date on the following ones, from the data your Identity Provider (IdP) sends.

The **field mapping** tells Partoo which SAML attribute or OIDC claim each user field is read from, so you can reuse the attributes your IdP already exposes instead of renaming them.

## Enable automatic provisioning

**1. Open the SSO configuration page**

Go to `https://app.partoo.co/settings/integrations/sso/{sso-type}`, where `{sso-type}` is `oidc` or `saml`.

**2. Map your IdP attributes**

Open the **field mapping** and, for each Partoo field, enter the name of the SAML attribute or OIDC claim it is read from.

Click **apply default mapping** to start from the names Partoo reads by default (see the table below).

**3. Turn on automatic provisioning**

Toggle **automatic provisioning** in the provisioning section, then save the configuration.

> [!TIP]
>
> The next user who signs in through SSO without a Partoo account is created automatically.

## Mapped fields

| Partoo field | Default OIDC claim | Default SAML attribute | Value expected |
| - | - | - | - |
| Email | `email` | `urn:oid:0.9.2342.19200300.100.1.3`, else `email` | The user's email. **Required.** |
| First name | `first_name` | `first_name` | **Required** to create the user. |
| Last name | `last_name` | `last_name` | **Required** to create the user. |
| Language | `lang` | `lang` | A language code such as `en`, `fr` or `pt-BR`, case-insensitive. |
| Role | `role` | `role` | A Partoo role: `BUSINESS_MANAGER`, `GROUP_MANAGER`, `ORG_MANAGER` or `ORG_ADMIN`, case-insensitive. |
| Custom role | `custom_role` | `custom_role` | The API ID of one of your [custom roles](https://developers.partoo.co/guides/api/guides/custom-roles-and-permissions.md). |
| Store codes | `businesses` | `businesses` | A list of business store codes, for a `BUSINESS_MANAGER`. |
| Groups | `groups` | `groups` | A list of group names, for a `GROUP_MANAGER`. |

> [!NOTE]
>
> Once you map at least one field, Partoo only reads the fields you mapped. Email, first name and last name are still read under their default name when you leave them out.

## Per-field options

Each mapped field, except the email, has two options:

* **Default value**: used when a user is created and the IdP sends nothing for this field. For the role, the default value is the role given to new users, `BUSINESS_MANAGER` when none is set.
* **Sync**: when enabled, the field is overwritten on every SSO sign-in. When disabled, it is only set once, when the user is created, and can then be edited in Partoo.

## How users are created and updated

> [accordion] On the first sign-in
>
> Partoo creates the user in your organization when no user exists with the email sent by your IdP:
>
> * The email, first name and last name are required. If one is missing or empty, the sign-in fails.
> * The user is created as [SSO-only](https://developers.partoo.co/guides/api/resources/settings/sso/faq.md#how-to-create-an-sso-only-user): they cannot sign in with a password and receive no invitation email.
> * Without a supported role, the user gets the default role. Without a usable language, they get French.
> * A `BUSINESS_MANAGER` gets access to the businesses whose store code was sent; a `GROUP_MANAGER` to the groups whose name was sent. Unknown store codes and group names are ignored.

> [accordion] On the following sign-ins
>
> Partoo updates the fields that have **sync** enabled and that the IdP sent. A field the IdP does not send is left unchanged.
>
> * The email is never updated: it is how Partoo finds the user.
> * A role Partoo does not recognize never changes the user's role.
> * When the role changes, the business and group accesses that no longer apply to the new role are removed.

> [accordion] When the sign-in fails
>
> The sign-in is refused, and the user is neither created nor updated, when:
>
> * the IdP sends no email, or not the email, first name and last name needed to create a user;
> * the IdP sends a value Partoo cannot store, such as a name containing code;
> * the email already belongs to a user of another organization;
> * the user is disabled in Partoo.

> [!TIP]
>
> You can still create users in advance, from the Partoo app or with the [User Creation API](https://developers.partoo.co/api-reference/users/create-user.md). Automatic provisioning then keeps them up to date on each sign-in.

> [!WARNING]
>
> Automatic provisioning does not handle departures: removing a user from your IdP does not disable or delete their Partoo account. Disable or delete it from the Partoo app or with the API, as described in [User Provisioning with Partoo API](https://developers.partoo.co/guides/api/guides/user-management.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.