---
title: "Provision users with SCIM"
sidebarTitle: "Provision users with SCIM"
description: "Issue a directory credential, point your identity provider at the SCIM endpoint, and know exactly which SCIM requests TRUSTIVAN honors."
keywords: ["SCIM", "provisioning", "deprovisioning", "offboarding", "directory", "Okta", "Entra ID", "tws_"]
---

Single sign-on controls how someone signs in. SCIM controls whether they have
access at all: when your directory deactivates a person, TRUSTIVAN removes
their membership and ends their sessions in the same request.

You need three things first:

- A [verified domain](/how-to/set-up-single-sign-on#1-verify-your-domain).
  A directory can only provision addresses inside a domain you have proved you
  control.
- A configured identity provider. Issuing a token without one is refused.
- The `owner` role. Issuing and revoking tokens needs `identity:manage`.

SCIM is a plan feature (`scim`). The plan is checked when a token is
**issued**, never on a SCIM request, so a lapsed plan cannot stop your
directory from offboarding people.

## 1. Issue a directory credential

**Settings → Identity → SCIM provisioning**, or:

```bash
curl -s -X POST https://app.trustivan.com/api/v1/identity/scim-tokens \
  -H 'Content-Type: application/json' \
  -b cookies.txt \
  -H "X-CSRF-Token: $(grep trustivan_csrf cookies.txt | awk '{print $7}')" \
  -d '{"name": "okta-production"}'
```

The response carries three things you need:

| Field | What it is |
|---|---|
| `secret` | The bearer token, starting `tws_`. Shown once; there is no endpoint that reads it back |
| `scim_base_url` | The base URL to paste into your identity provider, ending `/api/scim/v2` |
| `scim_token` | The record: name, status, and when it was issued and last used |

`expires_at` is optional, and leaving it out means the token does **not**
expire. That is the opposite of an API key, on purpose: a directory credential
that expires unnoticed means leavers keep their access.

<Note>
  A SCIM token is not an API key. It is accepted only on `/api/scim/v2`, and an
  API key is not accepted there. An organization can hold four active tokens.
</Note>

## 2. Configure your identity provider

In your provider's provisioning settings, enter:

- **SCIM base URL (tenant URL):** the `scim_base_url` from the response.
- **Authentication:** HTTP header / OAuth bearer token, with the `secret` as
  the token.
- **Unique identifier for users:** `userName`, set to the person's email
  address.

Check the connection from a terminal before you turn provisioning on:

```bash
curl -s https://app.trustivan.com/api/scim/v2/ServiceProviderConfig \
  -H "Authorization: Bearer $SCIM_TOKEN"
```

## What is supported

TRUSTIVAN implements the part of SCIM 2.0 that directories send when they
provision people, and refuses the rest with a well-formed SCIM error instead of
ignoring it.

| Request | Behavior |
|---|---|
| `GET /ServiceProviderConfig`, `GET /ResourceTypes` | Discovery. One resource type is advertised: `User` |
| `POST /Users` | Creates the account and membership with your provider's default role. The `userName` must be an address in a verified domain |
| `GET /Users`, `GET /Users/{id}` | Lists or reads provisioned users. At most 200 per page |
| `GET /Users?filter=…` | One comparison only: `userName eq "…"` or `externalId eq "…"`. Anything else is refused with `invalidFilter` |
| `PATCH /Users/{id}` | Honors `active`. Other attributes are accepted and leave the user unchanged |
| `PUT /Users/{id}` | Honors `active` only, like `PATCH`, so a partial representation cannot clear the stored address |
| `DELETE /Users/{id}` | Treated as a deactivation, not an erasure |

Not supported: bulk operations, sorting, ETags, password change, and any
`/Groups` endpoint. Requests may be sent as `application/scim+json` or
`application/json`; responses are `application/scim+json`.

## What deactivation does

`PATCH /Users/{id}` with `active: false`, and `DELETE /Users/{id}`, do the same
thing: the person's membership in your organization is removed and their live
sessions are revoked.

The account record is kept. Deleting it would take with it the findings that
person triaged and the suppressions they approved, and would make the audit
trail unreadable. Setting `active: true` again restores the membership.

Each of these writes an entry to the identity audit trail, which is your
evidence that offboarding happened. Read it under **Settings → Audit log** or
with `GET /api/v1/identity/audit`.

## Seats

A SCIM create or reactivation that would exceed your plan's seat limit gets a
SCIM error with status `402` and writes nothing. A user your directory stages
as inactive holds no seat, and a request that removes access is never refused.

## Rotate or revoke a token

There is no in-place rotation. Issue a replacement, update your identity
provider, confirm `last_used_at` moves on the new token, then revoke the old
one. The dashboard's **Issue a replacement** action walks through the same
order.

```bash
curl -s -X DELETE "https://app.trustivan.com/api/v1/identity/scim-tokens/$TOKEN_ID" \
  -b cookies.txt \
  -H "X-CSRF-Token: $(grep trustivan_csrf cookies.txt | awk '{print $7}')"
```

Revocation is immediate and idempotent. The row is kept, and
`GET /api/v1/identity/scim-tokens` lists revoked and expired tokens alongside
active ones, so you can always answer what your organization has issued.

<Warning>
  If a token has leaked, revoke it first and replace it second. Provisioning
  pauses until your identity provider has the new one.
</Warning>

## See also

- [Set up single sign-on](/how-to/set-up-single-sign-on)
- [Tenancy and isolation](/concepts/tenancy): the three ways a person
  joins an organization and how seats bound them.
