> For the complete documentation index, see [llms.txt](https://herd-security.gitbook.io/herd-security-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/settings/scim-provisioning.md). Agents can also search and read this documentation through its [MCP server](https://herd-security.gitbook.io/herd-security-docs/~gitbook/mcp).

# SCIM Provisioning

Provision and deprovision Herd users and groups directly from your identity provider with Herd's SCIM 2.0 server.

## Overview

Herd exposes a **SCIM 2.0 provisioning server**, so your identity provider (Okta, Microsoft Entra ID, or any SCIM-capable IdP) can create, update, deactivate, and reactivate Herd users and groups automatically, with no periodic sync. Changes land in Herd the moment your IdP pushes them.

SCIM is an alternative to the token-based directory syncs ([Okta Group & App Sync](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/okta/okta-group-and-app-sync.md), [Entra ID User and Group Sync](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/azure-ad-configuration/azure-active-directory-user-and-group-sync.md)). With SCIM, your IdP is the source of truth and pushes changes to Herd as they happen.

***

## Creating SCIM tokens (self-serve)

SCIM tokens are managed from **SCIM provisioning** in the **API & provisioning** group on **Settings → General** (visible with the Org Integrations permission):

1. Copy the **SCIM base URL** shown on the tile and paste it into your identity provider's SCIM 2.0 provisioning settings.
2. Click **Create SCIM token**, give it a name (e.g. *Okta production provisioning*), and copy the token. **It's shown only once.** If you lose it, revoke it and create a new one.
3. Configure the token as the bearer token in your IdP.

The tile lists existing tokens with their status, prefix, creation date, and last-used time; revoke any token instantly with its revoke button (revoking stops provisioning immediately and can't be undone).

{% hint style="warning" %}
**Creating an active SCIM token makes your identity provider the source of truth for user lifecycle.** From then on, a deleted user is not restored by logging in again. They must be re-provisioned through SCIM.
{% endhint %}

***

## Connection details

* **Base URL**: shown on the SCIM provisioning tile, in the form `https://api.herdsecurity.io/scim/v2`.
* **Authentication**: HTTP `Authorization: Bearer <token>` header (the token on its own, without `Bearer` , is accepted too, for identity providers that send a pasted header value as is), using an organization-scoped SCIM token created on the tile. SCIM tokens are separate from [API keys](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/settings/api-keys.md) and grant access only to the SCIM endpoints.
* **Discovery**: Herd serves the standard `ServiceProviderConfig`, `ResourceTypes`, and `Schemas` endpoints, so most IdPs configure themselves.

***

## Supported resources and operations

**Users** and **Groups** both support these operations:

| Operation          | Users | Groups |
| ------------------ | ----- | ------ |
| List (with filter) | ✓     | ✓      |
| Get by ID          | ✓     | ✓      |
| Create             | ✓     | ✓      |
| Update (`PATCH`)   | ✓     | ✓      |
| Replace (`PUT`)    | ✓     | ✓      |
| Delete             | ✓     | ✓      |

Notes on behavior:

* **Filters** support equality only (for example, `userName eq "jane@company.com"`); other operators return `400` with SCIM type `invalidFilter`. List responses are paginated with a page-size cap of 200.
* **Responses** use the `application/scim+json` content type, and list results come back in a stable order (oldest first), so paging through them doesn't skip or repeat anyone.
* **`name.givenName` and `name.familyName`** are stored and returned on the user, and `name.formatted` is built from them (it's read-only). When your identity provider sends no `displayName` and the user has none, Herd uses the first and last name as the display name; a display name you or your identity provider set is never overwritten from the name parts alone. Sending an empty or null name part clears it.
* **`PATCH` on a user**: `active` controls activation (see deactivation below), `displayName` updates the user's display name, and `userName` updates their email. An email that collides with an existing user returns `409` (SCIM type `uniqueness`).
* **`roles` on a user** grant or withdraw [app access](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/users/app-access.md#scim-provisioning) while your identity provider decides who gets the app (the switch on the **Sign-in** card): a role that matches one of your app-access claim values gives the person the app (in your default group), and a push whose roles match none withdraws access the identity provider granted. A push without `roles` leaves app access alone, and while the switch is off Herd stores the roles but does nothing with them. In Entra, map `AppRoleAssignmentsComplex([appRoleAssignments])` to `roles`.
* **`PUT` (full replace)**: attributes Herd doesn't manage over SCIM are left untouched. An omitted `active` keeps the current activation state, and an omitted `members` on a group leaves membership alone, so a rename-only `PUT` never wipes a group's members.

***

## Deactivation and reactivation

Deprovisioning keeps training history.

* `DELETE /Users/{id}` (or `PATCH` with `active: false`) **deactivates** the user in Herd, and their record and completion history are preserved. Herd also ends their open sessions straight away, so they're signed out of the web app instead of keeping access until their session expires. Their unfinished trainings and tracks are withdrawn, as when an admin deactivates someone by hand, and they come back if SCIM reactivates the user.
* Reactivating (`active: true`) **restores** the same user and does not create a duplicate. So does creating (`POST /Users`) someone Herd has only as a deactivated user, as Okta does when you unassign and later re-assign a person: Herd restores that record and answers `201` with the same id. If the email now belongs to another active user, Herd answers `409`.
* Removing a user from a group and later re-adding them restores their prior membership (and any permissions that flow from it) immediately.

{% hint style="warning" %}
**In organizations that provision through SCIM, the IdP is authoritative.** A user deactivated via SCIM is not restored by signing in again. They must be re-provisioned through SCIM. Organizations not using SCIM keep the usual restore-on-login behavior.
{% endhint %}

***

## Guardrails

A few Herd-side group types can't be managed over SCIM:

* **Platform-managed groups** (Herd built-ins) reject modification and deletion with `403`.
* **Dynamic (rule-managed) groups** reject direct membership writes with `400`: membership is computed from the group's rules. See [dynamic groups](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/users.md#dynamic-and-smart-groups).
* **Groups used for Teams app install targeting** (either the include or the exclude group under [Teams Setup](https://herd-security.gitbook.io/herd-security-docs/getting-started/teams-setup.md#choose-who-gets-the-herd-app-in-teams)) reject deletion with `403` until an admin unsets them in Herd, so an IdP unassigning the group can't silently widen installs to the whole organization.
* Member IDs that don't belong to your organization are rejected.
* Groups that make admins: a SCIM token can't grant **Manage admins and permissions**, **Manage network access** or **Send announcements**, so SCIM can't add anyone to, or remove anyone from, a group that holds one of them, such as **Full Access**. Admins are managed in Herd, by adding people to **Full Access**.
* Herd's Operators and Reviewer groups give up their names: a `displayName eq` filter never returns them, so your IdP can't link one of its groups to them by name. If your IdP creates a group called **Operators** or **Reviewer**, or renames one to that, Herd's group becomes **Operators (Herd)** or **Reviewer (Herd)** first, keeping its members and permissions, and yours takes the plain name as an ordinary group without Herd's permissions. **Full Access** keeps its name, and a filter still finds it.
* Groups that give the app: pushing someone without the app into a group that grants any permission gives them the [app](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/users/app-access.md) and takes an app seat. A push grants while seats last and skips the rest, and Herd alerts your admins once a day per group with the count; push the skipped people again once seats are free. Taking someone out of a group doesn't remove the app.

{% hint style="info" %}
Once your IdP has authenticated with a SCIM token at least once, Herd treats your directory as connected and ticks the **Connect your team directory** step on the Dashboard's Get Started checklist.
{% endhint %}
