Skip to content

SCIM 2.0 Directory Sync API Reference

RFC 7644 SCIM 2.0 endpoints for automated user and group provisioning from enterprise identity providers.

SCIM 2.0 Directory Sync API Reference

Shaf Enterprise implements the System for Cross-domain Identity Management (SCIM 2.0) protocol specified in RFC 7643 and RFC 7644. Identity providers (IdPs) including Okta, Microsoft Entra ID (Azure AD), Google Workspace, and JumpCloud use these endpoints to automate user provisioning, profile synchronization, role mapping, and deprovisioning.


Authentication & Headers

Every SCIM request requires an enterprise SCIM Bearer token generated from Settings > SSO & SCIM.

Authorization: Bearer scim_sec_8f91c4a02e7b...
Content-Type: application/scim+json
Accept: application/scim+json

Base Endpoint: https://shaf.app/api/v1/scim/v2


Service Provider Metadata

Service Provider Configuration

Returns supported SCIM features (PATCH, filtering, bulk operations, password changes).

GET /api/v1/scim/v2/ServiceProviderConfig

{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"],
  "patch": { "supported": true },
  "bulk": { "supported": false },
  "filter": { "supported": true, "maxResults": 100 },
  "changePassword": { "supported": false },
  "sort": { "supported": false },
  "etag": { "supported": false },
  "authenticationSchemes": [
    {
      "name": "OAuth Bearer Token",
      "description": "Authentication via SCIM Bearer Token",
      "specUri": "https://datatracker.ietf.org/doc/html/rfc6750",
      "type": "oauthbearertoken",
      "primary": true
    }
  ]
}

Supported Resource Schemas

GET /api/v1/scim/v2/Schemas

Returns core user and group schemas supported by the Shaf directory synchronizer.


Users Endpoints

Validated against ScimUserSchema in shared/schemas/scim.ts.

1. List Users

GET /api/v1/scim/v2/Users

Supports pagination (startIndex, count) and filtering (filter=userName eq "user@example.com").

{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
  "totalResults": 1,
  "startIndex": 1,
  "itemsPerPage": 10,
  "Resources": [
    {
      "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
      "id": "usr_91c4a0",
      "userName": "alice@brand.com",
      "name": {
        "givenName": "Alice",
        "familyName": "Chen",
        "formatted": "Alice Chen"
      },
      "emails": [
        {
          "value": "alice@brand.com",
          "primary": true,
          "type": "work"
        }
      ],
      "roles": [
        {
          "value": "admin",
          "primary": true
        }
      ],
      "active": true,
      "meta": {
        "resourceType": "User",
        "created": "2026-09-01T12:00:00Z",
        "lastModified": "2026-11-21T15:00:00Z"
      }
    }
  ]
}

2. Create User

POST /api/v1/scim/v2/Users

{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
  "userName": "bob@brand.com",
  "name": {
    "givenName": "Bob",
    "familyName": "Taylor"
  },
  "emails": [
    {
      "value": "bob@brand.com",
      "primary": true
    }
  ],
  "roles": [
    {
      "value": "member"
    }
  ],
  "active": true
}

3. Retrieve User by ID

GET /api/v1/scim/v2/Users/:id

4. Patch User (Partial Update & Deprovisioning)

PATCH /api/v1/scim/v2/Users/:id

Validated against ScimPatchOpSchema in shared/schemas/scim.ts. Used by IdPs to deactivate employees immediately upon termination:

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

5. Delete User

DELETE /api/v1/scim/v2/Users/:id

Permanently de-provisions the user from the organization and revokes all active API tokens.


Groups Endpoints

Validated against ScimGroupSchema in shared/schemas/scim.ts. Groups represent team divisions or RBAC role sets.

1. List Groups

GET /api/v1/scim/v2/Groups

{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
  "totalResults": 2,
  "startIndex": 1,
  "itemsPerPage": 10,
  "Resources": [
    {
      "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
      "id": "grp_marketing",
      "displayName": "Shaf Admins",
      "members": [
        {
          "value": "usr_91c4a0",
          "display": "Alice Chen"
        }
      ]
    }
  ]
}

2. Create Group

POST /api/v1/scim/v2/Groups

{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
  "displayName": "Campaign Managers",
  "members": [
    {
      "value": "usr_91c4a0"
    }
  ]
}

3. Patch Group Membership

PATCH /api/v1/scim/v2/Groups/:id

{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
  "Operations": [
    {
      "op": "add",
      "path": "members",
      "value": [
        { "value": "usr_bob_02" }
      ]
    }
  ]
}

SCIM Error Format

All SCIM error responses strictly follow the RFC 7644 error schema:

{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
  "status": "409",
  "scimType": "uniqueness",
  "detail": "User with userName 'alice@brand.com' already exists."
}
HTTP Status scimType Meaning
400 invalidFilter Filter query expression syntax is invalid or unsupported.
400 invalidValue Required field is missing or contains an illegal value.
401 — Invalid or missing SCIM Bearer token.
404 — User or group resource does not exist.
409 uniqueness Proposed userName is already registered in this workspace.

Type to search…

↑↓ navigate↵ selectEsc close