User API Reference - PropelAuth Docs
Choose frameworksChoose your frameworks
Search docs... Ctrl K
User API Reference
Copy to MarkdownCopied!
These APIs can be called from the backend using your PropelAuth API Key.
POST/api/backend/v1/user/
Create User
Creates a new user
Required Permissions
Create Users
Properties
- Name
email*TypestringDescriptionThe user's email address - Name
emailConfirmedTypebooleanDescriptionWhether the user's email address has been confirmed. Default is false. - Name
sendEmailToConfirmEmailAddressTypebooleanDescriptionWhether to send an email to confirm the email address. Default is false. - Name
ignoreDomainRestrictionsTypebooleanDescriptionWhether to bypass domain allowlist/blocklist restrictions for this user. Default is false. - Name
passwordTypestringDescriptionThe user's password. If you provide this, make sure to send it to the user so they can log in. - Name
askUserToUpdatePasswordOnLoginTypebooleanDescriptionIf true, the user will be prompted to set/update their password when they next log in. Default is false. - Name
usernameTypestringDescriptionThe user's username - Name
firstNameTypestringDescriptionThe user's first name - Name
lastNameTypestringDescriptionThe user's last name - Name
propertiesType{ [key: string]: any }Description
A dictionary of custom properties for the user. See Custom Properties for more details.
Request
JavascriptPythonRustGocURL
auth.createUser({
email: "test@example.com",
emailConfirmed: false,
sendEmailToConfirmEmailAddress: false,
ignoreDomainRestrictions: false,
password: "hxjV6A0zcp",
askUserToUpdatePasswordOnLogin: false,
username: "airbud3",
firstName: "Buddy",
lastName: "Framm",
properties: {
favoriteSport: "basketball",
}
})
CopyCopied!
auth.create_user(
email = "test@example.com",
email_confirmed = False,
send_email_to_confirm_email_address = False,
ignore_domain_restrictions = False,
password = "hxjV6A0zcp",
ask_user_to_update_password_on_login = False,
username = "airbud3",
first_name = "Buddy",
last_name = "Framm",
properties = {
"favoriteSport": "basketball",
}
)
CopyCopied!
auth.user().create_user(CreateUserRequest {
email: "test@example.com".to_string(),
email_confirmed: false,
send_email_to_confirm_email_address: false,
ignore_domain_restrictions: false,
password: Some("hxjV6A0zcp".to_string()),
ask_user_to_update_password_on_login: false,
username: Some("airbud3".to_string()),
first_name: Some("Buddy".to_string()),
last_name: Some("Framm".to_string()),
properties: Some(HashMap::from([(\
"favoriteSport".to_string(),\
"basketball".to_string()\
)])),
})
CopyCopied!
auth.CreateUser(models.CreateUserParams{
Email: "test@example.com",
EmailConfirmed: false,
SendEmailToConfirmEmailAddress: false,
IgnoreDomainRestrictions: false,
Password: "hxjV6A0zcp",
AskUserToUpdatePasswordOnLogin: false,
Username: "airbud3",
FirstName: "Buddy",
LastName: "Framm",
Properties: map[string]interface{}{
"favoriteSport": "basketball",
},
})
CopyCopied!
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"email": "test@example.com",
"email_confirmed": false,
"send_email_to_confirm_email_address": false,
"ignore_domain_restrictions": false,
"password": "hxjV6A0zcp",
"ask_user_to_update_password_on_login": false,
"username": "airbud3",
"first_name": "Buddy",
"last_name": "Framm",
"properties": {
"favoriteSport": "basketball"
}
}' "<AUTH_URL>/api/backend/v1/user/"
CopyCopied!
Successful Response
{
userId: "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
}
CopyCopied!
{
"user_id": "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
}
CopyCopied!
{
"user_id": "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
}
CopyCopied!
{
"UserID": "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
}
CopyCopied!
{
"user_id": "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
}
CopyCopied!
GET/api/backend/v1/user/
Fetch User By User ID
Fetches a user by their User ID
Required Permissions
Read Users
Properties
- Name
userId*TypestringDescriptionThe user's ID - Name
includeOrgsTypebooleanDescriptionWhether to include the user’s orgs in the response
Request
JavascriptPythonRustGocURL
auth.fetchUserMetadataByUserId(
"31c41c16-c281-44ae-9602-8a047e3bf33d",
true, // includeOrgs
)
CopyCopied!
auth.fetch_user_metadata_by_user_id(
"31c41c16-c281-44ae-9602-8a047e3bf33d",
include_orgs=True,
)
CopyCopied!
auth.user().fetch_user_by_id(FetchUserByIdParams {
user_id: "31c41c16-c281-44ae-9602-8a047e3bf33d".to_string(),
include_orgs: Some(true),
})
CopyCopied!
auth.FetchUserMetadataByUserID(
uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"),
true, // includeOrgs
)
CopyCopied!
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
"<AUTH_URL>/api/backend/v1/user/{user_id}?include_orgs=true"
CopyCopied!
Successful Response
{
userId: "31c41c16-c281-44ae-9602-8a047e3bf33d",
email: "test@example.com",
emailConfirmed: true,
username: "airbud3",
firstName: "Buddy",
lastName: "Framm",
pictureUrl: "https://example.com/picture.jpg",
properties: {
favoriteSport: "basketball"
},
hasPassword: true,
updatePasswordRequired: false,
locked: false,
enabled: true,
mfaEnabled: false,
canCreateOrgs: true,
createdAt: 1627600000,
lastActiveAt: 1627600000,
orgIdToOrgInfo: {
"1189c444-8a2d-4c41-8b4b-ae43ce79a492": {
orgId: "1189c444-8a2d-4c41-8b4b-ae43ce79a492",
orgName: "Example Org",
orgMetadata: {
timezone: "EST",
},
urlSafeOrgName: "example-org",
inheritedUserRolesPlusCurrentRole: [\
"Admin",\
"Owner",\
"Member"\
],
userRole: "Owner",
userPermissions: ["can_view_billing"],
orgRoleStructure: "single_role_in_hierarchy",
additionalRoles: [],
legacyOrgId: "1234",
}
},
legacyUserId: "1234567890"
}
CopyCopied!
{
"user_id": "31c41c16-c281-44ae-9602-8a047e3bf33d",
"email": "test@example.com",
"email_confirmed": true,
"username": "airbud3",
"first_name": "Buddy",
"last_name": "Framm",
"picture_url": "https://example.com/picture.jpg",
"properties": {
"favoriteSport": "basketball"
},
"has_password": true,
"update_password_required": false,
"locked": false,
"enabled": true,
"mfa_enabled": false,
"can_create_orgs": true,
"created_at": 1627600000,
"last_active_at": 1627600000,
"org_id_to_org_info": {
"1189c444-8a2d-4c41-8b4b-ae43ce79a492": {
"org_id": "1189c444-8a2d-4c41-8b4b-ae43ce79a492",
"org_name": "Example Org",
"org_metadata": {
"timezone": "EST",
},
"user_role": "Owner",
"url_safe_org_name": "example-org",
"inherited_user_roles_plus_current_role": [\
"Admin",\
"Owner",\
"Member"\
],
"user_permissions": ["can_view_billing"],
"org_role_structure": "single_role_in_hierarchy",
"additional_roles": [],
"legacy_org_id": "1234",
}
},
"legacy_user_id": "1234567890"
}
CopyCopied!
UserMetadata {
"user_id": "31c41c16-c281-44ae-9602-8a047e3bf33d",
"email": "test@example.com",
"email_confirmed": true,
"username": "airbud3",
"first_name": "Buddy",
"last_name": "Framm",
"picture_url": "https://example.com/picture.jpg",
"properties": {
"favoriteSport": "basketball"
},
"has_password": true,
"update_password_required": false,
"locked": false,
"enabled": true,
"mfa_enabled": false,
"can_create_orgs": true,
"created_at": 1627600000,
"last_active_at": 1627600000,
"org_id_to_org_info": {
"1189c444-8a2d-4c41-8b4b-ae43ce79a492": {
"org_id": "1189c444-8a2d-4c41-8b4b-ae43ce79a492",
"org_name": "Example Org",
"url_safe_org_name": "example-org",
"org_metadata": {
"timezone": "EST",
},
"user_role": "Owner",
"inherited_user_roles_plus_current_role": [\
"Owner",\
"Admin",\
"Member"\
],
"user_permissions": ["can_view_billing"],
"org_role_structure": "single_role_in_hierarchy",
"additional_roles": [],
"legacy_org_id": "1234",
}
},
"legacy_user_id": "1234567890"
}
CopyCopied!
models.UserMetadata{
"UserID": "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
"Email": "test@example.com",
"EmailConfirmed": true,
"Username": "airbud3",
"FirstName": "Buddy",
"LastName": "Framm",
"PictureUrl": "https://example.com/picture.jpg",
"Properties": map[string]interface{}{
"favoriteSport": "basketball",
},
"HasPassword": true,
"UpdatePasswordRequired": false,
"Locked": false,
"Enabled": true,
"MfaEnabled": false,
"CanCreateOrgs": true,
"CreatedAt": 1627600000,
"LastActiveAt": 1627600000,
"OrgIDToOrgInfo": map[string]models.OrgInfo{
"1189c444-8a2d-4c41-8b4b-ae43ce79a492": {
"OrgID": "1189c444-8a2d-4c41-8b4b-ae43ce79a492",
"OrgName": "Example Org",
"OrgMetadata": map[string]interface{}{
"timezone": "EST",
},
"UserRole": "Owner",
"UrlSafeOrgName": "example-org",
"InheritedUserRolesPlusCurrentRole": [\
"Admin",\
"Owner",\
"Member"\
],
"UserPermissions": []string{"can_view_billing"},
"OrgRoleStructure": "single_role_in_hierarchy",
"AdditionalRoles": [],
"LegacyOrgID": "1234",
},
},
"LegacyUserID": "1234567890",
}
CopyCopied!
CopyCopied!
GET/api/backend/v1/user/email
Fetch User By Email
Fetches a user by their email address.
Required Permissions
Read Users
Properties
- Name
email*TypestringDescriptionThe user's email address - Name
includeOrgsTypebooleanDescriptionWhether to include the user’s orgs in the response - Name
isolatedOrgIdTypestringDescription
If an Isolated Org ID is included, only users in that organization will be able to be returned. If one is not included, only users who do not belong to an isolated org will be returned. See the Isolated Org docs for more details.
Request
JavascriptPythonRustGocURL
auth.fetchUserMetadataByEmail(
email: "test@example.com",
includeOrgs: true,
isolatedOrgId: "1189c444-8a2d-4c41-8b4b-ae43ce79a492"
)
CopyCopied!
auth.fetch_user_metadata_by_email(
"test@example.com",
include_orgs=True,
isolated_org_id="1189c444-8a2d-4c41-8b4b-ae43ce79a492"
)
CopyCopied!
auth.user().fetch_user_by_email(FetchUserByEmailParams {
email: "test@example.com".to_string(),
include_orgs: Some(true),
isolated_org_id: Some("1189c444-8a2d-4c41-8b4b-ae43ce79a492".to_string()),
})
CopyCopied!
auth.FetchUserMetadataByEmail(
"test@example.com",
true, // includeOrgs
"1189c444-8a2d-4c41-8b4b-ae43ce79a492" // isolatedOrgID
)
CopyCopied!
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
"<AUTH_URL>/api/backend/v1/user/email
?email=test@example.com
&include_orgs=true
&isolated_org_id=1189c444-8a2d-4c41-8b4b-ae43ce79a492"
CopyCopied!
Successful Response
CopyCopied!
CopyCopied!
CopyCopied!
CopyCopied!
CopyCopied!
GET/api/backend/v1/user/username
Fetch User By Username
Fetches a user by their username (if you have usernames enabled).
Required Permissions
Read Users
Properties
- Name
username*TypestringDescriptionThe user's username - Name
includeOrgsTypebooleanDescriptionWhether to include the user’s orgs in the response - Name
isolatedOrgIdTypestringDescription
Request
JavascriptPythonRustGocURL
auth.fetchUserMetadataByUsername(
username: "test@example.com",
includeOrgs: true,
isolatedOrgId: "1189c444-8a2d-4c41-8b4b-ae43ce79a492"
)
CopyCopied!
auth.fetch_user_metadata_by_username(
"airbud3",
include_orgs=True,
isolated_org_id="1189c444-8a2d-4c41-8b4b-ae43ce79a492"
)
CopyCopied!
auth.user().fetch_user_by_username(FetchUserByUsernameParams {
username: "airbud3".to_string(),
include_orgs: Some(true),
isolated_org_id: Some("1189c444-8a2d-4c41-8b4b-ae43ce79a492".to_string()),
})
CopyCopied!
auth.FetchUserMetadataByUsername(
"airbud3",
true, // includeOrgs
"1189c444-8a2d-4c41-8b4b-ae43ce79a492" // isolatedOrgID
)
CopyCopied!
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
"<AUTH_URL>/api/backend/v1/user/username
?username=airbud3
&include_orgs=true
&isolated_org_id=1189c444-8a2d-4c41-8b4b-ae43ce79a492"
CopyCopied!
Successful Response
CopyCopied!
CopyCopied!
CopyCopied!
CopyCopied!
CopyCopied!
GET/api/backend/v1/user/query
Query for Users
Paginates through the list of users. You can also filter the list by a partial email/username match, and sort the list by different fields.
Required Permissions
Read Users
Properties
- Name
pageSize*TypenumberDescriptionThe number of users to return per page - Name
pageNumber*TypenumberDescriptionThe page number to return - Name
orderByTypestringDescriptionOne of CREATED_AT_ASC, CREATED_AT_DESC, LAST_ACTIVE_AT_ASC, LAST_ACTIVE_AT_DESC, EMAIL, or USERNAME. - Name
emailOrUsernameTypestringDescriptionA partial email or username to filter the list by - Name
legacyUserIdTypestringDescriptionThe user ID from another system, such as a former auth provider. We'll return any users that contain this ID - Name
includeOrgsTypebooleanDescriptionWhether to include the user’s orgs in the response - Name
isolatedOrgIdTypestringDescription
If an Isolated Org ID is included, only users in that organization will be able to be returned. Otherwise, all users will be returned. See the Isolated Org docs for more details.
Request
JavascriptPythonRustGocURL
auth.fetchUsersByQuery({
emailOrUsername: "test",
legacyUserId: "1234",
includeOrgs: true,
isolatedOrgId: "1189c444-8a2d-4c41-8b4b-ae43ce79a492",
orderBy: "CREATED_AT_DESC",
pageNumber: 0,
pageSize: 10,
})
CopyCopied!
auth.fetch_users_by_query(
email_or_username="test",
legacy_user_id="1234",
include_orgs=True,
isolated_org_id="1189c444-8a2d-4c41-8b4b-ae43ce79a492",
order_by=UserQueryOrderBy.CREATED_AT_DESC,
page_number=0,
page_size=10,
)
CopyCopied!
auth.user().fetch_users_by_query(FetchUsersByQueryParams {
email_or_username: Some("test".to_string()),
legacy_user_id: Some("1234".to_string()),
include_orgs: Some(true),
isolated_org_id: Some("1189c444-8a2d-4c41-8b4b-ae43ce79a492".to_string()),
order_by: Some(FetchUsersOrderBy::CreatedAtDesc),
page_number: Some(0),
page_size: Some(10),
})
CopyCopied!
auth.FetchUsersByQuery(models.UserQueryParams{
EmailOrUsername: "test",
LegacyUserId: "1234",
IncludeOrgs: true,
IsolatedOrgID: "1189c444-8a2d-4c41-8b4b-ae43ce79a492",
OrderBy: "CREATED_AT_DESC",
PageNumber: 0,
PageSize: 10,
})
CopyCopied!
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
"<AUTH_URL>/api/backend/v1/user/query
?email_or_username=test
&legacy_user_id=1234
&include_orgs=true
&isolated_org_id=1189c444-8a2d-4c41-8b4b-ae43ce79a492
&order_by=CREATED_AT_DESC
&page_number=1
&page_size=10"
CopyCopied!
Successful Response
{
totalUsers: 3,
currentPage: 0,
pageSize: 10,
hasMoreResults: false,
users: [{\
userId: "31c41c16-c281-44ae-9602-8a047e3bf33d",\
// ... see fetch user for full schema\
}]
}
CopyCopied!
{
"total_users": 3,
"current_page": 0,
"page_size": 10,
"has_more_results": false,
"users": [\
{\
"user_id": "31c41c16-c281-44ae-9602-8a047e3bf33d",\
// ... see fetch user for full schema\
}\
]
}
CopyCopied!
{
total_users: 3,
current_page: 0,
page_size: 10,
has_more_results: false,
users: [\
{\
user_id: "31c41c16-c281-44ae-9602-8a047e3bf33d",\
// ... see fetch user for full schema\
}\
]
}
CopyCopied!
{
TotalUsers: 3,
CurrentPage: 0,
PageSize: 10,
HasMoreResults: false,
Users: [\
{\
UserId: "31c41c16-c281-44ae-9602-8a047e3bf33d",\
// ... see fetch user for full schema\
}\
]
}
CopyCopied!
CopyCopied!
PUT/api/backend/v1/user/
Update User
Required Permissions
Update User PropertiesUpdate User Legacy IDUpdate User Password Status
Properties
- Name
userId*TypestringDescriptionThe ID of the user to update - Name
usernameTypestringDescriptionThe user's username - Name
firstNameTypestringDescriptionThe user's first name - Name
lastNameTypestringDescriptionThe user's last name - Name
pictureUrlTypestringDescriptionThe user's profile picture URL. You can manage this yourself or use our account pages which allow the user to upload a picture that we host. - Name
propertiesType{ [key: string]: any }Description
A dictionary of custom properties for the user. See Custom Properties for more details.
- Name
updatePasswordRequiredTypebooleanDescriptionIf true, the user will be prompted to set/update their password when they next log in. Default is false. - Name
legacyUserIdTypestringDescriptionThe user’s ID in an existing system. This ID is present everywhere userId's are (e.g. fetching user metadata or validating a user's token).
Request
JavascriptPythonRustGocURL
auth.updateUserMetadata(
"31c41c16-c281-44ae-9602-8a047e3bf33d",
{
username: "username",
firstName: "firstName",
lastName: "lastName",
pictureUrl: "https://example.com/img.png",
properties: {
"customProperty": "value"
},
updatePasswordRequired: false,
legacyUserId: "1234",
}
)
CopyCopied!
auth.update_user_metadata(
user_id="31c41c16-c281-44ae-9602-8a047e3bf33d",
username="username",
first_name="firstName",
last_name="lastName",
picture_url="https://example.com/img.png",
properties={
"customProperty": "value"
},
update_password_required=False,
legacy_user_id="1234",
)
CopyCopied!
auth.user()
.update_user_metadata(UpdateUserMetadataParams {
user_id: "31c41c16-c281-44ae-9602-8a047e3bf33d".to_string(),
update_metadata_request: UpdateMetadataRequest {
username: Some("username".to_string()),
first_name: Some("firstName".to_string()),
last_name: Some("lastName".to_string()),
picture_url: Some("https://example.com/img.png".to_string()),
properties: Some(HashMap::from([(\
"customProperty".to_string(), Value::String("value".to_string())\
)])),
update_password_required: Some(false),
legacy_user_id: "1234".to_string(),
..Default::default()
},
})
CopyCopied!
auth.UpdateUserMetadata(
uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"),
models.UpdateUserMetadata{
Username: "username",
FirstName: "firstName",
LastName: "lastName",
PictureUrl: "https://example.com/img.png",
Properties: map[string]interface{}{
"customProperty": "value",
},
UpdatePasswordRequired: false,
LegacyUserID: "1234",
},
)
CopyCopied!
curl -X PUT \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"username": "username",
"first_name": "firstName",
"last_name": "lastName",
"picture_url": "https://example.com/img.png",
"properties": {
"customProperty": "value"
},
"update_password_required": false,
"legacy_user_id": "1234"
}' "<AUTH_URL>/api/backend/v1/user/<userId>"
CopyCopied!
Successful Response
true
CopyCopied!
True
CopyCopied!
Ok(())
CopyCopied!
true, nil
CopyCopied!
{}
CopyCopied!
PUT/api/backend/v1/user/
Update User Email
Updates a user's email address. You can choose whether to update it immediately or send an email to confirm the new email address.
Required Permissions
Update User Email
Properties
- Name
userId*TypestringDescriptionThe ID of the user to update - Name
newEmail*TypestringDescriptionThe user's new email address - Name
requireEmailConfirmation*TypebooleanDescriptionWhether the new email address requires confirmation. If true, an email will be sent to the new email address to confirm. If false, the users email address will be updated and confirmed immediately.
Request
JavascriptPythonRustGocURL
auth.updateUserEmail(
"31c41c16-c281-44ae-9602-8a047e3bf33d", // userId
{
newEmail: "test@example.com",
requireEmailConfirmation: false,
}
)
CopyCopied!
auth.update_user_email(
user_id="31c41c16-c281-44ae-9602-8a047e3bf33d",
new_email="test@example.com",
require_email_confirmation=False,
)
CopyCopied!
auth.user().update_user_email(UpdateUserEmailParams {
user_id: "31c41c16-c281-44ae-9602-8a047e3bf33d".to_string(),
update_email_request: UpdateEmailRequest {
new_email: "test@example.com".to_string(),
require_email_confirmation: false,
},
})
CopyCopied!
auth.UpdateUserEmail(uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"),
models.UpdateEmail{
Email: "test@example.com",
RequireEmailConfirmation: false,
},
)
CopyCopied!
curl -X PUT \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"new_email": "test@example.com",
"require_email_confirmation": false
}' "<AUTH_URL>/api/backend/v1/user/<userId>/email"
CopyCopied!
Successful Response
{}
CopyCopied!
{}
CopyCopied!
{}
CopyCopied!
{}
CopyCopied!
{}
CopyCopied!
PUT/api/backend/v1/user/
Update User Password
Updates a user's password. You can optionally require the user to update their password on their next login.
Required Permissions
Update User Password
Properties
- Name
userId*TypestringDescriptionThe ID of the user to update - Name
password*TypestringDescriptionThe user's new password - Name
askUserToUpdatePasswordOnLoginTypebooleanDescriptionWhether to ask the user to update their password on their next login
Request
JavascriptPythonRustGocURL
auth.updateUserPassword("31c41c16-c281-44ae-9602-8a047e3bf33d", {
password: "moresecurethanthis",
askUserToUpdatePasswordOnLogin: false
});
CopyCopied!
auth.update_user_password(
user_id="31c41c16-c281-44ae-9602-8a047e3bf33d",
password="moresecurethanthis",
ask_user_to_update_password_on_login=False,
)
CopyCopied!
auth.user()
.update_user_password(UpdateUserPasswordParams {
user_id: "31c41c16-c281-44ae-9602-8a047e3bf33d".to_string(),
update_password_request: UpdatePasswordRequest {
password: "moresecurethanthis".to_string(),
ask_user_to_update_password_on_login: Some(false),
},
})
CopyCopied!
auth.UpdateUserPassword(
uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"),
models.UpdateUserPasswordParam{
Password: "moresecurethanthis",
AskUserToUpdatePasswordOnLogin: nil,
},
)
CopyCopied!
curl -X PUT \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"password": "moresecurethanthis",
"ask_user_to_update_password_on_login": false
}' "<AUTH_URL>/api/backend/v1/user/<userId>/password"
CopyCopied!
Successful Response
true
CopyCopied!
True
CopyCopied!
Ok(())
CopyCopied!
true, nil
CopyCopied!
{}
CopyCopied!
PUT/api/backend/v1/user/
Clear User Password
Removes the user's password.
Required Permissions
Update User Password Status
Properties
- Name
userId*TypestringDescriptionThe ID of the user
Request
JavascriptPythonRustGocURL
auth.clearUserPassword("31c41c16-c281-44ae-9602-8a047e3bf33d");
CopyCopied!
auth.clear_user_password("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.user().clear_user_password("31c41c16-c281-44ae-9602-8a047e3bf33d".to_string())
CopyCopied!
auth.ClearUserPassword(uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"))
CopyCopied!
curl --location --request PUT '<AUTH_URL>/api/backend/v1/user/<userId>/clear_password' --header 'Content-Type: application/json' --header 'Authorization: Bearer <API_KEY>' --data '{}'
CopyCopied!
Successful Response
true
CopyCopied!
True
CopyCopied!
Ok(())
CopyCopied!
true, nil
CopyCopied!
{}
CopyCopied!
POST/api/backend/v1/magic_link
Create Magic Link
Creates a magic link that a user can use to log in. You can customize the expiration and the location the user is redirected to after logging in. Note that this doesn't send the email to the user, it just generates it and returns the URL.
Required Permissions
Create Magic Links
Properties
- Name
email*TypestringDescriptionThe user's email address - Name
redirectToUrlTypestringDescriptionThe URL to redirect the user to after they've logged in - Name
expiresInHoursTypenumberDescriptionHow many hours the link should be valid for - Name
createNewUserIfOneDoesntExistTypebooleanDescriptionIf true, when the user clicks the link, a new user will be created if one does not already exist - Name
expiresAfterFirstUseTypebooleanDescriptionIf true, the magic link will expire after it is used for the first time - Name
requiresInterstitialTypebooleanDescriptionIf true, an interstitial page will be shown to the user after they click the link - Name
userSignupQueryParametersType{ [key: string]: any }DescriptionA dictionary of query parameters to include in the user signup URL
Request
JavascriptPythonRustGocURL
auth.createMagicLink({
email: "test@example.com",
redirectToUrl: "https://app.example.com/custom_location",
expiresInHours: 24,
createNewUserIfOneDoesntExist: false,
expiresAfterFirstUse: false,
requiresInterstitial: false,
userSignupQueryParameters: {
"example": "test",
},
});
CopyCopied!
auth.create_magic_link(
email="test@example.com",
redirect_to_url="https://app.example.com/custom_location",
expires_in_hours=24,
create_new_user_if_one_doesnt_exist=False,
expire_after_first_use=False,
requires_interstitial=False,
user_signup_query_parameters={
"example": "test",
},
)
CopyCopied!
auth.user()
.create_magic_link(CreateMagicLinkRequest {
email: "test@example.com".to_string(),
redirect_to_url: Some("https://app.example.com/custom_location".to_string()),
expires_in_hours: Some(24),
create_new_user_if_one_doesnt_exist: Some(false),
expires_after_first_use: Some(false),
requires_interstitial: Some(false),
user_signup_query_parameters: Some({
"example": "test",
}),
})
CopyCopied!
auth.CreateMagicLink(models.CreateMagicLinkParams{
Email: "test@example.com",
RedirectURL: "https://app.example.com/custom_location",
ExpiresInHours: 24,
CreateNewUserIfOneDoesntExist: false,
ExpiresAfterFirstUse: false,
RequiresInterstitial: false,
UserSignupQueryParameters: map[string]string{"example": "test"},
})
CopyCopied!
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"email": "test@example.com",
"redirect_to_url": "https://app.example.com/custom_location",
"expires_in_hours": 24,
"create_new_user_if_one_doesnt_exist": false,
"expires_after_first_use": false,
"requires_interstitial": false,
"user_signup_query_parameters": {
"example": "test"
}
}' "<AUTH_URL>/api/backend/v1/magic_link"
CopyCopied!
Successful Response
{
"url": "https://auth.yourdomain.com/U6FhAcghLw5XlHyzoyFA"
}
CopyCopied!
{
"url": "https://auth.yourdomain.com/U6FhAcghLw5XlHyzoyFA"
}
CopyCopied!
{
"url": "https://auth.yourdomain.com/U6FhAcghLw5XlHyzoyFA"
}
CopyCopied!
{
"url": "https://auth.yourdomain.com/U6FhAcghLw5XlHyzoyFA"
}, nil
CopyCopied!
{
"url": "https://auth.yourdomain.com/U6FhAcghLw5XlHyzoyFA"
}
CopyCopied!
POST/api/backend/v1/access_token
Create Access Token
Generates an access token for a user. This can be used to test your backend without a frontend in tools like cURL or Postman. You can also choose the duration, which is useful for generating long-lived tokens for testing.
Required Permissions
Create Access Token Without User Authorization
Properties
- Name
userId*TypestringDescriptionThe user's ID - Name
durationInMinutes*TypenumberDescriptionHow long the token should be valid for - Name
activeOrgIdTypestringDescription
The ID of the org, if using Active Org.
Request
JavascriptPythonRustGocURL
auth.createAccessToken({
userId: "31c41c16-c281-44ae-9602-8a047e3bf33d",
durationInMinutes: 24 * 60,
activeOrgId: "1189c444-8a2d-4c41-8b4b-ae43ce79a492"
});
CopyCopied!
auth.create_access_token(
user_id="31c41c16-c281-44ae-9602-8a047e3bf33d",
duration_in_minutes=24 * 60,
active_org_id="1189c444-8a2d-4c41-8b4b-ae43ce79a492"
)
CopyCopied!
auth.access_token()
.create_access_token(CreateAccessTokenParams {
create_access_token_request: CreateAccessTokenRequest {
user_id: "31c41c16-c281-44ae-9602-8a047e3bf33d".to_string(),
duration_in_minutes: 60 * 24,
active_org_id: "1189c444-8a2d-4c41-8b4b-ae43ce79a492".to_string(),
..Default::default()
},
})
CopyCopied!
auth.CreateAccessToken(
UserID: uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"),
DurationInMinutes: 60 * 24
ActiveOrgId: uuid.MustParse("1189c444-8a2d-4c41-8b4b-ae43ce79a492"),
)
CopyCopied!
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"user_id": "31c41c16-c281-44ae-9602-8a047e3bf33d",
"duration_in_minutes": 1440,
"active_org_id": "1189c444-8a2d-4c41-8b4b-ae43ce79a492"
}' "<AUTH_URL>/api/backend/v1/access_token"
CopyCopied!
Successful Response
{
"accessToken": "eyJ0eXAiOi..."
}
CopyCopied!
{
"access_token": "eyJ0eXAiOi..."
}
CopyCopied!
{
"access_token": "eyJ0eXAiOi..."
}
CopyCopied!
{
"AccessToken": "eyJ0eXAiOi..."
}, nil
CopyCopied!
{
"access_token": "eyJ0eXAiOi..."
}
CopyCopied!
POST/api/backend/v1/migrate_user/
Migrate User From External Source
Migrates a user from an external source. This is similar to the Create User API, but for cases where the user already exists in another system. With this API you can maintain the user's existing ID, password (via a hashed password), and 2FA.
Required Permissions
Migrate Users
Properties
- Name
email*TypestringDescriptionThe user's email address - Name
emailConfirmed*TypebooleanDescriptionWhether the user's email address has been confirmed. Default is false. - Name
existingUserIdTypestringDescriptionThe user’s ID in the existing system. This ID will be stored on the user as a legacyUserId and it is present everywhere userId's are (e.g. fetching user metadata or validating a user's token). - Name
existingPasswordHashTypestringDescription
The hashed password of the user. We support bcrypt, argon2, pbkdf2_sha256, pbkdf2_sha256_b64 (Microsoft.AspNetCore.Identity), and pbkdf2_sha512 password hashes. Click here for more details.
- Name
existingMfaBase32EncodedSecretTypestringDescriptionThe user's MFA secret, base32 encoded. If specified the user will have MFA enabled by default. - Name
askUserToUpdatePasswordOnLoginTypebooleanDescriptionIf true, the user will be prompted to set/update their password when they next log in. Default is false. - Name
enabledTypebooleanDescriptionWhether the user is enabled. Default is true. - Name
usernameTypestringDescriptionThe user's username - Name
firstNameTypestringDescriptionThe user's first name - Name
lastNameTypestringDescriptionThe user's last name - Name
pictureUrlTypestringDescriptionThe user's profile picture URL. You can manage this yourself or use our account pages which allow the user to upload a picture that we host. - Name
propertiesType{ [key: string]: any }Description
A dictionary of custom properties for the user. See Custom Properties for more details.
Request
JavascriptPythonRustGocURL
auth.migrateUserFromExternalSource({
email: "test@example.com",
emailConfirmed: true,
existingUserId: "1234",
existingPasswordHash: "bcrypt_hash",
existingMfaBase32EncodedSecret: "base32_encoded_secret",
askUserToUpdatePasswordOnLogin: false,
enabled: true,
username: "airbud3",
firstName: "Buddy",
lastName: "Framm",
pictureUrl: "https://example.com/img.png",
properties: {
"favoriteSport": "basketball",
}
})
CopyCopied!
auth.migrate_user_from_external_source(
email = "test@example.com",
email_confirmed = True,
existing_user_id = "1234",
existing_password_hash = "bcrypt_hash",
existing_mfa_base32_encoed_secret = "base32_encoded_secret",
ask_user_to_update_password_on_login = False,
enabled = True,
username = "airbud3",
first_name = "Buddy",
last_name = "Framm",
picture_url="https://example.com/img.png",
properties = {
"favoriteSport": "basketball",
}
)
CopyCopied!
auth.user().migrate_user(MigrateUserRequest {
email: "test@example.com".to_string(),
email_confirmed: true,
existing_user_id: "1234".to_string(),
existing_password_hash: "bcrypt_hash".to_string(),
existing_mfa_base32_encoded_secret: "base32_encoded_secret".to_string(),
ask_user_to_update_password_on_login: false,
enabled: true,
username: Some("airbud3".to_string()),
first_name: Some("Buddy".to_string()),
last_name: Some("Framm".to_string()),
picture_url: Some("https://example.com/img.png".to_string()),
properties: Some(HashMap::from([(\
"favoriteSport".to_string(),\
"basketball".to_string()\
)])),
})
CopyCopied!
auth.MigrateUserFromExternalSource(models.MigrateUserParams {
Email: "test@example.com",
EmailConfirmed: true,
ExistingUserID: "1234",
ExistingPasswordHash: "bcrypt_hash",
ExistingMfaBase32EncodedSecret: "base32_encoded_secret",
UpdatePasswordRequired: false,
Enabled: true,
Username: "airbud3",
FirstName: "Buddy",
LastName: "Framm",
PictureUrl: "https://example.com/img.png",
Properties: map[string]interface{}{
"favoriteSport": "basketball",
},
})
CopyCopied!
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"email": "test@example.com",
"email_confirmed": true,
"existing_user_id": "1234",
"existing_password_hash": "bcrypt_hash",
"existing_mfa_base32_encoded_secret": "base32_encoded_secret",
"update_password_required": false,
"enabled": true,
"username": "airbud3",
"first_name": "Buddy",
"last_name": "Framm",
"picture_url": "https://example.com/img.png",
"properties": {
favoriteSport: "basketball"
}
}' "<AUTH_URL>/api/backend/v1/migrate_user/"
CopyCopied!
Successful Response
{
userId: "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
}
CopyCopied!
{
"user_id": "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
}
CopyCopied!
{
"user_id": "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
}
CopyCopied!
{
"UserID": "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
}
CopyCopied!
{
"user_id": "bf186f61-b204-4dd6-a6dc-a4ba2c97db1d"
}
CopyCopied!
POST/api/backend/v1/migrate_user/password
Migrate User Password
Migrates a user's password from an external source. This can be used alongside the Migrate User API or to update a user's password if it was updated in the old system after migration.
Required Permissions
Update User Password
Properties
- Name
userId*TypestringDescriptionThe ID of the user to update - Name
passwordHash*TypestringDescription
The hashed password of the user. We support bcrypt, argon2, pbkdf2_sha256, pbkdf2_sha256_b64 (Microsoft.AspNetCore.Identity), and pbkdf2_sha512 password hashes. Click here for more details.
Request
JavascriptPythonRustGocURL
auth.migrateUserPassword({
userId: "31c41c16-c281-44ae-9602-8a047e3bf33d",
passwordHash: "bcrypt_hash",
})
CopyCopied!
auth.migrate_user_password(
user_id="31c41c16-c281-44ae-9602-8a047e3bf33d",
password_hash="bcrypt_hash",
)
CopyCopied!
auth.user().migrate_user_password(MigrateUserPasswordRequest {
user_id: "31c41c16-c281-44ae-9602-8a047e3bf33d".to_string(),
password_hash: "bcrypt_hash".to_string(),
})
CopyCopied!
auth.MigrateUserPassword(models.MigrateUserPasswordParams {
UserID: "31c41c16-c281-44ae-9602-8a047e3bf33d",
PasswordHash: "bcrypt_hash",
})
CopyCopied!
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"user_id": "31c41c16-c281-44ae-9602-8a047e3bf33d",
"password_hash": "bcrypt_hash"
}' "<AUTH_URL>/api/backend/v1/migrate_user/password"
CopyCopied!
Successful Response
true
CopyCopied!
True
CopyCopied!
Ok(())
CopyCopied!
true, nil
CopyCopied!
{}
CopyCopied!
DELETE/api/backend/v1/user/
Delete User
Deletes a user. This will permanently delete the user and all of the user's data.
Required Permissions
Delete Users
Properties
- Name
userId*TypestringDescriptionThe user's ID
Request
JavascriptPythonRustGocURL
auth.deleteUser("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.delete_user("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.user().delete_user("31c41c16-c281-44ae-9602-8a047e3bf33d".to_string())
CopyCopied!
auth.DeleteUser(uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"))
CopyCopied!
curl -X DELETE \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{}' \
"<AUTH_URL>/api/backend/v1/user/<userId>"
CopyCopied!
Successful Response
true
CopyCopied!
True
CopyCopied!
Ok(())
CopyCopied!
true, nil
CopyCopied!
{}
CopyCopied!
POST/api/backend/v1/user/
Disable / Block User
Disables / blocks a user. This will prevent the user from logging in until the user is disabled again.
Required Permissions
Enable/Disable User
Properties
- Name
userId*TypestringDescriptionThe user's ID
Request
JavascriptPythonRustGocURL
auth.disableUser("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.disable_user("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.user().disable_user("31c41c16-c281-44ae-9602-8a047e3bf33d".to_string())
CopyCopied!
auth.DisableUser(uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"))
CopyCopied!
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{}' \
"<AUTH_URL>/api/backend/v1/user/<userId>/disable"
CopyCopied!
Successful Response
true
CopyCopied!
True
CopyCopied!
Ok(())
CopyCopied!
true, nil
CopyCopied!
{}
CopyCopied!
POST/api/backend/v1/user/
Enable / Unblock User
Enables / Unblocks a user that was previously disabled / blocked.
Required Permissions
Enable/Disable User
Properties
- Name
userId*TypestringDescriptionThe user's ID
Request
JavascriptPythonRustGocURL
auth.enableUser("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.enable_user("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.user().enable_user("31c41c16-c281-44ae-9602-8a047e3bf33d".to_string())
CopyCopied!
auth.EnableUser(uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"))
CopyCopied!
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{}' \
"<AUTH_URL>/api/backend/v1/user/<userId>/enable"
CopyCopied!
Successful Response
true
CopyCopied!
True
CopyCopied!
Ok(())
CopyCopied!
true, nil
CopyCopied!
{}
CopyCopied!
POST/api/backend/v1/user/
Disable User 2FA
Disables two-factor authentication for a user.
Required Permissions
Update User MFA Status
Properties
- Name
userId*TypestringDescriptionThe user's ID
Request
JavascriptPythonRustGocURL
auth.disableUser2fa("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.disable_user_2fa("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.user().disable_user_2fa("31c41c16-c281-44ae-9602-8a047e3bf33d".to_string())
CopyCopied!
auth.DisableUser2fa(uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"))
CopyCopied!
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{}' \
"<AUTH_URL>/api/backend/v1/user/<userId>/disable_2fa"
CopyCopied!
Successful Response
true
CopyCopied!
True
CopyCopied!
Ok(())
CopyCopied!
true, nil
CopyCopied!
{}
CopyCopied!
POST/api/backend/v1/resend_email_confirmation
Resend Email Confirmation
Resend a confirmation email to an unconfirmed user.
Required Permissions
Send Email Confirmations
Properties
- Name
userId*TypestringDescriptionThe user's ID
Request
JavascriptPythonRustGocURL
auth.resendEmailConfirmation("fa29ee8b-ac8f-42b9-bf52-0b4827797fd3")
CopyCopied!
auth.resend_email_confirmation("fa29ee8b-ac8f-42b9-bf52-0b4827797fd3")
CopyCopied!
auth.user().resend_email_confirmation("fa29ee8b-ac8f-42b9-bf52-0b4827797fd3".to_string())
CopyCopied!
auth.ResendEmailConfirmation(uuid.MustParse("fa29ee8b-ac8f-42b9-bf52-0b4827797fd3"))
CopyCopied!
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"user_id": "fa29ee8b-ac8f-42b9-bf52-0b4827797fd3"
}' "<AUTH_URL>/api/backend/v1/resend_email_confirmation"
CopyCopied!
Successful Response
true
CopyCopied!
True
CopyCopied!
Ok(())
CopyCopied!
true, nil
CopyCopied!
CopyCopied!
POST/api/backend/v1/user/
Logout All User Sessions
Force logout a user from all sessions.
Required Permissions
Log Users Out
Properties
- Name
userId*TypestringDescriptionThe user's ID
Request
JavascriptPythonRustGocURL
auth.logoutAllUserSessions("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.logout_all_user_sessions("31c41c16-c281-44ae-9602-8a047e3bf33d")
CopyCopied!
auth.user().logout_all_user_sessions("31c41c16-c281-44ae-9602-8a047e3bf33d".to_string())
CopyCopied!
auth.LogoutAllUserSessions(uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"))
CopyCopied!
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{}' \
"<AUTH_URL>/api/backend/v1/user/<userId>/logout_all_sessions"
CopyCopied!
Successful Response
true
CopyCopied!
True
CopyCopied!
Ok(())
CopyCopied!
true, nil
CopyCopied!
CopyCopied!
GET/api/backend/v1/employee/
Fetch Employee By ID
Fetches the email address of a member of your PropelAuth project. Can be used to get the email address of the impersonator during an impersonation session.
Required Permissions
Read Employee Information
Properties
- Name
employeeId*TypestringDescriptionThe ID of the employee
Request
JavascriptPythonRustGocURL
auth.fetchEmployeeById({
employeeId: "31c41c16-c281-44ae-9602-8a047e3bf33d"
})
CopyCopied!
auth.fetch_employee_by_id(
employee_id="31c41c16-c281-44ae-9602-8a047e3bf33d"
)
CopyCopied!
auth.employee().fetch_employee_by_id(FetchEmployeeByIdParams {
employee_id: "31c41c16-c281-44ae-9602-8a047e3bf33d".to_string(),
})
CopyCopied!
auth.FetchEmployeeByID(uuid.MustParse("31c41c16-c281-44ae-9602-8a047e3bf33d"))
CopyCopied!
curl -H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
"<AUTH_URL>/api/backend/v1/employee/<employee_id>"
CopyCopied!
Successful Response
{
email: "test@example.com"
}
CopyCopied!
{
email: "test@example.com"
}
CopyCopied!
Employee {
email: "test@example.com"
}
CopyCopied!
models.FetchEmployeeByIDResponse{
Email: "test@example.com"
}
CopyCopied!
{
"email": "test@example.com"
}
CopyCopied!