# SCIM Reference

### SCIM Request

Processes a request from a SCIM IdP, creates a response, and alerts of required changes to make to your users.

#### Arguments

- **method** : 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' (required)
  
  The HTTP method of the request from the SCIM IdP

- **pathAndQueryParams** : string (required)  
  The path and any included URL query parameters from the request URL (e.g. '/Users?filter=userName eq example@propelauth.com')

- **body** : object  
  The body of the request from the SCIM IdP

- **scimApiKey** : string  
  The SCIM Connection API Key from the Authorization header (can also pass the full 'Bearer scim... header)

#### Successful Response

- **status** : 'Completed' | 'ActionRequired'  
  When 'Completed', the SCIM request was fully processed and you can return the response to the IdP. When 'ActionRequired', you need to take action in your system (like creating/disabling a user) before responding to the IdP.

- **connectionId** : string  
  The ID of the SCIM connection

- **responseData** : object  
  The response data to return to the SCIM IdP (only when status is 'Completed')

- **responseHttpCode** : number  
  The HTTP status code to return to the SCIM IdP (only when status is 'Completed')

- **affectedUserIds** : string[]  
  Array of user IDs affected by this request (only when status is 'Completed')

- **action** : 'LinkUser' | 'DisableUser' | 'EnableUser' | 'DeleteUser'  
  The action required (only when `status` is 'ActionRequired')

- **commitId** : string  
  The ID to use when committing this change (only when `status` is 'ActionRequired')

- **userId** : string  
  The ID of the user to act upon (for DisableUser, EnableUser, DeleteUser actions)

- **primaryEmail** : string | null  
  The primary email of the SCIM user

- **userName** : string  
  The username from the SCIM request (only for LinkUser action)

- **parsedUserData** : object  
  Parsed user data based on your SCIM configuration

- **active** : boolean  
  Whether the user should be active (only for LinkUser action)

- **ssoUserSubject** : string | null  
  The SSO subject identifier (only for LinkUser action)

#### Error Types

- **statusToReturn** :  
  The HTTP status code to return to the SCIM IdP

- **bodyToReturn** :  
  The error response body to return to the SCIM IdP

- **underlyingError** :  
  Details about the specific error that occurred (e.g. InvalidApiKey, UserNotFound, MissingRequiredField)

### Link SCIM User

Links a new SCIM user to a user in your system. Used when the SCIM Request function returns a "LinkUser" action.

#### Arguments

- **connectionId** : string (required)  
  The SCIM Connection ID

- **commitId** : string (required)  
  The Commit ID returned from the SCIM Request function

- **userId** : string (required)  
  Your ID for the user

#### Successful Response

- **connectionId** : string  
  The ID of the SCIM connection

- **responseData** : object  
  The response data to return to the SCIM IdP

- **responseHttpCode** : number  
  The HTTP status code to return to the SCIM IdP

- **affectedUserIds** : string[]  
  Array of user IDs affected by this request

#### Error Types

- **ScimConnectionNotFound**  
  The provided SCIM Connection ID could not be found

- **UserNotFound**  
  The provided User ID could not be found

- **UnexpectedError**  
  An unexpected error occurred during the operation

### Commit SCIM User Change

Used after the SCIM Request function returns an "EnableUser", "DisableUser" or "DeleteUser" action to confirm you have taken said action on the user.

#### Arguments

- **connectionId** : string (required)  
  The SCIM Connection ID

- **commitId** : string (required)  
  The Commit ID returned from the SCIM Request function

#### Successful Response

- **connectionId** : string  
  The ID of the SCIM connection

- **responseData** : object  
  The response data to return to the SCIM IdP

- **responseHttpCode** : number  
  The HTTP status code to return to the SCIM IdP

- **affectedUserIds** : string[]  
  Array of user IDs affected by this request

#### Error Types

- **ScimConnectionNotFound**  
  The provided SCIM Connection ID could not be found

- **StagedChangeNotFound**  
  The provided commitId was not found

- **UnexpectedError**  
  An unexpected error occurred during the operation

### Get SCIM User

Retrieves the full SCIM user information including their groups.

#### Arguments

- **userId** : string (required)  
  The ID of the user

- **scimConnectionId** : string  
  The ID of the SCIM connection

- **customerId** : string  
  The customer ID (alternative to scimConnectionId)

#### Successful Response

- **connectionId** : string  
  The SCIM connection ID

- **user**: object  
  The user's information including:
  - **primaryEmail** : string | null  
  - **parsedUserData** : object  
  - **active** : boolean  
  - **userId** : string | null

- **groups** : array  
  Array of group memberships for the user

#### Error Types

- **ScimConnectionNotFound**  
  The provided SCIM connection ID could not be found

- **UserNotFound**  
  The user ID was not found

- **UnexpectedError**  
  An unexpected error occurred during the operation
