Returns a list of all SCIM directories for the instance.
from clerk_backend_api import Clerk
with Clerk (
bearer_auth = "<YOUR_BEARER_TOKEN_HERE>" ,
) as clerk :
res = clerk .scim_directories .list (limit = 20 , offset = 10 )
# Handle response
print (res )
Parameter
Type
Required
Description
Example
limit
Optional[int]
➖
Applies a limit to the number of results returned. Can be used for paginating the results together with offset.
20
offset
Optional[int]
➖
Skip the first offset results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with limit.
10
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.SCIMDirectoryList
Error Type
Status Code
Content Type
models.ClerkErrors
401, 403
application/json
models.SDKError
4XX, 5XX
*/*
Create a new SCIM directory for the instance.
from clerk_backend_api import Clerk
with Clerk (
bearer_auth = "<YOUR_BEARER_TOKEN_HERE>" ,
) as clerk :
res = clerk .scim_directories .create (request = {
"enterprise_connection_id" : "<id>" ,
"name" : "<value>" ,
"provider" : "<value>" ,
"group_role_mappings" : [
{
"scim_group_id" : "<id>" ,
"scim_group_display_name" : "<value>" ,
"role_id" : "<id>" ,
"precedence" : 919086 ,
},
],
})
# Handle response
print (res )
models.SCIMDirectory
Error Type
Status Code
Content Type
models.ClerkErrors
400, 401, 403, 422
application/json
models.SDKError
4XX, 5XX
*/*
Returns the details of a SCIM directory.
from clerk_backend_api import Clerk
with Clerk (
bearer_auth = "<YOUR_BEARER_TOKEN_HERE>" ,
) as clerk :
res = clerk .scim_directories .get (scim_directory_id = "<id>" )
# Handle response
print (res )
Parameter
Type
Required
Description
scim_directory_id
str
✔️
The ID of the SCIM directory to retrieve
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.SCIMDirectory
Error Type
Status Code
Content Type
models.ClerkErrors
401, 403, 404
application/json
models.SDKError
4XX, 5XX
*/*
Updates a SCIM directory.
from clerk_backend_api import Clerk
with Clerk (
bearer_auth = "<YOUR_BEARER_TOKEN_HERE>" ,
) as clerk :
res = clerk .scim_directories .update (scim_directory_id = "<id>" , name = "<value>" , enabled = False , provider = "<value>" , attribute_mapping = {
"key" : "<value>" ,
"key1" : "<value>" ,
"key2" : "<value>" ,
}, group_role_mapping_enabled = True )
# Handle response
print (res )
Parameter
Type
Required
Description
scim_directory_id
str
✔️
The ID of the SCIM directory to update
name
Optional[str]
➖
A human-friendly name for the SCIM directory.
enabled
Optional[bool]
➖
Whether the SCIM directory is enabled.
provider
Optional[str]
➖
The identity provider for this SCIM directory.
attribute_mapping
Dict[str, Nullable[str] ]
➖
Attribute-to-SCIM-path entries to merge into the directory's attribute mapping. Set a key to null to remove it from the mapping.
group_role_mapping_enabled
Optional[bool]
➖
Whether group-to-role mapping is enabled for this SCIM directory.
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.SCIMDirectory
Error Type
Status Code
Content Type
models.ClerkErrors
400, 401, 403, 404, 422
application/json
models.SDKError
4XX, 5XX
*/*
Deletes a SCIM directory and stops provisioning for it. SCIM requests authenticated
with the directory's API key are rejected afterwards.
from clerk_backend_api import Clerk
with Clerk (
bearer_auth = "<YOUR_BEARER_TOKEN_HERE>" ,
) as clerk :
res = clerk .scim_directories .delete (scim_directory_id = "<id>" )
# Handle response
print (res )
Parameter
Type
Required
Description
scim_directory_id
str
✔️
The ID of the SCIM directory to delete
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.DeletedObject
Error Type
Status Code
Content Type
models.ClerkErrors
401, 403, 404
application/json
models.SDKError
4XX, 5XX
*/*
Generates a new API key for the SCIM directory and returns it in the api_key field.
This is the only way to obtain the key after creation, so make sure to update it in
your identity provider. The previous key remains valid for a short grace period before
it expires.
from clerk_backend_api import Clerk
with Clerk (
bearer_auth = "<YOUR_BEARER_TOKEN_HERE>" ,
) as clerk :
res = clerk .scim_directories .rotate_api_key (scim_directory_id = "<id>" )
# Handle response
print (res )
Parameter
Type
Required
Description
scim_directory_id
str
✔️
The ID of the SCIM directory whose API key to rotate
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.SCIMDirectory
Error Type
Status Code
Content Type
models.ClerkErrors
401, 403, 404
application/json
models.SDKError
4XX, 5XX
*/*
Returns the list of SCIM group to organization role mappings for a SCIM directory, ordered by precedence.
from clerk_backend_api import Clerk
with Clerk (
bearer_auth = "<YOUR_BEARER_TOKEN_HERE>" ,
) as clerk :
res = clerk .scim_directories .list_group_role_mappings (scim_directory_id = "<id>" )
# Handle response
print (res )
Parameter
Type
Required
Description
scim_directory_id
str
✔️
The ID of the SCIM directory.
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.SCIMGroupRoleMappingList
Error Type
Status Code
Content Type
models.ClerkErrors
401, 403, 404
application/json
models.SDKError
4XX, 5XX
*/*
create_group_role_mapping
Creates a new SCIM group to organization role mapping for a SCIM directory.
Group role mapping must be enabled on the directory.
from clerk_backend_api import Clerk
with Clerk (
bearer_auth = "<YOUR_BEARER_TOKEN_HERE>" ,
) as clerk :
res = clerk .scim_directories .create_group_role_mapping (scim_directory_id = "<id>" , scim_group_id = "<id>" , role_id = "<id>" , precedence = 722732 )
# Handle response
print (res )
Parameter
Type
Required
Description
scim_directory_id
str
✔️
The ID of the SCIM directory.
scim_group_id
str
✔️
The SCIM group ID from the identity provider.
role_id
str
✔️
The ID of the organization role to assign to members of the SCIM group.
precedence
Optional[int]
➖
The precedence for this mapping. Lower values take priority when a user belongs to multiple mapped groups. If omitted, the mapping is appended with the next-highest precedence.
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.SCIMGroupRoleMapping
Error Type
Status Code
Content Type
models.ClerkErrors
400, 401, 403, 404, 422
application/json
models.SDKError
4XX, 5XX
*/*
replace_group_role_mappings
Replaces the entire set of SCIM group role mappings for a directory. The position of
each item in the mappings array determines its precedence (the first item gets
precedence 1). Passing an empty array removes all mappings. Group role mapping must be
enabled on the directory.
from clerk_backend_api import Clerk
with Clerk (
bearer_auth = "<YOUR_BEARER_TOKEN_HERE>" ,
) as clerk :
res = clerk .scim_directories .replace_group_role_mappings (scim_directory_id = "<id>" , mappings = [])
# Handle response
print (res )
Parameter
Type
Required
Description
scim_directory_id
str
✔️
The ID of the SCIM directory.
mappings
List[models.Mappings ]
✔️
The desired set of mappings. Array order sets precedence (1-indexed). An empty array clears all mappings.
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.SCIMGroupRoleMappingList
Error Type
Status Code
Content Type
models.ClerkErrors
400, 401, 403, 404, 422
application/json
models.SDKError
4XX, 5XX
*/*
delete_group_role_mapping
Deletes a single SCIM group role mapping. Group role mapping must be enabled on the
directory.
from clerk_backend_api import Clerk
with Clerk (
bearer_auth = "<YOUR_BEARER_TOKEN_HERE>" ,
) as clerk :
res = clerk .scim_directories .delete_group_role_mapping (scim_directory_id = "<id>" , mapping_id = "<id>" )
# Handle response
print (res )
Parameter
Type
Required
Description
scim_directory_id
str
✔️
The ID of the SCIM directory.
mapping_id
str
✔️
The ID of the SCIM group role mapping to delete.
retries
Optional[utils.RetryConfig]
➖
Configuration to override the default retry behavior of the client.
models.SCIMGroupRoleMappingDeleted
Error Type
Status Code
Content Type
models.ClerkErrors
400, 401, 403, 404
application/json
models.SDKError
4XX, 5XX
*/*