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

# Provision users with SCIM

> Sync users and groups from your identity provider to the Cake Platform with the SCIM 2.0 API.

The Cake Platform includes a SCIM 2.0 API, so your identity provider can create, update, and remove platform users and groups automatically. Cake enables the SCIM API for your deploy on request.

## Prerequisites

* An identity provider that supports SCIM 2.0 provisioning, such as Okta or Microsoft Entra ID
* The SCIM API enabled for your deploy. Contact your Cake team to enable it.
* `openssl`, `python3`, and `shasum` to generate a token

## SCIM endpoint

Configure your identity provider with this base URL:

```text theme={null}
https://marzipan.<base-hostname>/scim/v2
```

The API supports these resources:

| Resource | Endpoint | Required attributes |
| - | - | - |
| Users | `/Users` | `userName`, `emails` |
| Groups | `/Groups` | `displayName` |

The API supports `PATCH` operations and filtering, and returns at most 100 results per page.

Each `userName` must be a valid DNS subdomain name: letters, numbers, `-`, and `.`, starting and ending with a letter or number. If a user name fails this check, the API returns `400 Bad Request`.

## Create a SCIM token

The SCIM API authenticates requests with a bearer token. You generate the token yourself and send Cake only its SHA-256 hash, so the token never leaves your organization.

**1. Generate a token and its hash**

Run this script:

```bash theme={null}
random=$(openssl rand -base64 32 | tr '+/' '-_' | tr -d '=')
body="ckmz_${random}"
checksum=$(printf '%s' "$body" | python3 -c "import sys,zlib; print('{:08x}'.format(zlib.crc32(sys.stdin.buffer.read()) & 0xffffffff))")
token="${body}_${checksum}"
echo "Token: $token"
echo "Hash: sha256:$(printf '%s' "$token" | shasum -a 256 | cut -d' ' -f1)"
```

Tokens use the format `ckmz_<random>_<checksum>`. The `ckmz_` prefix lets secret scanning tools detect leaked tokens, and the checksum catches copy errors.

**2. Send the hash to Cake**

Send the `sha256:...` hash to your Cake team, along with a client ID that identifies the tenant this token provisions. Cake adds the hash to your deploy configuration.

**3. Configure your identity provider**

In your identity provider's SCIM settings, set the base URL to `https://marzipan.<base-hostname>/scim/v2` and the bearer token to your token.

To test the token, list users:

```bash theme={null}
curl -H "Authorization: Bearer $token" \
  https://marzipan.<base-hostname>/scim/v2/Users
```

## Tenants

Each token is tied to a client ID. The SCIM API uses that client ID to scope resources such as `externalId`. If you provision users for more than one [tenant](https://docs.cake.ai/platform/overview.md#concepts), create a separate token for each tenant.

## Rotate a token

To rotate a token, generate a new one and send its hash to Cake. After Cake adds the new hash, update your identity provider with the new token. Then ask Cake to remove the old hash.


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