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 a custom ID or generate a random ID with
ID.unique()
. 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 User email.
phone string Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
password string Plain text user password. Must be at least 8 chars.
name string User name. Max length: 128 chars.
Response
201 application/json
POST /users
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.create(
userId: "[USER_ID]"
)
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 string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. 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 hashed using Argon2.
name string User name. Max length: 128 chars.
Response
201 application/json
POST /users/argon2
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.createArgon2User(
userId: "[USER_ID]",
email: "email@example.com",
password: "password"
)
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 string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. 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 hashed using Bcrypt.
name string User name. Max length: 128 chars.
Response
201 application/json
POST /users/bcrypt
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.createBcryptUser(
userId: "[USER_ID]",
email: "email@example.com",
password: "password"
)
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 string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. 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 hashed using MD5.
name string User name. Max length: 128 chars.
Response
201 application/json
POST /users/md5
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.createMD5User(
userId: "[USER_ID]",
email: "email@example.com",
password: "password"
)
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 string requiredUser ID. Choose a custom 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 string requiredUser email.
password string requiredUser password hashed using PHPass.
name string User name. Max length: 128 chars.
Response
201 application/json
POST /users/phpass
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.createPHPassUser(
userId: "[USER_ID]",
email: "email@example.com",
password: "password"
)
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 string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. 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 hashed using Scrypt Modified.
passwordSalt string requiredSalt used to hash password.
passwordSaltSeparator string requiredSalt separator used to hash password.
passwordSignerKey string requiredSigner key used to hash password.
name string User name. Max length: 128 chars.
Response
201 application/json
POST /users/scrypt-modified
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.createScryptModifiedUser(
userId: "[USER_ID]",
email: "email@example.com",
password: "password",
passwordSalt: "[PASSWORD_SALT]",
passwordSaltSeparator: "[PASSWORD_SALT_SEPARATOR]",
passwordSignerKey: "[PASSWORD_SIGNER_KEY]"
)
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 string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. 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 hashed using Scrypt.
passwordSalt string requiredOptional salt used to hash password.
passwordCpu integer requiredOptional CPU cost used to hash password.
passwordMemory integer requiredOptional memory cost used to hash password.
passwordParallel integer requiredOptional parallelization cost used to hash password.
passwordLength integer requiredOptional hash length used to hash password.
name string User name. Max length: 128 chars.
Response
201 application/json
POST /users/scrypt
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.createScryptUser(
userId: "[USER_ID]",
email: "email@example.com",
password: "password",
passwordSalt: "[PASSWORD_SALT]",
passwordCpu: 0,
passwordMemory: 0,
passwordParallel: 0,
passwordLength: 0
)
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 string requiredUser ID. Choose a custom ID or generate a random ID with
ID.unique()
. 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 hashed using SHA.
passwordVersion string 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 string User name. Max length: 128 chars.
Response
201 application/json
POST /users/sha
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.createSHAUser(
userId: "[USER_ID]",
email: "email@example.com",
password: "password"
)
Get User
Get a user by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
GET /users/{userId}
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.get(
userId: "[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
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let preferences = try await users.getPrefs(
userId: "[USER_ID]"
)
List User Logs
Get the user activity logs list by its unique ID.
Request
userId string requiredUser ID.
queries array 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 application/json
GET /users/{userId}/logs
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let logList = try await users.listLogs(
userId: "[USER_ID]"
)
List User Memberships
Get the user membership list by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
GET /users/{userId}/memberships
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let membershipList = try await users.listMemberships(
userId: "[USER_ID]"
)
List User Sessions
Get the user sessions list by its unique ID.
Request
userId string requiredUser ID.
Response
200 application/json
GET /users/{userId}/sessions
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let sessionList = try await users.listSessions(
userId: "[USER_ID]"
)
List Users
Get a list of all the project's users. You can use the query params to filter your results.
Request
queries array 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 string Search term to filter your list results. Max length: 256 chars.
Response
200 application/json
GET /users
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let userList = try await 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
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.updateEmail(
userId: "[USER_ID]",
email: "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
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.updateEmailVerification(
userId: "[USER_ID]",
emailVerification: xfalse
)
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
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.updateName(
userId: "[USER_ID]",
name: "[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
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.updatePassword(
userId: "[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
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.updatePhone(
userId: "[USER_ID]",
number: "+12065550100"
)
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
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.updatePhoneVerification(
userId: "[USER_ID]",
phoneVerification: xfalse
)
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
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let preferences = try await users.updatePrefs(
userId: "[USER_ID]",
prefs: [:]
)
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
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let user = try await users.updateStatus(
userId: "[USER_ID]",
status: xfalse
)
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}
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let result = try await users.delete(
userId: "[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}
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let result = try await users.deleteSession(
userId: "[USER_ID]",
sessionId: "[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
import Appwrite
let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let users = Users(client)
let result = try await users.deleteSessions(
userId: "[USER_ID]"
)