The Users service allows you to manage your project users. Use this service to search, block, and view your users' info, current sessions, and latest activity logs. You can also use the Users service to edit your users' preferences and personal info.
https://<REGION>.cloud.appwrite.io/v1
Create User
Create a new user.
Request
userId string requiredUser ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
email string requiredUser email.
password string requiredUser password. Must be at least 8 chars.
name string User name. Max length: 128 chars.
Response
201 application/json
POST /users
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.create('[USER_ID]', 'email@example.com', 'password')
Get User
Get a user by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
GET /users/{userId}
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.get('[USER_ID]')
Get User Logs
Get the user activity logs list by its unique ID.
Request
userId string requiredUser ID.
limit integer Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
offset integer Offset value. The default value is 0. Use this value to manage pagination. learn more about pagination
Response
200 application/json
GET /users/{userId}/logs
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.get_logs('[USER_ID]')
Get User Memberships
Get the user membership list by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
GET /users/{userId}/memberships
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.get_memberships('[USER_ID]')
Get User Preferences
Get the user preferences by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
GET /users/{userId}/prefs
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.get_prefs('[USER_ID]')
Get User Sessions
Get the user sessions list by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
GET /users/{userId}/sessions
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.get_sessions('[USER_ID]')
List Users
Get a list of all the project's users. You can use the query params to filter your results.
Request
search string Search term to filter your list results. Max length: 256 chars.
limit integer Maximum number of users to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
offset integer Offset value. The default value is 0. Use this param to manage pagination. learn more about pagination
cursor string ID of the user used as the starting point for the query, excluding the user itself. Should be used for efficient pagination when working with large sets of data. learn more about pagination
cursorDirection string Direction of the cursor, can be either 'before' or 'after'.
orderType string Order result by ASC or DESC order.
Response
200 application/json
GET /users
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.list()
Update Email
Update the user email by its unique ID.
Request
userId string requiredUser ID.
email string requiredUser email.
Response
200 application/json
PATCH /users/{userId}/email
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.update_email('[USER_ID]', 'email@example.com')
Update Email Verification
Update the user email verification status by its unique ID.
Request
userId string requiredUser ID.
emailVerification boolean requiredUser email verification status.
Response
200 application/json
PATCH /users/{userId}/verification
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.update_email_verification('[USER_ID]', False)
Update Name
Update the user name by its unique ID.
Request
userId string requiredUser ID.
name string requiredUser name. Max length: 128 chars.
Response
200 application/json
PATCH /users/{userId}/name
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.update_name('[USER_ID]', '[NAME]')
Update Password
Update the user password by its unique ID.
Request
userId string requiredUser ID.
password string requiredNew user password. Must be at least 8 chars.
Response
200 application/json
PATCH /users/{userId}/password
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.update_password('[USER_ID]', 'password')
Update Phone
Update the user phone by its unique ID.
Request
userId string requiredUser ID.
number string requiredUser phone number.
Response
200 application/json
PATCH /users/{userId}/phone
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.update_phone('[USER_ID]', '')
Update Phone Verification
Update the user phone verification status by its unique ID.
Request
userId string requiredUser ID.
phoneVerification boolean requiredUser phone verification status.
Response
200 application/json
PATCH /users/{userId}/verification/phone
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.update_phone_verification('[USER_ID]', False)
Update User Preferences
Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
Request
userId string requiredUser ID.
prefs object requiredPrefs key-value JSON object.
Response
200 application/json
PATCH /users/{userId}/prefs
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.update_prefs('[USER_ID]', {})
Update User Status
Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved.
Request
userId string requiredUser ID.
status boolean requiredUser Status. To activate the user pass
true
and to block the user passfalse
.
Response
200 application/json
PATCH /users/{userId}/status
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.update_status('[USER_ID]', False)
Delete User
Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the updateStatus endpoint instead.
Request
userId string requiredUser ID.
Response
204 no content
DELETE /users/{userId}
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.delete('[USER_ID]')
Delete User Session
Delete a user sessions by its unique ID.
Request
userId string requiredUser ID.
sessionId string requiredSession ID.
Response
204 no content
DELETE /users/{userId}/sessions/{sessionId}
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.delete_session('[USER_ID]', '[SESSION_ID]')
Delete User Sessions
Delete all user's sessions by using the user's unique ID.
Request
userId string requiredUser ID.
Response
204 no content
DELETE /users/{userId}/sessions
from appwrite.client import Client
from appwrite.services.users import Users
client = Client()
(client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)
users = Users(client)
result = users.delete_sessions('[USER_ID]')