SCIM 2.0
ulex SCIM 2.0 API: inbound provisioning for Okta, Entra ID and Google Workspace, ServiceProviderConfig, Schemas, ResourceTypes, Users and Groups CRUD, PatchOp, Bulk, ListResponse and filter syntax, and the directory sync loop that runs the other direction.
ulex exposes SCIM 2.0 (RFC 7643, RFC 7644) on /scim/v2, so Okta, Entra ID, Google Workspace, OneLogin, and JumpCloud can push users and groups into your tenant with no adapter in between. It also polls outbound SCIM endpoints through directory_sync connections, for the reverse direction.
Authenticate with the directory's SCIM bearer token, not an API key:
Authorization: Bearer scim_7Bq4Nxf2Vk9Lc3MdT6hR8wS1yP5aG0eJ
Content-Type: application/scim+jsonRequired scopes: scim:provision for writes, read:users and read:groups for reads. Fetching the token itself needs scim:provision too.
#Discovery
curl -sS "$BASE/scim/v2/ServiceProviderConfig" -H "Authorization: Bearer $SCIM_TOKEN"{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"],
"documentationUri": "https://docs.ulexid.com/scim/schema-reference",
"patch": { "supported": true },
"bulk": { "supported": true, "maxOperations": 100, "maxPayloadSize": 10485760 },
"filter": { "supported": true, "maxResults": 200, "comparisonOperators": ["eq", "ne", "co", "sw", "ew", "gt", "lt", "ge", "le", "pr"], "caseExact": false, "complexAttributes": false },
"changePassword": { "supported": false },
"sort": { "supported": true },
"etag": { "supported": true },
"authenticationSchemes": [
{
"type": "oauthbearertoken",
"name": "OAuth Bearer Token",
"description": "Authentication with a directory-scoped bearer token",
"specUri": "http://www.rfc-editor.org/info/rfc6750",
"primary": true
}
],
"meta": { "resourceType": "ServiceProviderConfig", "location": "https://ulexid.com/api/v1/scim/v2/ServiceProviderConfig" }
}curl -sS "$BASE/scim/v2/ResourceTypes" -H "Authorization: Bearer $SCIM_TOKEN" | jq '.Resources[] | {id, endpoint, schema, meta}'[
{ "id": "User", "endpoint": "/Users", "schema": "urn:ietf:params:scim:schemas:core:2.0:User" },
{ "id": "Group", "endpoint": "/Groups", "schema": "urn:ietf:params:scim:schemas:core:2.0:Group" }
]curl -sS "$BASE/scim/v2/Schemas" -H "Authorization: Bearer $SCIM_TOKEN" | jq '.Resources[].id'[
"urn:ietf:params:scim:schemas:core:2.0:User",
"urn:ietf:params:scim:schemas:core:2.0:Group",
"urn:ietf:params:scim:api:messages:2.0:PatchOp",
"urn:ietf:params:scim:api:messages:2.0:BulkRequest",
"urn:ietf:params:scim:api:messages:2.0:BulkResponse",
"urn:ietf:params:scim:api:messages:2.0:ListResponse",
"urn:ietf:params:scim:api:messages:2.0:Error"
]Full schema definitions: SCIM schema reference.
#Users
#Create
curl -sS -X POST "$BASE/scim/v2/Users" \
-H "Authorization: Bearer $SCIM_TOKEN" \
-H "Content-Type: application/scim+json" \
-d '{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"userName": "pat@acme.example",
"name": { "givenName": "Pat", "familyName": "Iyer", "formatted": "Pat Iyer" },
"displayName": "Pat Iyer",
"emails": [{ "value": "pat@acme.example", "type": "work", "primary": true }],
"active": true,
"title": "Support Engineer",
"department": "Customer Success",
"preferredLanguage": "en-US",
"locale": "en-US",
"externalId": "okta-00u9xK2mB7yLt4N",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"employeeNumber": "E-4417",
"costCenter": "CS-100",
"organization": "Customer Success",
"manager": { "value": "usr_01M3PSV9GRT8GQGEG686AR1W9S" }
}
}'{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"id": "usr_01M3PSWBPGS08FWV4NV7P9VNFN",
"externalId": "okta-00u9xK2mB7yLt4N",
"userName": "pat@acme.example",
"name": { "givenName": "Pat", "familyName": "Iyer", "formatted": "Pat Iyer" },
"displayName": "Pat Iyer",
"emails": [{ "value": "pat@acme.example", "type": "work", "primary": true }],
"active": true,
"title": "Support Engineer",
"department": "Customer Success",
"preferredLanguage": "en-US",
"locale": "en-US",
"meta": {
"resourceType": "User",
"created": "2026-09-29T14:47:03.000Z",
"lastModified": "2026-09-29T14:47:03.000Z",
"version": "W/\"v1.0\"",
"location": "https://ulexid.com/api/v1/scim/v2/Users/usr_01M3PSWBPGS08FWV4NV7P9VNFN"
}
}A SCIM user is a ulex user plus an organization_membership in the directory's organization with role: "member", plus a user_directory_id link. On success ulex emits dsync.user.created and user.created and writes user.created to the audit log.
#Read
curl -sS "$BASE/scim/v2/Users/usr_01M3PSWBPGS08FWV4NV7P9VNFN" -H "Authorization: Bearer $SCIM_TOKEN"
curl -sS "$BASE/scim/v2/Users?filter=userName eq \"pat@acme.example\"" -H "Authorization: Bearer $SCIM_TOKEN"{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
"totalResults": 1,
"itemsPerPage": 1,
"startIndex": 1,
"Resources": [
{ "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"], "id": "usr_01M3PSWBPGS08FWV4NV7P9VNFN", "userName": "pat@acme.example", "active": true }
]
}#List and filter
curl -sS -G "$BASE/scim/v2/Users" \
-H "Authorization: Bearer $SCIM_TOKEN" \
--data-urlencode 'filter=department eq "Customer Success" and active eq true' \
--data-urlencode 'startIndex=1' \
--data-urlencode 'count=50' \
--data-urlencode 'sortBy=userName' \
--data-urlencode 'sortOrder=ascending'{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
"totalResults": 2,
"itemsPerPage": 2,
"startIndex": 1,
"Resources": [
{ "id": "usr_01M3PSVBPGS08FWV4NV7P9VNFN", "userName": "pat@acme.example", "displayName": "Pat Iyer", "active": true },
{ "id": "usr_01M3PSWCNRG3H18C3A2AHBRYRZ", "userName": "sam@acme.example", "displayName": "Sam Rivera", "active": true }
]
}Supported filter grammar: eq ne co sw ew gt lt ge le pr, and or not, parentheses, and emails[type eq "work"].value attribute-path expressions.
| Filter | Notes |
|---|---|
userName eq "pat@acme.example" | the lookup every IdP uses |
externalId eq "okta-00u9xK2mB7yLt4N" | stable across email changes |
department eq "Customer Success" | simple attribute |
emails[type eq "work"].value eq "…" | sub-attribute path |
active eq true | |
userName co "acme" | contains |
More than one match for an eq on a unique attribute is 400 with scimType: "tooMany". A malformed filter is 400 with scimType: "invalidFilter". startIndex is 1-based; count is 1–200, default 20.
#Replace and update
curl -sS -X PUT "$BASE/scim/v2/Users/usr_01M3PSWBPGS08FWV4NV7P9VNFN" \
-H "Authorization: Bearer $SCIM_TOKEN" -H "Content-Type: application/scim+json" \
-d '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],"id":"usr_01M3PSWBPGS08FWV4NV7P9VNFN","userName":"pat@acme.example","name":{"givenName":"Pat","familyName":"Iyer"},"active":true}'PUT is a full replace. Omit active and the user becomes inactive. ulex recommends PATCH for updates; most IdPs use it correctly.
#Patch
curl -sS -X PATCH "$BASE/scim/v2/Users/usr_01M3PSWBPGS08FWV4NV7P9VNFN" \
-H "Authorization: Bearer $SCIM_TOKEN" \
-H "Content-Type: application/scim+json" \
-H 'If-Match: W/"v1.0"' \
-d '{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
"Operations": [
{ "op": "replace", "path": "name.givenName", "value": "Patricia" },
{ "op": "replace", "path": "department", "value": "Customer Experience" },
{ "op": "add", "path": "roles", "value": [{ "value": "admin" }] }
]
}'op | Effect |
|---|---|
add | sets a value, or appends to an array-valued attribute |
replace | overwrites; same as add for single-valued attributes |
remove | clears the attribute at path, or removes the array element at value |
If-Match with a stale meta.version returns 412 with scimType: "mutability". That is the intended optimistic-lock behaviour — re-read, re-apply.
#Delete
curl -sS -X DELETE "$BASE/scim/v2/Users/usr_01M3PSWBPGS08FWV4NV7P9VNFN" \
-H "Authorization: Bearer $SCIM_TOKEN" -i | head -1HTTP/2 204 No ContentEffects: status → suspended, scim.active → false, every session revoked, every refresh-token family revoked, dsync.user.deleted + user.deleted + user.suspended emitted, user.suspended written to the audit log. The record is retained for the audit trail; it is not hard-deleted until the tenant's retention window expires.
A DELETE /Users/{id} on a user who is a member of other organizations suspends the tenant-global user, which deactivates them everywhere. If a customer deprovisions one person from their own org and that person works for another customer, you need ulex to remove only the membership. That is DELETE /organizations/{id}/members/{userId} — the control-plane API, not SCIM. Point your IdP at SCIM for the right behaviour: SCIM deprovisioning is deliberately whole-tenant.
#Groups
curl -sS -X POST "$BASE/scim/v2/Groups" \
-H "Authorization: Bearer $SCIM_TOKEN" -H "Content-Type: application/scim+json" \
-d '{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
"displayName": "Support",
"externalId": "okta-g-9k2mB7yLt4N",
"members": [
{ "value": "usr_01M3PSWBPGS08FWV4NV7P9VNFN", "display": "Pat Iyer", "$ref": "https://ulexid.com/api/v1/scim/v2/Users/usr_01M3PSWBPGS08FWV4NV7P9VNFN" },
{ "value": "usr_01M3PSWCNRG3H18C3A2AHBRYRZ", "display": "Sam Rivera" }
]
}'{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
"id": "grp_01M3PSVED0M9RJTYH5AC72C253",
"externalId": "okta-g-9k2mB7yLt4N",
"displayName": "Support",
"members": [
{ "value": "usr_01M3PSWBPGS08FWV4NV7P9VNFN", "display": "Pat Iyer", "$ref": "https://ulexid.com/api/v1/scim/v2/Users/usr_01M3PSWBPGS08FWV4NV7P9VNFN" },
{ "value": "usr_01M3PSWCNRG3H18C3A2AHBRYRZ", "display": "Sam Rivera" }
],
"meta": { "resourceType": "Group", "created": "2026-09-29T14:49:02.000Z", "lastModified": "2026-09-29T14:49:02.000Z", "version": "W/\"v1.0\"" }
}A ulex group is always scoped to one organization. A SCIM group created in /scim/v2/Groups lands in the directory's organization, is stored with source: "scim" and scim_id set to the externalId.
GET, PUT, PATCH, and DELETE on /scim/v2/Groups[/{id}] behave exactly as for users. DELETE on a group removes it from memberships but does not touch the users.
#Bulk
curl -sS -X POST "$BASE/scim/v2/Bulk" \
-H "Authorization: Bearer $SCIM_TOKEN" -H "Content-Type: application/scim+json" \
-d '{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:BulkRequest"],
"failOnErrors": 1,
"Operations": [
{ "method": "POST", "path": "/Users", "bulkId": "alex", "data": { "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"], "userName": "alex@acme.example", "name": { "givenName": "Alex", "familyName": "Chen" }, "emails": [{ "value": "alex@acme.example", "primary": true }], "active": true } },
{ "method": "POST", "path": "/Users", "bulkId": "robin", "data": { "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"], "userName": "robin@acme.example", "name": { "givenName": "Robin", "familyName": "Vega" }, "emails": [{ "value": "robin@acme.example", "primary": true }], "active": true } },
{ "method": "POST", "path": "/Groups", "bulkId": "g1", "data": { "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"], "displayName": "Support", "members": [{ "value": "alex" }, { "value": "robin" }] } }
]
}'{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:BulkResponse"],
"Operations": [
{ "method": "POST", "bulkId": "alex", "version": "W/\"v1.0\"", "location": "/Users/usr_01M3PSWCNRG3H18C3A2AHBRYRZ", "status": "201" },
{ "method": "POST", "bulkId": "robin", "version": "W/\"v1.0\"", "location": "/Users/usr_01M3PSW0YRNEQQAP9T1JP9FC2Y", "status": "201" },
{ "method": "POST", "bulkId": "g1", "version": "W/\"v1.0\"", "location": "/Groups/grp_01M3PSVED0M9RJTYH5AC72C253", "status": "201" }
]
}| Rule | Value |
|---|---|
| Max operations | 100 |
| Max payload | 10 MiB |
failOnErrors | 0 = run all, report per-op; ≥1 = abort after the Nth failure |
Allowed method | POST, PUT, PATCH, DELETE |
Allowed path | /Users, /Users/{id}, /Groups, /Groups/{id} |
bulkId | required, must be unique within the request, used to cross-reference group members |
Referencing a bulkId in members | resolved within the same request; a forward reference is an error |
Exceeding 100 operations is 413 scim_bulk_exceeded. A per-operation failure appears as {"method":"POST","bulkId":"alex","status":"409","response":{…}} in the response; the HTTP status of the Bulk call itself is still 200.
#Outbound directory sync
directory_sync connections poll an upstream SCIM provider and push the results in.
{ "name": "ulex_create_directory", "arguments": {
"name": "Acme (Okta)",
"provider": "okta",
"domain": "acme.example",
"organization_id": "org_01M3PSV8HGTKQFCAYF9GDWGN3C",
"scim_base_url": "https://acme.okta.com/scim/v2",
"scim_token": "env:ULEX_TEST_OKTA_SCIM_TOKEN",
"scim_poll_interval_seconds": 900,
"user_filter": "active eq true",
"deprovision_upstream_removals": true
} }{ "name": "ulex_sync_directory", "arguments": { "directory_id": "dir_01M3PSVBF8038RK2MW2N263Q2B" } }{
"id": "job_01M3PSVQ68YGZREJKDVZSMQ64T",
"object": "directory_sync",
"directory_id": "dir_01M3PSVBF8038RK2MW2N263Q2B",
"state": "running",
"trigger": "manual",
"stats": { "users_created": 12, "users_updated": 3, "users_deactivated": 1, "users_failed": 0, "groups_synced": 4 },
"error": null,
"started_at": "2026-09-29T14:50:00.000Z",
"finished_at": null
}{ "name": "ulex_get_sync_status", "arguments": { "directory_id": "dir_01M3PSVBF8038RK2MW2N263Q2B", "sync_id": "job_01M3PSVQ68YGZREJKDVZSMQ64T" } }{
"id": "job_01M3PSWQ68YGZREJKDVZSMQ64T",
"object": "directory_sync",
"directory_id": "dir_01M3PSVBF8038RK2MW2N263Q2B",
"state": "succeeded",
"trigger": "manual",
"stats": { "users_created": 12, "users_updated": 3, "users_deactivated": 1, "users_failed": 0, "groups_synced": 4 },
"error": null,
"started_at": "2026-09-29T14:50:00.000Z",
"finished_at": "2026-09-29T14:50:04.000Z"
}state | Meaning |
|---|---|
pending | queued |
running | in progress |
succeeded | every operation succeeded |
partial | some operations failed; stats.users_failed is non-zero and error explains |
failed | the run could not complete |
cancelled | stopped by an operator |
trigger ∈ scheduled | manual | webhook | scim_push.
Provider behaviour: okta and entra_id use scim_poll_interval_seconds (RFC 7644 §3.1 default is 900); scim_generic and ulex_mock poll on the same interval; google_workspace uses Directory API pagination and a 300-second minimum.
GET /directories/{id}/syncs lists runs. GET /directories/{id}/users lists the users the directory owns, with the fields that differ from the upstream.
A directory_sync job is a fire-and-forget job. ulex_sync_directory returns immediately with state: "running". Poll ulex_get_sync_status until state is terminal. Do not treat a 200 from the trigger call as "the sync worked".
#Rate limits
| Bucket | Limit | Response on breach |
|---|---|---|
| SCIM requests | 3,000 / minute / bearer token | 429, ulex error envelope |
| Bulk operations | 100 / request | 413 scim_bulk_exceeded |
List count | 200 | clamped, not an error |
| Filter complexity | 1 attribute path, 4 boolean operators | 400 scim_invalid_filter |
#Errors
SCIM returns the RFC 7644 error body, not the ulex envelope:
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
"status": "409",
"scimType": "uniqueness",
"detail": "A User with userName pat@acme.example already exists.",
"request_id": "req_01M3PSW9R0175NAW62NYR403R8"
}scimType | HTTP | ulex code |
|---|---|---|
invalidFilter | 400 | scim_invalid_filter |
tooMany | 400 | scim_invalid_filter |
invalidSyntax | 400 | scim_invalid_syntax |
invalidPath | 400 | scim_invalid_syntax |
mutability | 400 / 412 | scim_conflict |
uniqueness | 409 | scim_conflict |
invalidValue | 400 | validation_failed |
x-ulex-request-id carries the request id in the response header on every SCIM call, and the same id is in the body of an error.
#Okta setup, verbatim
| Okta field | Value |
|---|---|
| SCIM base URL | https://ulexid.com/api/v1/scim/v2 |
| OAuth Bearer Token | the scim_… value from ulex_get_scim_configuration |
| User create | POST /Users |
| User update | PATCH /Users/{id} |
| User deactivate | DELETE /Users/{id} |
| Group push | POST /Groups, PATCH /Groups/{id} |
| Test connection | GET /Users?filter=userName eq "probe@acme.example" |
Full walkthrough with the retry and rate-limit gotchas: SCIM provisioning. Troubleshooting: SCIM issues.