Identity API - Identity V1¶
Manage invitations, roles, and users within the identity system.
| Apaleo Identity API · Identity V1 | |
|---|---|
| Swagger UI | https://identity.apaleo.com/swagger/index.html?urls.primaryName=Identity+V1 |
| Client | ApaleoAPIClient |
| API | ApaleoAPIClient.identity |
| Version | ApaleoAPIClient.identity.v1 |
| Resource | ApaleoAPIClient.identity.v1.identity |
| Centralized Type Imports | from apaleoapi.apaleo.identity.v1.identity import ... |
Methods¶
Method-focused reference for Apaleo Identity API's Identity V1.
Warning
Params and payloads are fully typed for maximum developer experience, but you can also use plain dictionaries if you prefer a more dynamic approach. The SDK will handle validation and serialization for you.
The documentation examples show both approaches, but always just one of them which does not mean that the other one is not supported. Use whatever works best for you!
Responses are always fully typed. If you want to work with plain dictionaries, you can always convert the response objects using asdict() function from the dataclasses module.
Invitation¶
list_invitations¶
Returns a list of all invitations to the current account.
Endpoint Mapping
GET /api/v1/invitations
SDK Method
list_invitations(params: InvitationListParams | dict[str, Any] | None = None) -> InvitationList
# Without parameters
invitations = await client.identity.v1.identity.list_invitations()
print(invitations)
# With parameters
params = InvitationListParams(property_id="BER")
invitations = await client.identity.v1.identity.list_invitations(params)
print(invitations)
params = {"property_id": "BER"} # or {"propertyId": "BER"}
invitations = await client.identity.v1.identity.list_invitations(params)
print(invitations)
create_invitation¶
Invites a person to the current account with the requested roles and properties.
Endpoint Mapping
POST /api/v1/invitations
SDK Method
create_invitation(payload: CreateInvitation | dict[str, Any]) -> InvitedUserToAccountResponse
payload = CreateInvitation(
email="james.twelvetrees@invalid.com",
properties=["BER"],
is_account_admin=False,
role=RoleInvitedTo.HOUSEKEEPING,
)
invited_user = await client.identity.v1.identity.create_invitation(payload=payload)
print(invited_user)
payload = {
"email": "james.twelvetrees@invalid.com",
"properties": ["BER"],
"is_account_admin": False,
"role": "Housekeeping",
}
invited_user = await client.identity.v1.identity.create_invitation(payload=payload)
print(invited_user)
delete_invitation¶
Deletes an invitation by email.
Endpoint Mapping
DELETE /api/v1/invitations/{email}
SDK Method
delete_invitation(email: str) -> None
await client.identity.v1.identity.delete_invitation(email="james.twelvetrees@invalid.com")
Roles¶
list_roles¶
Returns a list of all roles in the current account.
Endpoint Mapping
GET /api/v1/roles
SDK Method
list_roles() -> RoleList
roles = await client.identity.v1.identity.list_roles()
print(roles)
Users¶
list_users¶
Returns a list of all users that have access to the current account.
Endpoint Mapping
GET /api/v1/users
SDK Method
list_users(self, params: UserListParams | dict[str, Any] | None = None) -> UsersList
users = await client.identity.v1.identity.list_users()
print(users)
params = UserListParams(property_ids=["BER", "VIE"], page_size=50, page_number=1)
users = await client.identity.v1.identity.list_users(params)
print(users)
params = {"property_ids": ["BER", "VIE"], "page_size": 50, "page_number": 1}
users = await client.identity.v1.identity.list_users(params)
print(users)
Concurrent data fetching is supported
Concurrent pagination is supported for list_users. You can fetch multiple pages of results concurrently by passing batch_size and is_concurrently=True in the parameters.
params = UserListParams(batch_size=50, is_concurrently=True)
users = await client.identity.v1.identity.list_users(params)
print(users)
get_user¶
Returns a user in the current account for a specific subjectId.
Endpoint Mapping
GET /api/v1/identity/users/{subjectId}
SDK Method
get_user(user_id: str) -> User
user = await client.identity.v1.identity.get_user(user_id="some_subject_id")
print(user)
update_user¶
Modify user in an account.
Endpoint Mapping
PATCH /api/v1/identity/users/{subjectId}
SDK Method
update_user(self, user_id: str, payload: list[Operation] | list[dict[str, Any]]) -> None
payload = [
Operation(
op="replace",
path="/enabled",
value=True,
),
Operation(
op="add",
path="/properties",
value=["BER", "VIE"],
),
]
await client.identity.v1.identity.update_user(
user_id="some_subject_id",
payload=payload,
)
payload = [
{
"op": "replace",
"path": "/enabled",
"value": True,
},
{
"op": "add",
"path": "/properties",
"value": ["BER", "VIE"],
},
]
await client.identity.v1.identity.update_user(
user_id="some_subject_id",
payload=payload,
)
get_current_user¶
Returns details for the current user.
It does not work with client credentials flow, as there is no user context in that case.
Endpoint Mapping
GET /api/v1/users/me
SDK Method
get_current_user() -> User
current_user = await client.identity.v1.identity.get_current_user()
print(current_user)