SCIM Directory Sync
Automate user provisioning from enterprise identity providers via SCIM 2.0.
Atlas supports SCIM 2.0 (RFC 7643/7644) for automated user provisioning from enterprise identity providers like Okta, Azure AD (Entra ID), and OneLogin. When users are added, updated, or deactivated in your corporate directory, changes are automatically synced to Atlas.
SaaS Feature
SCIM directory sync is available on app.useatlas.dev Enterprise plans. Self-hosted deployments do not include enterprise features.
Prerequisites
- Managed auth enabled
- Internal database configured (
DATABASE_URL) - Active Enterprise plan on app.useatlas.dev
- SSO configured (recommended but not required)
- Custom roles configured (for group mapping)
How It Works
- An admin generates a SCIM bearer token via the Atlas API
- The token is configured in your identity provider's SCIM provisioning settings
- When users change in the IdP (create, update, deactivate), the IdP calls Atlas SCIM endpoints
- Atlas automatically creates, updates, or suspends user accounts
- SCIM groups from the IdP can be mapped to Atlas custom roles
The SCIM 2.0 endpoints are served by the Better Auth SCIM plugin at /api/auth/scim/v2/*.
Setup
1. Generate a SCIM Token
Generate a SCIM bearer token for your organization. The token is used by your IdP to authenticate SCIM requests.
curl -X POST https://your-atlas.example.com/api/auth/scim/generate-token \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <admin-session-token>" \
-d '{
"providerId": "okta-prod",
"organizationId": "org_abc123"
}'The response includes the SCIM token. Store it securely — it is only shown once.
2. Configure Your IdP
Point your IdP's SCIM provisioning to your Atlas instance:
| Setting | Value |
|---|---|
| SCIM Base URL | https://your-atlas.example.com/api/auth/scim/v2 |
| Authentication | Bearer Token (use the token from step 1) |
| Unique identifier | userName (maps to email) |
3. Configure Group Mappings (Optional)
Map SCIM groups from your IdP to Atlas custom roles so provisioned users get the correct permissions.
curl -X POST https://your-atlas.example.com/api/v1/admin/scim/group-mappings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <admin-token>" \
-d '{
"scimGroupName": "Engineers",
"roleName": "analyst"
}'SCIM 2.0 Endpoints
The following RFC 7644 endpoints are available at /api/auth/scim/v2:
Discovery
| Method | Path | Description |
|---|---|---|
GET | /ServiceProviderConfig | SCIM server capabilities |
GET | /Schemas | Supported SCIM schemas |
GET | /Schemas/:id | Specific schema definition |
GET | /ResourceTypes | Supported resource types |
User Management
| Method | Path | Description |
|---|---|---|
GET | /Users | List users (supports SCIM filtering) |
GET | /Users/:id | Get a specific user |
POST | /Users | Create (provision) a user |
PUT | /Users/:id | Replace a user |
PATCH | /Users/:id | Partial update a user |
DELETE | /Users/:id | Deactivate a user |
Token Management
| Method | Path | Description |
|---|---|---|
POST | /api/auth/scim/generate-token | Generate SCIM bearer token |
GET | /api/auth/scim/list-provider-connections | List SCIM connections |
GET | /api/auth/scim/get-provider-connection | Get connection by provider ID |
POST | /api/auth/scim/delete-provider-connection | Delete a connection |
Admin API Endpoints
Administrative endpoints for managing SCIM connections and group mappings. All require admin role and enterprise license. Mounted at /api/v1/admin/scim.
| Method | Path | Description |
|---|---|---|
GET | / | List connections and sync status |
DELETE | /connections/:id | Revoke a SCIM connection |
GET | /group-mappings | List group → role mappings |
POST | /group-mappings | Create a group → role mapping |
DELETE | /group-mappings/:id | Delete a group → role mapping |
Error Responses
| Status | Code | When |
|---|---|---|
| 400 | validation | Invalid group name or role name |
| 403 | enterprise_required | Enterprise license not active |
| 404 | not_found | Connection/mapping/role not found |
| 409 | conflict | Duplicate group mapping |
User Attribute Mapping
The Better Auth SCIM plugin maps IdP user attributes to Atlas:
| SCIM Attribute | Atlas Field |
|---|---|
userName | User email (primary identifier) |
name.givenName + name.familyName | Display name |
emails[primary] | Email address |
active | Account status (false = suspended) |
externalId | Linked account ID in Better Auth |
User Deactivation
When a user is deactivated in your IdP (active: false), the SCIM PATCH/PUT updates the user's status in Atlas. The user's account is suspended but not deleted — this preserves the audit trail and allows reactivation.
IdP-Specific Setup
Okta
- In Okta Admin Console, go to Applications → Add Application
- Search for "SCIM 2.0 Test App (Header Auth)" or create a custom app
- Under Provisioning → Integration, set:
- SCIM connector base URL:
https://your-atlas.example.com/api/auth/scim/v2 - Unique identifier field:
userName - Authentication Mode: HTTP Header
- Authorization:
Bearer <your-scim-token>
- SCIM connector base URL:
- Enable Push New Users, Push Profile Updates, and Push Groups
Azure AD (Entra ID)
- In Azure Portal, go to Enterprise Applications → New Application
- Create a non-gallery application
- Under Provisioning, set mode to Automatic
- Set:
- Tenant URL:
https://your-atlas.example.com/api/auth/scim/v2 - Secret Token:
<your-scim-token>
- Tenant URL:
- Test the connection, then enable provisioning
OneLogin
- In OneLogin Admin, go to Applications → Add App
- Search for "SCIM Provisioner with SAML (SCIM v2 Enterprise)"
- Under Configuration, set:
- SCIM Base URL:
https://your-atlas.example.com/api/auth/scim/v2 - SCIM Bearer Token:
<your-scim-token>
- SCIM Base URL:
- Under Provisioning, enable Create, Update, and Deactivate
Admin Console
The SCIM settings page in the Admin Console (/admin/scim) provides:
- Sync Status — Active connections, provisioned user count, last sync time
- SCIM Connections — View and revoke active IdP connections
- Group Mappings — Create and manage SCIM group → Atlas role mappings
Troubleshooting
Token generation fails
Ensure the authenticated user has the admin role. Only admins can generate SCIM tokens.
IdP cannot connect
- Verify the SCIM base URL ends with
/api/auth/scim/v2(not/scim/v2) - Check that the bearer token was copied correctly (no leading/trailing whitespace)
- Ensure the Atlas API is accessible from your IdP's network
Users not being provisioned
- Check that the SCIM connection is active in
/admin/scim - Verify the IdP is sending
userNameas the email address - Check Atlas server logs for SCIM-related errors
Group mappings not applied
- Ensure custom roles exist in
/admin/rolesbefore creating mappings - Verify the SCIM group name in the mapping matches the IdP exactly (case-sensitive)
- Group mapping applies at provisioning time — existing users need manual role reassignment
See Also
- Enterprise SSO — Configure SAML/OIDC identity providers
- Custom Roles — Define granular permission-based roles
- IP Allowlisting — Restrict access by IP range
- Admin Console — Manage users and workspace settings