Sync Deel users to identity providers
Overview
This guide demonstrates how to automatically sync user accounts from Deel HRIS to identity providers like Okta, Azure AD, or OneLogin using the SCIM 2.0 API. You will learn how to provision identity provider accounts when employees are hired in Deel, update their information when it changes, and de-provision them when employment ends.
This workflow enables Deel to be your single source of truth for employee data, automatically granting access to corporate systems and SSO applications based on Deel employment status.
When to use this workflow
Use this workflow when you need to:
- Use Deel as the primary source of truth for employee data
- Automatically provision SSO accounts when employees are hired in Deel
- Grant access to corporate systems based on Deel employment status
- Keep identity provider user profiles synchronized with Deel HRIS data
- Automatically revoke access when contracts end in Deel
- Sync both employees and contractors to your identity provider
- Maintain consistent user data across your organization
Prerequisites
Before you begin, ensure you have:
- A Deel organization account with SCIM API access
- An identity provider (Okta, Azure AD, OneLogin, etc.) with SCIM or API support
- A valid Deel API token with
Users:readscope - API credentials for your identity provider with user provisioning permissions
- A middleware service or scheduled job to orchestrate the synchronization
- Administrative access to both systems for configuration
This workflow requires a middleware service to fetch users from Deel and push them to your identity provider. Direct SCIM provisioning from Deel to identity providers is not natively supported and must be implemented via API integration.
Step-by-step workflow
This example demonstrates syncing users from Deel HRIS to Okta, but the same principles apply to Azure AD, OneLogin, and other identity providers with provisioning APIs.
Fetch users from Deel HRIS
Query Deel SCIM API to retrieve all active users in your organization.
Example response from Deel:
Transform Deel user data
Map Deel SCIM attributes to your identity provider’s user schema.
Store a mapping between Deel user IDs and identity provider user IDs in a database to efficiently track which users have already been provisioned and need updates versus new provisioning.
Provision users in identity provider
Create accounts in your identity provider for users found in Deel HRIS.
Okta provisioning:
Azure AD provisioning:
The user account is now created in your identity provider with access to SSO applications.
Sync user updates from Deel
When employee information changes in Deel, update their identity provider profile.
Scenario: Employee receives a promotion in Deel
The identity provider profile is updated to reflect the employee’s new role and department.
Handle contract terminations
When employment ends in Deel (contract terminated, offboarded), deactivate or remove the user from your identity provider.
Option 1: Deactivate user (recommended)
Option 2: Delete user (Azure AD)
Deleting users from identity providers removes their access to all applications and is irreversible. Deactivation is recommended to preserve audit trails and enable potential rehires.
Common scenarios
Scenario 1: Syncing only specific contract types
Filter Deel users by employment type (EOR employees, contractors, etc.) before provisioning.
This allows selective provisioning based on employment classification.
Scenario 2: Mapping Deel departments to IdP groups
Automatically assign users to identity provider groups based on their Deel department.
Users automatically receive group-based access to applications based on their department.
Scenario 3: Webhook-driven real-time sync
Use Deel webhooks to trigger immediate synchronization when user data changes.
This enables real-time synchronization triggered by Deel events instead of polling.
Scenario 4: Handling manager hierarchies
Sync reporting relationships from Deel to identity provider org charts.
Organizational hierarchies from Deel are replicated in your identity provider.
Best practices
Store user mappings persistently
- Use a database: Store mappings between Deel user IDs and identity provider user IDs
- Track sync state: Record last sync timestamps for each user
- Store user snapshots: Keep previous versions of user data to detect changes efficiently
- Handle mapping failures: Log users that fail to map and retry later
- Clean up orphaned records: Remove mappings for users deleted from both systems
- Backup mappings regularly: Ensure you can restore synchronization state if needed
Implement idempotent operations
- Check before creating: Query identity provider before provisioning to avoid duplicates
- Use upsert patterns: Update if exists, create if not
- Handle 409 conflicts: If user already exists, treat as success and update instead
- Track operation results: Log whether operation was create, update, or skip
- Retry safely: Ensure retries don’t create duplicate users or trigger errors
- Validate email uniqueness: Confirm emails are unique before provisioning
Optimize sync frequency
- Use webhooks when possible: Real-time sync via Deel webhooks for immediate updates
- Schedule regular polls: Run full sync every 15-30 minutes as backup
- Incremental updates: Only sync users who changed since last sync
- Off-peak full syncs: Schedule comprehensive syncs during low-traffic hours
- Rate limit awareness: Throttle requests to respect identity provider API limits
- Monitor sync duration: Track how long syncs take and optimize if needed
Handle errors gracefully
- Retry transient failures: Implement exponential backoff for network errors
- Log all errors: Track which users failed to sync and why
- Alert on repeated failures: Notify administrators of persistent sync issues
- Continue on individual failures: Don’t stop entire sync if one user fails
- Validate data before sending: Check required fields are present
- Handle API changes: Monitor for identity provider API version updates
Security and authentication
- Rotate API tokens: Update Deel and identity provider tokens every 90 days
- Use dedicated service accounts: Create specific accounts for sync operations
- Encrypt stored credentials: Secure API tokens in environment variables or vaults
- Limit token scopes: Grant only Users:read in Deel and user provisioning in IdP
- Audit sync operations: Log all user provisioning, updates, and deactivations
- Monitor for unauthorized access: Track API usage patterns for anomalies
Data consistency and validation
- Validate email formats: Ensure emails are valid before provisioning
- Check required fields: Confirm firstName, lastName, email are present
- Normalize data: Standardize department names and titles before mapping
- Handle missing data: Provide defaults for optional fields
- Verify after operations: Query identity provider after provisioning to confirm success
- Run reconciliation reports: Periodically compare Deel and IdP user lists
Troubleshooting
User already exists in identity provider
When provisioning a Deel user, the identity provider returns a conflict error indicating the user already exists.
Solution:
- Query the identity provider by email to find the existing user
- Store the mapping between Deel user ID and identity provider user ID
- Update the existing user profile instead of creating a new one
- Mark the operation as successful since the desired state is achieved
Prevention: Before provisioning, check if a user with the same email already exists in the identity provider.
Deel API rate limits exceeded
Fetching users from Deel SCIM API returns 429 errors due to rate limiting.
Solution:
- Implement exponential backoff: wait increasing intervals between retries
- Reduce pagination page size from 100 to 50 users per request
- Increase time between sync runs (e.g., from 10 to 20 minutes)
- Use webhooks instead of polling for real-time updates
- Cache Deel user data and only fetch changes since last sync
Best practice: Fetch users during off-peak hours and use incremental syncs based on meta.lastModified timestamps.
Identity provider API authentication fails
Requests to provision or update users in the identity provider fail with 401 Unauthorized errors.
Solution:
- Verify API token is correct and not expired (Okta SSWS tokens)
- For Azure AD, confirm OAuth2 client credentials are valid and token is refreshed
- Check token has required scopes/permissions for user provisioning
- Validate token format:
SSWS {token}for Okta,Bearer {token}for Azure AD - Test authentication separately before running full sync
Common causes:
- Expired tokens (Azure AD tokens expire after 1 hour)
- Incorrect token type (using personal token instead of service token)
- Insufficient permissions granted to the API token
Manager relationships not syncing
Manager assignments from Deel are not appearing in the identity provider org chart.
Solution:
- Ensure managers are provisioned in the identity provider before assigning them to employees
- Sync users in hierarchical order: executives → managers → employees
- Store mappings of Deel manager IDs to identity provider user IDs
- Run a second pass after initial provisioning to set manager relationships
- Handle cases where manager is not found gracefully (skip or log warning)
Example workflow:
- Pass 1: Provision all users without manager assignments
- Pass 2: Update each user with their manager reference
Department groups not assigned
Users are provisioned but not automatically added to department-based groups in the identity provider.
Solution:
- Verify department values from Deel match your group mapping configuration
- Ensure identity provider groups exist before attempting assignment
- Call group assignment API after user provisioning succeeds
- Normalize department names (trim whitespace, handle case sensitivity)
- Provide a default group for users without valid department mappings
Debugging: Log the department value from Deel and the group IDs being assigned to identify mismatches.
Sync process running too long
Full synchronization of all users takes hours to complete, delaying updates.
Solution:
- Implement incremental sync: only process users modified since last sync
- Use Deel’s
meta.lastModifiedfield to filter recently changed users - Run parallel processing for independent user provisioning operations
- Reduce page size and optimize database queries for user mapping lookups
- Switch from polling to webhook-driven sync for real-time updates
Optimization: For large organizations (1000+ users), use webhooks for changes and schedule full reconciliation weekly instead of every sync.