Resources

SCIM issues

Diagnosing ulex SCIM in both directions: why an IdP's test connection fails, 409 uniqueness, 412 mutability, invalidFilter, users provisioned but unable to log in, deprovisioning reaching the wrong scope, and Bulk partial failures.

#Start here

bash
BASE="https://ulexid.com/api/v1"
AUTH="Authorization: Bearer $ULEX_API_KEY"
SCIM="Authorization: Bearer scim_7Bq4Nxf2Vk9Lc3MdT6hR8wS1yP5aG0eJ"

# Inbound: is the directory live, and is anything arriving?
curl -sS "$BASE/directories/$DIR_ID" -H "$AUTH" | jq '{state, inbound_scim_enabled, has_inbound_scim_token, last_sync_status, last_sync_error}'

# Does the SCIM endpoint answer the IdP's probe?
curl -sS -G "$BASE/scim/v2/Users" -H "$SCIM" --data-urlencode 'filter=userName eq "probe@acme.example"' | jq '{totalResults, itemsPerPage}'

# What arrived?
curl -sS -G "$BASE/directories/$DIR_ID/users?limit=5" -H "$AUTH" | jq '.data[] | {email, status, external_id, directory_id}'

# What events fired?
curl -sS -G "$BASE/audit-events" -H "$AUTH" --data-urlencode 'action_prefix=user.' --data-urlencode 'limit=10' \
  | jq '.data[] | {action, outcome, error_code}'

#The IdP's "Test connection" fails immediately

Okta sends GET /Users?filter=userName eq "probe@<domain>". Three causes, in order of likelihood.

CauseDiagnoseFix
wrong token401re-read it: GET /directories/{id}/scim. The token is shown once per rotation
the directory is not active403state: pending means it has not been activated. PATCH or recreate with state: "active"
inbound_scim_enabled is false403 or 404PATCH /directories/{id} with true
bash
curl -sS -G "$BASE/scim/v2/Users" -H "$SCIM" --data-urlencode 'filter=userName eq "probe@acme.example"' -i | head -1

A 200 with Resources: [] is success. Okta's test expects an empty result for a user that does not exist; anything non-2xx is a failure.

Warning

If you lost the SCIM token, do not delete and recreate the directory. That discards the scim_id mappings on every group, and the customer's next group push creates duplicates. PATCH /directories/{id} with a new scim_token instead.


#409 uniqueness

scimType: "uniqueness". Something already exists with that userName or externalId.

CaseCauseFix
every push collidesthe same person was created by another route — an OIDC login, a JIT SAML assertion, or a POST /usersreconcile before pushing: GET /scim/v2/Users?filter=externalId eq "…"
userName collides but the person is differenttwo directory entries with the same emailfix the source directory. ulex cannot represent two people with one email
externalId collidesthe IdP is reusing external ids, or externalId is not set at all and is defaultingalways send externalId; it is the join key
a group displayName collidestwo groups in one org whose names slugify the samerename in the source. 409 is the correct behaviour, not a bug
bash
# Is it a userName or an externalId collision?
curl -sS -G "$BASE/scim/v2/Users" -H "$SCIM" --data-urlencode 'filter=userName eq "pat@acme.example"' | jq '.Resources[].id'
curl -sS -G "$BASE/scim/v2/Users" -H "$SCIM" --data-urlencode 'filter=externalId eq "okta-00u9xK2mB7yLt4N"' | jq '.Resources[].id'

IdPs retry a 409 indefinitely. It is not a transient failure and retrying will not clear it. Fix the data.


#412 mutability on every update

The If-Match value is stale.

bash
# Read the current version
curl -sS "$BASE/scim/v2/Users/$USER_ID" -H "$SCIM" | jq -r '.meta.version'
# → W/"v1.0"

# Patch with it
curl -sS -X PATCH "$BASE/scim/v2/Users/$USER_ID" -H "$SCIM" \
  -H "If-Match: W/\"v1.0\"" -H "Content-Type: application/scim+json" \
  -d '{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],"Operations":[{"op":"replace","path":"department","value":"Customer Experience"}]}'
CauseFix
two sync runs overlappedre-read meta.version and re-apply. This is the lock working
the IdP caches meta.versionmost do not; Entra re-reads. If yours caches, report it — it is a real interoperability bug
the version was for a deleted-and-recreated userre-read; ids are new

Do not drop the If-Match header to make the error go away. It is the only thing preventing a lost update when two pushes race, and the resulting state is silently wrong.


#400 invalidFilter

What they sentWhy it failsWhat to send
externalId eq "x" and no user has externalIdthe attribute path does not exist on any resourceadd externalId to your pushes, or stop filtering on it
department eq "Support" and title ne "Engineer"over 4 boolean operatorsone filter per request
emails.value eq "x@y.com"bare sub-attribute paths are not supportedemails[type eq "work"].value eq "x@y.com"
active eq true where active is a stringthe comparison operators are for typed valuesactive eq true with a boolean, or filter on meta.lastModified
a URL-encoded filter with a + for a space+ is not a space in a query stringuse %20

Test any filter before you hand it to a customer:

bash
curl -sS -G "$BASE/scim/v2/Users" -H "$SCIM" --data-urlencode 'filter=department eq "Customer Success" and active eq true' | jq

#400 invalidPath

The PATCH path does not exist.

They sentCorrect form
nicknamenickName
name.firstname.givenName
emails.valueemails[type eq "work"].value
groupmembers on /Groups, or nothing on /Users — groups is read-only there
urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:employeeNumbercorrect, but only if you sent the extension

#Users provisioned but cannot log in

This is the most consequential SCIM problem, because provisioning succeeded and nothing is broken in the directory.

CauseDiagnoseFix
the organization is sso_only and has no active connection403 access_denied at loginactivate a connection, or set sso_only: false
the email domain is not a verified org domain and allow_profiles_outside_organization: false403 access_deniedverify the domain, or set the flag to true
email_verified is false and your app gates on itGET /users/{id}set it, or stop gating on it. Entra does not assert it
the user has no membership in any organizationGET /users/{id}/memberships returns []a SCIM user always gets a member membership. An empty list means the directory is not bound to the organization
the connection's allowed_domains excludes the domain403 access_deniedadd the domain
the user status is inactiveGET /users/{id}upstream active: false, or a failed sync
bash
curl -sS "$BASE/users/$USER_ID" -H "$AUTH" | jq '{email, email_verified, status, directory_id}'
curl -sS "$BASE/users/$USER_ID/memberships" -H "$AUTH" | jq '.data[] | {organization_id, role}'

#Deprovisioning removed access to the wrong organization

This is correct behaviour and it is the most common SCIM surprise.

DELETE /scim/v2/Users/{id} sets status: suspended on the tenant-global user, revokes every session in every organization, and revokes every refresh-token family.

A contractor who is in your tenant through two customers, and whom one customer deprovisions, loses access to both. RFC 7644 models users as global to the service provider, and ulex follows it.

WantCall
deprovision from a customer's IdP (correct SCIM semantics, tenant-wide)DELETE /scim/v2/Users/{id}
remove one person from one customerDELETE /organizations/{id}/members/{userId}
block a person everywhere, reversiblyPOST /users/{id}/suspend

If a customer's deprovision workflow must not affect other customers, route it through DELETE /organizations/{id}/members/{userId} in a provisioning workflow rather than through SCIM, and document that choice.


#Bulk partially failed

json
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:BulkResponse"],
  "Operations": [
    { "method": "POST", "bulkId": "alex", "status": "201", "location": "/Users/usr_01M3PSWCNRG3H18C3A2AHBRYRZ" },
    { "method": "POST", "bulkId": "robin", "status": "409", "response": { "status": "409", "scimType": "uniqueness", "detail": "A User with userName robin@acme.example already exists." } }
  ]
}

The call's HTTP status is 200 even when operations failed. Read Operations[].

statusMeaning
201created
200replaced or patched
204deleted
409uniqueness or mutability
400the individual operation was malformed
5xxour fault for that operation. Retry the whole Bulk with failOnErrors: 0

With failOnErrors: 0, a failure does not stop the rest. With >= 1, the batch aborts at the Nth failure. For a seed use 0 — you want to know about every bad row. For a mirror use 1 — a partial directory is worse than an unchanged one.

bulkId referenced from members[].value must appear earlier in the request. A forward reference is 400.


#413 scim_bulk_exceeded

Over 100 operations, or over 10 MiB. Chunk at 100.

ts
for (let i = 0; i < rows.length; i += 100) {
  const chunk = rows.slice(i, i + 100);
  // POST /scim/v2/Bulk with chunk
}

#429 from SCIM

3,000 requests per minute per bearer token. Almost always a script in a tight loop, not the IdP.

json
{ "error": { "type": "rate_limit_error", "code": "rate_limit_error", "retryable": true, "hint": "Retry after 12s." } }

#Nothing is arriving at all

bash
curl -sS -G "$BASE/audit-events" -H "$AUTH" --data-urlencode 'action_prefix=user.' --data-urlencode 'limit=5' | jq 'length'
curl -sS "$BASE/webhooks/$WHK_ID" -H "$AUTH" | jq '{status, failure_count, last_delivery_status}'
CheckBad value means
inbound_scim_enabledfalse → the endpoint is not exposed
has_inbound_scim_tokenfalse → no token was ever generated
webhook statusdisabled with failure_count: 8 → events fired and were never delivered
last_delivery_status5xx or null → your receiver is broken, and the events exist but nobody saw them

A silent SCIM endpoint looks identical to a working one from the IdP's side. Check the audit log, not the customer's dashboard.

#Reference