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://cloud.appwrite.io/v1
List Users
Get a list of all the project's users. You can use the query params to filter your results.
Request
queries Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification
search Search term to filter your list results. Max length: 256 chars.
Response
200
GET /users
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.list()
puts response.inspect
Create User
Create a new user.
Request
userId requiredUser ID. Choose your own unique ID or pass the string
ID.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 User email.
phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
password Plain text user password. Must be at least 8 chars.
name User name. Max length: 128 chars.
Response
201
POST /users
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.create(user_id: '[USER_ID]')
puts response.inspect
Create User with Argon2 Password
Create a new user. Password provided must be hashed with the Argon2 algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId requiredUser ID. Choose your own unique ID or pass the string
ID.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 requiredUser email.
password requiredUser password hashed using Argon2.
name User name. Max length: 128 chars.
Response
201
POST /users/argon2
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.create_argon2_user(user_id: '[USER_ID]', email: 'email@example.com', password: 'password')
puts response.inspect
Create User with Bcrypt Password
Create a new user. Password provided must be hashed with the Bcrypt algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId requiredUser ID. Choose your own unique ID or pass the string
ID.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 requiredUser email.
password requiredUser password hashed using Bcrypt.
name User name. Max length: 128 chars.
Response
201
POST /users/bcrypt
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.create_bcrypt_user(user_id: '[USER_ID]', email: 'email@example.com', password: 'password')
puts response.inspect
Create User with MD5 Password
Create a new user. Password provided must be hashed with the MD5 algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId requiredUser ID. Choose your own unique ID or pass the string
ID.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 requiredUser email.
password requiredUser password hashed using MD5.
name User name. Max length: 128 chars.
Response
201
POST /users/md5
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.create_md5_user(user_id: '[USER_ID]', email: 'email@example.com', password: 'password')
puts response.inspect
Create User with PHPass Password
Create a new user. Password provided must be hashed with the PHPass algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId requiredUser ID. Choose your own unique ID or pass the string
ID.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 requiredUser email.
password requiredUser password hashed using PHPass.
name User name. Max length: 128 chars.
Response
201
POST /users/phpass
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.create_ph_pass_user(user_id: '[USER_ID]', email: 'email@example.com', password: 'password')
puts response.inspect
Create User with Scrypt Password
Create a new user. Password provided must be hashed with the Scrypt algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId requiredUser ID. Choose your own unique ID or pass the string
ID.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 requiredUser email.
password requiredUser password hashed using Scrypt.
passwordSalt requiredOptional salt used to hash password.
passwordCpu requiredOptional CPU cost used to hash password.
passwordMemory requiredOptional memory cost used to hash password.
passwordParallel requiredOptional parallelization cost used to hash password.
passwordLength requiredOptional hash length used to hash password.
name User name. Max length: 128 chars.
Response
201
POST /users/scrypt
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.create_scrypt_user(user_id: '[USER_ID]', email: 'email@example.com', password: 'password', password_salt: '[PASSWORD_SALT]', password_cpu: null, password_memory: null, password_parallel: null, password_length: null)
puts response.inspect
Create User with Scrypt Modified Password
Create a new user. Password provided must be hashed with the Scrypt Modified algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId requiredUser ID. Choose your own unique ID or pass the string
ID.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 requiredUser email.
password requiredUser password hashed using Scrypt Modified.
passwordSalt requiredSalt used to hash password.
passwordSaltSeparator requiredSalt separator used to hash password.
passwordSignerKey requiredSigner key used to hash password.
name User name. Max length: 128 chars.
Response
201
POST /users/scrypt-modified
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.create_scrypt_modified_user(user_id: '[USER_ID]', email: 'email@example.com', password: 'password', password_salt: '[PASSWORD_SALT]', password_salt_separator: '[PASSWORD_SALT_SEPARATOR]', password_signer_key: '[PASSWORD_SIGNER_KEY]')
puts response.inspect
Create User with SHA Password
Create a new user. Password provided must be hashed with the SHA algorithm. Use the POST /users endpoint to create users with a plain text password.
Request
userId requiredUser ID. Choose your own unique ID or pass the string
ID.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 requiredUser email.
password requiredUser password hashed using SHA.
passwordVersion Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'
name User name. Max length: 128 chars.
Response
201
POST /users/sha
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.create_sha_user(user_id: '[USER_ID]', email: 'email@example.com', password: 'password')
puts response.inspect
GET /users/{userId}
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.get(user_id: '[USER_ID]')
puts response.inspect
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 requiredUser ID.
Response
204
DELETE /users/{userId}
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.delete(user_id: '[USER_ID]')
puts response.inspect
Update Email
Update the user email by its unique ID.
Request
userId requiredUser ID.
email requiredUser email.
Response
200
PATCH /users/{userId}/email
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.update_email(user_id: '[USER_ID]', email: 'email@example.com')
puts response.inspect
List User Logs
Get the user activity logs list by its unique ID.
Request
userId requiredUser ID.
queries Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Only supported methods are limit and offset
Response
200
GET /users/{userId}/logs
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.list_logs(user_id: '[USER_ID]')
puts response.inspect
List User Memberships
Get the user membership list by its unique ID.
Request
userId requiredUser ID.
Response
200
GET /users/{userId}/memberships
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.list_memberships(user_id: '[USER_ID]')
puts response.inspect
Update Name
Update the user name by its unique ID.
Request
userId requiredUser ID.
name requiredUser name. Max length: 128 chars.
Response
200
PATCH /users/{userId}/name
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.update_name(user_id: '[USER_ID]', name: '[NAME]')
puts response.inspect
Update Password
Update the user password by its unique ID.
Request
userId requiredUser ID.
password requiredNew user password. Must be at least 8 chars.
Response
200
PATCH /users/{userId}/password
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.update_password(user_id: '[USER_ID]', password: 'password')
puts response.inspect
Update Phone
Update the user phone by its unique ID.
Request
userId requiredUser ID.
number requiredUser phone number.
Response
200
PATCH /users/{userId}/phone
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.update_phone(user_id: '[USER_ID]', number: '+12065550100')
puts response.inspect
Get User Preferences
Get the user preferences by its unique ID.
Request
userId requiredUser ID.
Response
200
GET /users/{userId}/prefs
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.get_prefs(user_id: '[USER_ID]')
puts response.inspect
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 requiredUser ID.
prefs requiredPrefs key-value JSON object.
Response
200
PATCH /users/{userId}/prefs
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.update_prefs(user_id: '[USER_ID]', prefs: {})
puts response.inspect
List User Sessions
Get the user sessions list by its unique ID.
Request
userId requiredUser ID.
Response
200
GET /users/{userId}/sessions
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.list_sessions(user_id: '[USER_ID]')
puts response.inspect
Delete User Sessions
Delete all user's sessions by using the user's unique ID.
Request
userId requiredUser ID.
Response
204
DELETE /users/{userId}/sessions
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.delete_sessions(user_id: '[USER_ID]')
puts response.inspect
Delete User Session
Delete a user sessions by its unique ID.
Request
userId requiredUser ID.
sessionId requiredSession ID.
Response
204
DELETE /users/{userId}/sessions/{sessionId}
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.delete_session(user_id: '[USER_ID]', session_id: '[SESSION_ID]')
puts response.inspect
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 requiredUser ID.
status requiredUser Status. To activate the user pass
true
and to block the user passfalse
.
Response
200
PATCH /users/{userId}/status
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.update_status(user_id: '[USER_ID]', status: false)
puts response.inspect
Update Email Verification
Update the user email verification status by its unique ID.
Request
userId requiredUser ID.
emailVerification requiredUser email verification status.
Response
200
PATCH /users/{userId}/verification
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.update_email_verification(user_id: '[USER_ID]', email_verification: false)
puts response.inspect
Update Phone Verification
Update the user phone verification status by its unique ID.
Request
userId requiredUser ID.
phoneVerification requiredUser phone verification status.
Response
200
PATCH /users/{userId}/verification/phone
require 'Appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
users = Users.new(client)
response = users.update_phone_verification(user_id: '[USER_ID]', phone_verification: false)
puts response.inspect