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

# SCIM reference

> The SCIM 2.0 server: authentication, the attributes it accepts and ignores, filters, PATCH, and every error it sends.

Scoutworks runs a SCIM 2.0 server (RFC 7643 and RFC 7644) for each identity connection. Entra ID and Google set themselves up from the [setup guides](https://developers.scoutworks.app/scim-sso/overview.md); this page is for checking their traffic, or for pointing another SCIM client at Scoutworks.

## Base URL and authentication

```text theme={null}
https://api.scoutworks.app/scim/v2/{connectionId}
```

Every request carries the connection's SCIM token as a bearer token:

```http theme={null}
Authorization: Bearer swscim_…
```

* A token reaches **only its own connection**, and only `/scim/v2`. A Scoutworks API key cannot call SCIM, and a SCIM token cannot call the API.
* The token is shown once, when it is made. Scoutworks keeps only a keyed hash of it and its last four characters.
* **Rotate token** makes a new one. The old one keeps working for 7 days, so you can paste the new one into your identity provider without a gap. **Revoke** stops a token at once.
* Bulk, sorting, password changes and OAuth client credentials are not offered: the bearer token is the only way in.

Requests may be sent as `application/scim+json` or `application/json`, up to 1 MB. Every response is `application/scim+json`. An attribute with no value is left out of a response, never sent as `null`.

## Endpoints

| Method and path | What it does |
| - | - |
| `GET /ServiceProviderConfig` | PATCH and filtering supported (at most 200 results); ETags supported; bulk, sort and password change not supported |
| `GET /ResourceTypes`, `GET /ResourceTypes/{id}` | `User` and `Group` |
| `GET /Schemas`, `GET /Schemas/{id}` | The User, enterprise User and Group schemas, with every attribute Scoutworks stores and which are read-only |
| `GET /Users` | List or [filter](#filters) users. `startIndex` is 1-based; `count` is 100 by default, 200 at most |
| `POST /Users` | Create a user. `201` with a `Location` header |
| `GET /Users/{id}` | Read a user. A suspended user (`active: false`) is still returned |
| `PUT /Users/{id}` | Replace a user's attributes. Attributes you leave out are cleared, except `externalId`, which is kept |
| `PATCH /Users/{id}` | Change a user. See [PATCH](#patch) |
| `DELETE /Users/{id}` | Remove the user's access in every group this connection manages. `204`; a second `DELETE` is `404` |
| `GET /Groups` | List or filter groups. `excludedAttributes=members` leaves the members out |
| `POST /Groups` | Create a group with its members. `201` |
| `GET /Groups/{id}` | Read a group |
| `PUT /Groups/{id}` | Replace a group and its members |
| `PATCH /Groups/{id}` | Rename a group, or add and remove members |
| `DELETE /Groups/{id}` | Delete a group. Its members lose what it granted, and its mappings go with it |
| `GET /Me`, `POST /Bulk`, `POST /.search`, `POST /Users/.search`, `POST /Groups/.search` | `501`: not supported |

`id` is the ID Scoutworks gives each user and group. It is never the person's Scoutworks account ID.

**ETags.** Every user and group has a version: `meta.version` and the `ETag` header are `W/"<n>"`. Send `If-Match` on a `PUT`, `PATCH` or `DELETE` to make it conditional: a different version is `412`. Without `If-Match` the write goes ahead.

## User attributes

| SCIM attribute | Used for |
| - | - |
| `userName` | **Required.** The person's sign-in email, compared without regard to case. Must be an email address, and unique on the connection |
| `externalId` | The directory's own ID for the person (Entra `objectId`, Google user ID). Unique on the connection. Sign-in uses it to find the person the directory sent |
| `emails` | The `primary` address, else the `work` one, else the first. It links an existing Scoutworks account only when it is on one of your verified domains |
| `name.givenName`, `name.familyName` | First and last name |
| `displayName` | Shown in the connection's people list only |
| `title` | Shown in the connection's people list only |
| `phoneNumbers` | The `mobile` number. It fills the person's phone in Scoutworks only when that is empty |
| `active` | `false` suspends the person's access in the groups this connection manages; `true` restores it. `"True"` and `"False"` as strings are accepted |
| `urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:employeeNumber` | Their Scout membership number. It fills the field only when it is empty |
| `groups` | Read-only. Set group membership through `/Groups` |
| `id`, `meta`, `schemas` | Read-only |

**Accepted and ignored:** every other attribute, for example `name.formatted`, `nickName`, `preferredLanguage`, `locale`, `timezone`, `addresses`, `password`, and the enterprise `manager`, `department`, `organization` and `costCenter`. Scoutworks does not store them, and sending them is not an error.

A user's name and email reach their Scoutworks account only when the account belongs to this directory: it was created by this connection, or its address is on your verified domain, and the person is in no group or district outside this connection's reach. Otherwise the directory's values are kept on the connection and shown, but the person's own profile is left alone.

`userName` and `externalId` cannot both change in one request: a request that changes both is `400` with `scimType` `mutability`. Change one at a time.

## Group attributes

| SCIM attribute | Used for |
| - | - |
| `displayName` | **Required.** Unique on the connection, compared without regard to case |
| `externalId` | The directory's own ID for the group. Unique on the connection |
| `members[].value` | The SCIM `id` of each user in the group. An ID that is not one of this connection's users is dropped |
| `id`, `meta`, `schemas` | Read-only |

A group grants nothing until an admin maps it to a role in Scoutworks.

## Filters

`GET /Users` and `GET /Groups` take `filter`, as RFC 7644 § 3.4.2.2 defines it:

| | Supported |
| - | - |
| Operators | `eq`, `ne`, `co`, `sw`, `pr`, `and`, `or`, and parentheses |
| User attributes | `userName`, `externalId`, `emails.value`, `emails[type eq "work"].value`, `displayName`, `active`, `id` |
| Group attributes | `displayName`, `externalId`, `id`, `members.value` |

`userName`, `emails.value` and `displayName` compare without regard to case; `externalId` and `id` with it. Any other attribute or operator (`ew`, `gt`, `ge`, `lt`, `le`), or a filter longer than 2,048 characters, is `400` with `scimType` `invalidFilter`.

A filter that matches nobody is `200` with `totalResults: 0` and an empty `Resources`, never `404`. Entra's connection test relies on it:

```http theme={null}
GET /scim/v2/{connectionId}/Users?filter=userName eq "nobody@1stexample.org.uk"
```

```json theme={null}
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
  "totalResults": 0,
  "startIndex": 1,
  "itemsPerPage": 0,
  "Resources": []
}
```

## PATCH

A `PATCH` body is a `PatchOp` with an `Operations` array of `add`, `replace` and `remove`, with or without a `path`. Scoutworks applies the operations, then writes only what changed, so a replayed `PATCH` changes nothing and returns `200`.

It accepts the forms Entra and Google really send:

* **Operation names in any case:** `Replace` works as `replace`.
* **Booleans as strings:** `"active": "False"`.
* **No path:** a `replace` or `add` whose `value` is an object of attributes, including dotted names (`name.givenName`) and extension names (`urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:employeeNumber`).
* **Filtered paths:** `emails[type eq "work"].value`. An `eq` filter that matches nothing adds the entry.
* **Extension paths** with a colon or a dot: `urn:…:enterprise:2.0:User:manager` or `urn:…:enterprise:2.0:User.manager`.
* **Group member removal** as a `remove` on `members` with a value array (Entra without `aadOptscim062020`), or as a path `members[value eq "…"]` (with it).
* **`operations`** in lower case, as well as `Operations`.

Removing something that is already gone is not an error. Changing a read-only attribute (`id`, `meta`, `groups`) is `400` with `scimType` `mutability`.

Suspending a person:

```json theme={null}
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
  "Operations": [{ "op": "replace", "path": "active", "value": false }]
}
```

## Errors

Every error uses the SCIM Error schema, with `status` as a string and a `scimType` where one applies:

```json theme={null}
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
  "status": "409",
  "scimType": "uniqueness",
  "detail": "A user with this userName or externalId is already provisioned on this connection."
}
```

| Status | `scimType` | When | What your client should do |
| - | - | - | - |
| 400 | `invalidFilter` | The filter uses an attribute or operator Scoutworks does not support | Use the attributes and operators above |
| 400 | `invalidSyntax` | The body is not JSON, not an object, or a `PATCH` has no `Operations` | Fix the request |
| 400 | `invalidValue` | An attribute is the wrong shape (a `userName` that is not an email), **or** Scoutworks refused the change: the last admin, an admin a directory may not touch, a Young Leader rule. `detail` says which. A refused deactivate (`active: false`) or `DELETE` is the exception: it answers `200` / `204`, because the directory's view is stored and the person keeps their access | Nothing to retry. The refusal is in the provisioning log; an admin decides |
| 400 | `invalidPath`, `noTarget` | A `PATCH` path Scoutworks cannot read, a `remove` with no path, or a filtered path that matches nothing to change | Fix the path |
| 400 | `mutability` | A read-only attribute, or `userName` and `externalId` changed together | Change one at a time |
| 401 | | No token, or a token that is unknown, revoked, expired or another connection's. Always the same answer, with `WWW-Authenticate: Bearer realm="scim"` | Check the token and the tenant URL |
| 404 | | No such user or group **on this connection**. An ID from another connection is always `404`, never `403`. Also a second `DELETE` | Treat the resource as gone |
| 409 | `uniqueness` | A user with that `userName` or `externalId`, or a group with that `displayName` or `externalId`, is already on the connection | Look it up with a filter, then `PATCH` it. Entra does this on its own |
| 412 | | `If-Match` names an older version | Read it again, then retry |
| 413 | | The body is larger than 1 MB | Send fewer members per request |
| 429 | | A [rate limit](https://developers.scoutworks.app/scim-sso/limits.md#rate-limits) | Wait for `Retry-After` seconds, then retry |
| 501 | | `/Me`, `/Bulk` or `.search` | Not supported |
| 503 | | The connection is paused, by an admin or by the [circuit breaker](https://developers.scoutworks.app/scim-sso/safety.md#circuit-breaker). Nothing was changed | Wait for `Retry-After` seconds (300), then retry. Never treat it as "deleted" |
| 500 | | Something went wrong at Scoutworks | Retry later. We are alerted |

Entra and Google both honour `Retry-After` on `429` and `503`, and both retry a `503` rather than mark people deleted. That is why a paused connection answers `503`: nobody loses access while it is paused, and the directory catches up when it is resumed.

## Users and memberships

A SCIM user is a person's **access in your organisation**, not their Scoutworks account. One account can be in several groups and districts, each managed by its own connection, and can also be a parent.

* `active: false` suspends their volunteer roles in the groups this connection manages. It never closes their account or touches their other groups.
* `DELETE` removes those roles. The record is kept for 30 days, so a `POST` with the same `externalId` within that time restores their access and history.
* Access itself comes from group mapping: the role, sections and job flags each mapped group grants, combined. A user in no mapped group gets the connection's default access, which is "no access" unless an admin sets one.


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